Skip to content

chore(scripts): support --env in dump:schema - #1570

Merged
gabrielseco merged 7 commits into
mainfrom
chore/dump-schema-env
Oct 15, 2026
Merged

gabrielseco merged 7 commits into
mainfrom
chore/dump-schema-env

Conversation

@gabrielseco

@gabrielseco gabrielseco commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

npm run dump:schema can now dump a schema from any environment (local, sandbox, staging, partners), not only sandbox.

Why

The script was hardwired to .env.sandbox, so there was no quick way to check what a local backend returns for a schema. seed:onboarding already takes --env; this makes the two scripts behave the same way.

What changed

Toggle details
  • scripts/dump-schema.ts: new --env=<name> flag (default sandbox, so existing usage is unchanged). It loads .env.<name> and takes the gateway and token flow from example/api/utils.js and example/api/get_token.js, the same helpers seed:onboarding --env uses. This includes the local JWT fallback, so --env=local works without a refresh token.
  • scripts/schema-canary/auth.ts: adds createEnvClient. createSandboxClient is untouched, so schema-canary is unaffected.
  • Not public API; dev scripts only.
  • Known limitation: the script archives the seeded employment through the sandbox-only delete endpoint. On other envs that fails and logs a warning instead of erroring.

Screenshots

N/A

Related Resources

N/A

Testing

npm run dump:schema -- --country=GBR --env=local --version=7

Verified against a local backend: v6 has no wage_type / daily_schedule, v7 has both. Only --env=local was run; the other envs share the same code path.

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

🤖 Generated with Claude Code


Note

Low Risk
Dev-only script changes with no production API or auth surface; default behavior remains sandbox.

Overview
dump:schema now accepts --env=<name> (default sandbox), loading .env.<name> and failing fast if that file is missing. Instead of sandbox-only refresh-token env vars, it resolves the gateway via buildGatewayURL() and mints tokens through the same example/api/get_token.js path as seed:onboarding --env, including local JWT fallback for --env=local.

createEnvClient in schema-canary/auth.ts wires an arbitrary gateway URL and token fetcher into the existing createClient helper; createSandboxClient is unchanged and still powers schema-canary.

seed:onboarding gets aligned env-file handling: verify .env.<env> exists, use dotenv with override: true, and a clearer error when VITE_REMOTE_GATEWAY is unset.

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

dump:schema was hardwired to .env.sandbox and the sandbox gateway. Accept
--env=<name> like seed:onboarding does, loading .env.<name> and taking the
gateway and token flow from the example api helpers (including the local
JWT fallback). Defaults to sandbox, so existing usage is unchanged.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 14, 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-pkblnd272-remotecom.vercel.app
Latest Commit:a85fa5a

Deployed with vercel-action

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Deploy preview for remote-flows ready!

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

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.

Stale Bugbot comment from a previous run.

Comment thread scripts/dump-schema.ts Resolved
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage Report

⚠️ Coverage decreased

Metric Current Previous Change Status
Lines 89.58% 89.59% -0.02% 🔴
Statements 89.45% 89.47% -0.02% 🔴
Functions 88.48% 88.48% 0% ⚪
Branches 81.24% 81.24% 0% ⚪

Detailed Breakdown

Lines Coverage
  • Covered: 5396 / 6024
  • Coverage: 89.58%
  • Change: -0.02% (-1 lines)
Statements Coverage
  • Covered: 5461 / 6105
  • Coverage: 89.45%
  • Change: -0.02% (-1 statements)
Functions Coverage
  • Covered: 1428 / 1614
  • Coverage: 88.48%
  • Change: 0% (0 functions)
Branches Coverage
  • Covered: 3351 / 4125
  • Coverage: 81.24%
  • Change: 0% (0 branches)

✅ Coverage check passed

@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.

There are 2 total unresolved issues (including 1 from previous review).

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 4fa0aa5. Configure here.

Comment thread scripts/schema-canary/auth.ts Resolved
gabrielseco and others added 4 commits October 14, 2026 18:53
dotenv.config silently ignores a missing file, so dump-schema and
seed:onboarding fell back to whatever gateway/credentials were already in
the shell. Throw instead so --env=<name> never targets an unintended
environment.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
dotenv.config doesn't override variables already set in the shell, so a
stray VITE_REMOTE_GATEWAY or credentials could point dump-schema and
seed:onboarding at a different environment than the --env file names.
Also drop the now-unreachable 'file is missing' wording from the gateway
error.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@gabrielseco
gabrielseco merged commit eb587a8 into main Oct 15, 2026
14 checks passed
@gabrielseco
gabrielseco deleted the chore/dump-schema-env branch October 15, 2026 13:42
@gabrielseco gabrielseco mentioned this pull request Oct 16, 2026
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.

2 participants