payroll list: validate date range before the API 422s - #149
Open
tmfahey wants to merge 2 commits into
Open
Conversation
Signed-off-by: tmfahey <taylor.fahey@gusto.com>
tmfahey
force-pushed
the
aint-790-payroll-date-range
branch
from
July 27, 2026 18:29
be9ba19 to
381f66f
Compare
jcraigk
reviewed
Jul 27, 2026
Signed-off-by: tmfahey <taylor.fahey@gusto.com>
|
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? |
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.
Summary
payroll list --start-date/--end-datewas passed straight through toGET /v1/companies/{id}/payrolls, which 422s when the range spans more than a year orend-dateis more than 3 months out. This validates both rules client-side and returns ablocked_onentry instead, so the failure is deterministic and actionable before the request goes out.Test plan
bun run test:allpasses locally--agentand--humanoutput verified where touchedRan 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 expectedblocked_onentry in both--agentand human output. A valid range still passes validation through to the correctno_access_tokenerror rather than reaching the API, so no live sandbox call was made.DCO
git commit -s) per the DCO