[CON-3065] feat(Gusto): gusto-read#2920
Open
ejoo wants to merge 3 commits into
Open
Conversation
- 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".
jlimatampersand
approved these changes
Apr 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Installation
Gusto using OAuth 2.0 Authorization Code grant. Both production (
api.gusto.com) and sandbox (api.gusto-demo.com, registered asgustoDemo) are supported.Conventions
internal/componentspage+per); incremental sync is not applicable — the Gusto API does not exposesince/updated_atquery parameters on any list endpointReadResults.Fieldsis returning. (N/A - Read only)employeesand notemployees.list).Known Limitations
companyIdmetadata is required for every company-scoped and employee-scoped object (all supported objects exceptcompanies); returned asErrMissingCompanyIDwhen missingEmployee-scoped objects (
jobs,employee_benefits,garnishments,home_addresses,work_addresses,time_off_activities) fan out one HTTP request per employee viasimultaneously.DoCtx;maxConcurrentEmployeeFetch = 4stays well under Gusto's 200 req/min rate limitcompensationsis not supported — it lives at/jobs/{job_id}/compensations, which would require two-level fan-out (employees → jobs → compensations); no precedent in the repoIncremental sync is not supported — per the official Gusto OpenAPI spec only
locationsandpayrollshave timestamp fields, and no list endpoint accepts time-filter query parametersPage size is capped at
maxPageSize = 100to prevent mis-detecting end-of-pages if Gusto silently caps server-side below the requested valueTesting
Unit Tests
Live Test