Repository navigation
chore(scripts): support --env in dump:schema - #1570
Merged
Merged
Conversation
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>
Contributor
|
Deploy preview for adp-cost-calculator ready!
Deployed with vercel-action |
Contributor
|
Deploy preview for remote-flows ready!
Deployed with vercel-action |
1 of 2 tasks
1 of 2 tasks
Contributor
📊 Coverage Report
|
| 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
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ 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.
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>
jordividaller
approved these changes
Oct 15, 2026
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
npm run dump:schemacan 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:onboardingalready takes--env; this makes the two scripts behave the same way.What changed
Toggle details
scripts/dump-schema.ts: new--env=<name>flag (defaultsandbox, so existing usage is unchanged). It loads.env.<name>and takes the gateway and token flow fromexample/api/utils.jsandexample/api/get_token.js, the same helpersseed:onboarding --envuses. This includes the local JWT fallback, so--env=localworks without a refresh token.scripts/schema-canary/auth.ts: addscreateEnvClient.createSandboxClientis untouched, soschema-canaryis unaffected.Screenshots
N/A
Related Resources
N/A
Testing
Verified against a local backend: v6 has no
wage_type/daily_schedule, v7 has both. Only--env=localwas run; the other envs share the same code path.example/app in a browser (N/A, scripts only)🤖 Generated with Claude Code
Note
Low Risk
Dev-only script changes with no production API or auth surface; default behavior remains sandbox.
Overview
dump:schemanow accepts--env=<name>(defaultsandbox), loading.env.<name>and failing fast if that file is missing. Instead of sandbox-only refresh-token env vars, it resolves the gateway viabuildGatewayURL()and mints tokens through the sameexample/api/get_token.jspath asseed:onboarding --env, including local JWT fallback for--env=local.createEnvClientinschema-canary/auth.tswires an arbitrary gateway URL and token fetcher into the existingcreateClienthelper;createSandboxClientis unchanged and still powersschema-canary.seed:onboardinggets aligned env-file handling: verify.env.<env>exists, usedotenvwithoverride: true, and a clearer error whenVITE_REMOTE_GATEWAYis unset.Reviewed by Cursor Bugbot for commit a85fa5a. Bugbot is set up for automated code reviews on this repo. Configure here.