Repository navigation
feat(scripts): add a contract details schema canary - #1481
Merged
Merged
Conversation
…React buildHeadlessForm, parseValuesForValidation and withFieldsetObjects move from useHeadlessForm into src/common/headlessForm.ts, so a script can run the exact build and validate path the hook uses. useHeadlessForm calls them with no change in behaviour. An oxlint rule keeps the two builders importable only by useHeadlessForm, scripts/ and tests, so they don't become a second way to build forms. Onboarding gets CONTRACT_DETAILS_STRATEGY and getContractDetailsStrategy(country), so the flow and anything that needs to mirror it pick the useHeadlessForm strategy from the same function. No public API changes. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
npm run schema-canary checks every EOR country from /v1/countries against the sandbox gateway: - seed: creates a sandbox employment, so the schema is fetched with a real employment_id like the flow does; archived afterwards, including when a later setup step fails. - pinned: builds the contract_details version the example app pins with the same useHeadlessForm strategy Onboarding uses, and validates. - latest: the same at json_schema_version=latest, warning only. - submit: fills the schema, runs the values through the SDK's build, validation, money conversion and parsing, sends the flow's PATCH, then reads the employment back and fails on any value saved differently or not at all. Forced values (const equal to default) are skipped in the read-back only when missing. KNOWN_UNSAVED_FIELDS lists per-country fields the backend drops (GBR overtime_eligible) and fails once they are saved again, so the entry gets removed when the fix ships. CONTRACT_DETAILS_SEEDS moves to scripts/contract-details-seeds.ts, shared with seed-onboarding. Runs locally with .env.sandbox; CI comes in the next PR. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Oct 8, 2026
Contributor
📦 Bundle Size Report
Size Limits
Largest Files (Top 5)
View All Files (291 total)
✅ Bundle size check passed |
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
Contributor
📊 Coverage Report⚪ Coverage unchanged
Detailed BreakdownLines Coverage
Statements Coverage
Functions Coverage
Branches Coverage
✅ Coverage check passed |
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The canary in this PR now only builds and validates the pinned and latest schemas. The submit check (fill, PATCH, read back) moves to a stacked PR so each one is smaller to review. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…uild-main # Conflicts: # src/flows/Onboarding/utils.ts
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bfd13ee. Configure here.
- Reject unknown --checks values and an empty country list (unknown --country or an empty /v1/countries payload), and exit 1 from decideExitCode when no row passed or failed, so a misconfigured or empty run can no longer report green. - Wrap each live contract_details schema with withJobTitleEligibilityRiskAcknowledgement, matching what the Onboarding flow actually builds. - Trim the seedEmploymentForCountry JSDoc to a caller-facing line. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
jordividaller
approved these changes
Oct 12, 2026
Take main's braced guards in src/common now that #1480 is merged, and apply the curly lint rule to scripts/schema-canary.ts. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
gabrielseco
added a commit
that referenced
this pull request
Oct 12, 2026
Take main's braced parseArgs guard now that #1481 is merged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Merged
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
Adds
npm run schema-canary, a script that checks every EOR country's live contract details form against the sandbox: it builds and validates each schema with our form code.Why
What changed
Toggle details
For every country with
eor_onboarding: truein/v1/countries:employment_idlike the flow does. Archived afterwards, also when a later setup step fails.getContractDetailsStrategy, and validates. Fails the run.json_schema_version=latest. Warning only.Submitting filled values and reading them back comes next, in #1491.
Local only in this PR; CI comes in #1493.
Screenshots
N/A
Related Resources
Testing
Tested against the
example/app in a browser: N/A, this is a script.Feature flag: N/A
Unit tests:
scripts/schema-canary/lib.test.ts.Locally:
npm run schema-canary -- --country=FRA(needs.env.sandbox).🤖 Generated with Claude Code
Note
Low Risk
New dev/ops script and tests only; no runtime library or app behavior changes, though it uses sandbox OAuth credentials when run locally.
Overview
Adds
npm run schema-canary, a sandbox-only CLI that smoke-tests livecontract_detailsJSON schemas for every EOR onboarding country using the same headless form build/validate path as Onboarding.For each country it seeds a sandbox employment (basic info → eligibility → optional engagement), fetches the form with a real
employment_id, runs pinned (library-shipped version) and latest checks viagetContractDetailsStrategy/buildHeadlessForm, then archives the employment. CLI flags support--country,--checks,--concurrency, optional JSON report and failure output, plus GitHub step summary whenGITHUB_STEP_SUMMARYis set.Exit behavior: pinned failures and seed errors fail the run; latest failures are warnings only. An empty
SCHEMA_CANARY_SKIP_LISTand unit tests inscripts/schema-canary/lib.test.tscover reporting and gating logic. CI wiring is out of scope for this PR.Reviewed by Cursor Bugbot for commit b18a1da. Bugbot is set up for automated code reviews on this repo. Configure here.