Repository navigation
refactor(scripts): extract seed-onboarding's schema filler and pick holiday-free start dates - #1423
Open
gabrielseco wants to merge 5 commits into
Open
gabrielseco wants to merge 5 commits into
gabrielseco wants to merge 5 commits into
Conversation
…oliday-free start dates Moves fillSchema/fakeValueFor/preferNoOption out of seed-onboarding.ts into scripts/fill-schema.ts so the upcoming schema canary (#1382) can reuse them. Along the way, seeded employments get: - a provisional_start_date at least 35 days out that skips the country's public holidays (fetched from /v1/countries/{country}/holidays/{year}), since 21 days wasn't enough lead time for some countries (e.g. Iceland) and fixed offsets regularly landed on local holidays - job_title "Software Engineer" instead of lorem words, which some countries' job title eligibility checks reject Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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 |
…holiday lookups Tiger blocks some start weekdays per country (ISL: Friday/Saturday, much of LATAM: Saturday/Sunday) and the public API doesn't expose that table, so pickSafeDate now only returns a Monday-Thursday date. A failed holidays lookup for one year no longer throws away the years that did load; it logs a warning and skips just that year. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ay years The extraction swapped SeedField/FieldOption for $TSFixMe and dropped an optional chain on tel option meta. safeStartDateYears now reads the UTC year so it matches the UTC ISO dates pickSafeDate compares against. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
"Software Engineer" was added on the assumption that job title eligibility checks reject lorem titles, but the failures that prompted it had a different cause. Seeding PRT, ISL, DEU, BRA, GBR, USA, FRA, ESP, NLD, IND, MEX and JPN in sandbox with lorem job titles all succeed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ 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 12dcd3c. Configure here.
2 tasks
This branch has not been deployed
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
Makes the onboarding seed script create employments that the API accepts more reliably, and moves its form-filling logic into a shared module so the schema canary can reuse it.
Why
npm run seed:onboardingregularly failed for some countries. The start date it picked (21 days out) could land on a local public holiday, or fall short of a country's minimum notice (Iceland needs about 20 working days).The schema canary in #1382 needs the same form-filling logic. Splitting it out here keeps #1382 focused on the canary itself and easier to review.
What changed
Toggle details
scripts/fill-schema.tswithfillSchema,fakeValueForandpreferNoOption, moved out ofseed-onboarding.tsunchanged except for the points below.pickSafeDate/safeStartDateYears: the start date is now the earliest Monday to Thursday at least 35 days out that isn't a public holiday, checked against a 60-day window.seed-onboarding.tsfetches/v1/countries/{country}/holidays/{year}and passes that date in asprovisional_start_date. If one year's holiday lookup fails, that year is skipped with a warning and the years that did load are still used.check_latam_provisional_start_date_before_payroll_runflag. The flag looks off in sandbox (every LATAM country seeds today), so this isn't handled yet.Screenshots
N/A
Related Resources
scripts/fill-schema.ts)Testing
example/app in a browser: N/A, script onlyExercised through #1382's schema canary CI runs, which seed a real sandbox employment for every EOR country with this code (latest run: 91/92 seeded; ISL failed because its date landed on a Friday, which this PR now avoids).
Manual runs of
npm run seed:onboarding -- --country=<X> --env=sandbox:job_titlestays lorem words: PRT, ISL, DEU, BRA, GBR, USA, FRA, ESP, NLD, IND, MEX, JPN all seeded with lorem job titles, so no eligibility-specific title is needed.cannot be set to a Friday; this PR sends Mon 2026-11-09 and seeds.cannot be in a holiday; this PR logs a warning, keeps the 2026 holidays, sends 2026-12-28 and seeds.🤖 Generated with Claude Code
Note
Low Risk
Changes are limited to dev seed scripts; they improve reliability of test data creation without touching production app code or public APIs.
Overview
Extracts onboarding schema auto-fill (
fillSchema,fakeValueFor,preferNoOption) into sharedscripts/fill-schema.tsso dev seeding and the upcoming schema canary can reuse the same logic.seed-onboardingnow picksprovisional_start_dateviafindSafeStartDate: it loads country holidays from the API, thenpickSafeDatechooses the earliest Mon–Thu date at least 35 days out that is not a holiday (60-day search window). Generic date filler offsets move from 21 to 35 days. Failed holiday fetches for a year are warned and skipped without discarding other years.Risk: Low — dev-only scripts; no product API or package surface change.
Reviewed by Cursor Bugbot for commit 75f68e7. Bugbot is set up for automated code reviews on this repo. Configure here.