Skip to content

[CON-3065] feat(Gusto): gusto-read#2920

Open
ejoo wants to merge 3 commits into
gusto-metadatafrom
gusto-read
Open

[CON-3065] feat(Gusto): gusto-read#2920
ejoo wants to merge 3 commits into
gusto-metadatafrom
gusto-read

Conversation

@ejoo
Copy link
Copy Markdown
Contributor

@ejoo ejoo commented Apr 24, 2026

Installation

Gusto using OAuth 2.0 Authorization Code grant. Both production (api.gusto.com) and sandbox (api.gusto-demo.com, registered as gustoDemo) are supported.

Conventions

  • Connector uses internal/components
  • Metadata uses V2 metadata format
  • Read supports pagination (Gusto page + per); incremental sync is not applicable — the Gusto API does not expose since/updated_at query parameters on any list endpoint
  • Raw response is returned as is for READ & METADATA, no formatting or flattening is performed.
  • Write payloads should accept what ReadResults.Fields is returning. (N/A - Read only)
  • Provider errors are mapped if non-standard (errors with 200 response code are converted to 4XX)
  • Custom fields, if not human readable names, are resolved to readable names. (N/A)
  • Unit tests cover read/metadata logic (placed in /providers/gusto)
  • Appropriate object names are used. Objects need to be resources, not actions (employees and not employees.list).
  • Modules are only being added because: (N/A - Single module)
    • They share the same authentication scheme
    • The same base URL cannot be used to make a proxy call to objects in all modules
    • Different base URLs (drive.google.com vs google.com)
    • Object name collisions (same object exists in two or more modules)

Known Limitations

  • companyId metadata is required for every company-scoped and employee-scoped object (all supported objects except companies); returned as ErrMissingCompanyID when missing

  • Employee-scoped objects (jobs, employee_benefits, garnishments, home_addresses, work_addresses, time_off_activities) fan out one HTTP request per employee via simultaneously.DoCtx;
    maxConcurrentEmployeeFetch = 4 stays well under Gusto's 200 req/min rate limit

  • compensations is not supported — it lives at /jobs/{job_id}/compensations, which would require two-level fan-out (employees → jobs → compensations); no precedent in the repo

  • Incremental sync is not supported — per the official Gusto OpenAPI spec only locations and payrolls have timestamp fields, and no list endpoint accepts time-filter query parameters

  • Page size is capped at maxPageSize = 100 to prevent mis-detecting end-of-pages if Gusto silently caps server-side below the requested value


Testing

Unit Tests

image image

Live Test

image image image image image image

ejoo added 3 commits April 24, 2026 18:55
- Use common.MakeRecordsFunc via a recordsFunc helper with a doc comment
  explaining that schemas.json uses responseKey="" because Gusto returns
  bare JSON arrays at the root (handled via jsonquery.SelfReference).
- Drop the redundant employeeScopedPath map; its values were always equal
  to the keys, so use params.ObjectName directly as the child URL suffix.
- Cap PageSize at maxPageSize=100 via a pageSize() helper. Without this,
  if Gusto silently caps per server-side below the user-requested value,
  our "records < per" end-of-pages check would mis-detect the last page.
- Enhance read_test.go: the employees and jobs tests now use
  ComparatorSubsetRead and assert Raw preserves fields that were not
  requested (email on employees; rate/payment_unit/primary on jobs),
  proving raw responses are not altered.
- Extract extractUUIDs and fetchChildrenForEmployees helpers to bring
  parseEmployeeScopedResponse under the funlen 60-line limit.
- Extract queryParamIntOrDefault, defaultPageSizeInt, and cloneURL
  helpers to bring nextPageFromPageCounter under the cyclop
  complexity-10 limit.
- Rephrase a comment to avoid the typos linter flagging "mis-detect".
@ejoo ejoo requested a review from jlimatampersand April 24, 2026 16:52
@linear
Copy link
Copy Markdown

linear Bot commented Apr 24, 2026

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants