Skip to content

payroll list: validate date range before the API 422s - #149

Open
tmfahey wants to merge 2 commits into
mainfrom
aint-790-payroll-date-range
Open

payroll list: validate date range before the API 422s#149
tmfahey wants to merge 2 commits into
mainfrom
aint-790-payroll-date-range

Conversation

@tmfahey

@tmfahey tmfahey commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

payroll list --start-date/--end-date was passed straight through to GET /v1/companies/{id}/payrolls, which 422s when the range spans more than a year or end-date is more than 3 months out. This validates both rules client-side and returns a blocked_on entry instead, so the failure is deterministic and actionable before the request goes out.

Test plan

  • bun run test:all passes locally
  • Manual run of touched commands works against sandbox
  • --agent and --human output verified where touched

Ran the built binary (dist/gusto payroll list) directly, unauthenticated, against the exact >1yr-apart range from the repro, the >3mo-future case, and both combined; each returns the expected blocked_on entry in both --agent and human output. A valid range still passes validation through to the correct no_access_token error rather than reaching the API, so no live sandbox call was made.

DCO

  • Every commit is signed off (git commit -s) per the DCO

@tmfahey
tmfahey requested review from a team and ashieh as code owners July 24, 2026 16:41
@tmfahey tmfahey changed the title [AINT-790] payroll list: validate date range before the API 422s payroll list: validate date range before the API 422s Jul 27, 2026
Signed-off-by: tmfahey <taylor.fahey@gusto.com>
@tmfahey
tmfahey force-pushed the aint-790-payroll-date-range branch from be9ba19 to 381f66f Compare July 27, 2026 18:29
Comment thread src/commands/payroll.ts Outdated
Signed-off-by: tmfahey <taylor.fahey@gusto.com>
@azrosen92

Copy link
Copy Markdown

I'm a bit wary of reproducing backend/validation logic on a thin wrapper around the API. That logic could easily change, and keeping this business logic in sync with the API's logic is not trivial. What was the motivation for doing this?

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.

3 participants