Skip to content

feat(scripts): seed contractor employments with seed:onboarding --type=contractor - #1455

Open
gabrielseco wants to merge 3 commits into
refactor/seed-onboarding-fill-schemafrom
feat/seed-contractor-onboarding
Open

gabrielseco wants to merge 3 commits into
refactor/seed-onboarding-fill-schemafrom
feat/seed-contractor-onboarding

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 6, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Lets the dev seed script create a contractor employment with its basic information already filled in, so you can start testing the contractor flow from the next step without typing it in by hand.

Why

npm run seed:onboarding only creates EOR employments. Testing contractor onboarding past basic information meant filling that form by hand every time.

Adding a --type flag to the existing script reuses its auth, API helper and #1423's schema filler and start-date picker, instead of copying them into a second script.

What changed

Toggle details
  • New --type=employee|contractor flag on scripts/seed-onboarding.ts. It defaults to employee, so existing usage doesn't change.
  • --type=contractor fetches contractor_basic_information (default schema version 1, matching getBasicInformationSchemaVersion in ContractorOnboarding/utils.ts) and calls POST /v1/employments with type: 'contractor'. It stops there: no eligibility, engagement agreement or later contractor steps.
  • ir35 (GBR) and nationality_status (SAU, KWT, OMN, QAT, BHR) aren't in the API schema. buildBasicInformationJsfModify adds them client-side, and useUpdateUKandSaudiFields saves them to the contractor contract document after the employment is created. The script does the same with POST /v1/contractors/employments/{id}/contract-documents:
    • GBR: ir_35: 'exempt'. inside/outside would require an SDS file upload.
    • Gulf countries: nationality: 'national', which skips the non-national path.
  • The country list is duplicated from NATIONALITY_COUNTRY_CODES instead of imported, so the script doesn't pull in the flow's TSX.
  • Dev-only script: nothing ships in the npm package, no public API change.

Screenshots

N/A

Related Resources

Testing

  • Tested against the example/ app in a browser: N/A, script only
  • Feature flag: N/A

Ran npm run seed:onboarding -- --country=<X> --type=contractor --env=sandbox, then fetched each employment:

  • DEU: created as contractor, no contract document call.
  • GBR: created, contract_details.ir_35 = "exempt".
  • SAU: created, contract_details.nationality = "national".

Not checked yet: continuing from that partial contract document to contract_details in the UI. The real flow leaves the employment in the same state, so it should work.

🤖 Generated with Claude Code


Note

Low Risk
Dev-only seed script and example demo URL prefilling; no production package or auth changes.

Overview
Adds --type=contractor to npm run seed:onboarding (default stays employee). The contractor path fills contractor_basic_information, creates a contractor employment via POST /v1/employments, and for GBR / Gulf countries seeds the contract document with ir_35: exempt or nationality: national so dev testing can skip basic info and the client-only IR35/nationality fields. Output links use ?demo=contract-onboarding&employmentId=.

The example Contractor Onboarding demo now prefills Employment ID from the employmentId query param (before the env var), matching the seed script links and the employee onboarding demo.

Reviewed by Cursor Bugbot for commit 7640378. Bugbot is set up for automated code reviews on this repo. Configure here.

…e=contractor

Fills contractor_basic_information and creates a contractor employment, the
same as ContractorOnboarding's basic_information step. GBR gets ir_35 and the
Gulf countries get nationality on the contractor contract document, because
those fields are added client-side and saved there, not in basic_information.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

Project:remote-flows
Status: ✅  Deploy successful!
Preview URL:https://remote-flows-bylof5m69-remotecom.vercel.app
Latest Commit:7640378

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for adp-cost-calculator ready!

Project:adp-cost-calculator
Status: ✅  Deploy successful!
Preview URL:https://adp-cost-calculator-6ljz1dpp5-remotecom.vercel.app
Latest Commit:7640378

Deployed with vercel-action

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 6c7701f. Configure here.

Comment thread scripts/seed-onboarding.ts
@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚪ Coverage unchanged

Metric Current Previous Change Status
Lines 86.82% 86.82% 0% ⚪
Statements 86.39% 86.39% 0% ⚪
Functions 85.42% 85.42% 0% ⚪
Branches 78.19% 78.19% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5006 / 5766
  • Coverage: 86.82%
  • Change: 0% (0 lines)
Statements Coverage
  • Covered: 5095 / 5898
  • Coverage: 86.39%
  • Change: 0% (0 statements)
Functions Coverage
  • Covered: 1330 / 1557
  • Coverage: 85.42%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3093 / 3956
  • Coverage: 78.19%
  • Change: 0% (0 branches)

✅ Coverage check passed

gabrielseco and others added 2 commits October 6, 2026 19:05
…ymentId=

Mirrors the employee onboarding demo so the link printed by
seed:onboarding --type=contractor loads the seeded employment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant