Skip to content

fix: CHAIN_ID in .env was silently ignored — honor it in all three scripts - #4

Merged
anil-rome merged 1 commit into
mainfrom
fix-chain-id-env
Jul 23, 2026
Merged

fix: CHAIN_ID in .env was silently ignored — honor it in all three scripts#4
anil-rome merged 1 commit into
mainfrom
fix-chain-id-env

Conversation

@anil-rome

Copy link
Copy Markdown
Contributor

.env.example documents CHAIN_ID as the chain selector, but gen-config.ts, deploy.ts, and demo.ts all called loadConfig() without passing it — every scaffold silently targeted the default chain (200010) no matter what .env said. Deploys/demos aimed at another chain went to the wrong one.

(Found by rome new's works-gate: it pre-wires CHAIN_ID=121214 (martius) and asserts gen-config resolves it — the live red run resolved 200010.)

Fix: the three scripts pass chainId: Number(process.env.CHAIN_ID) through. Deliberately not made lib-level: lib/config.ts's documented contract is environment-agnostic (scripts own process.env).

Regression gate: new template-config CI job — npm ci in template, CHAIN_ID=121214 npm run gen-config | grep "chain 121214", + template typecheck.

Evidence: live red→green in a scaffolded app (same .env, chain 200010chain 121214); scaffolder suite 2/2 unaffected.

.env.example documents CHAIN_ID as the chain selector, but none of the
three scripts passed it to loadConfig — every scaffold silently targeted
the default chain regardless of .env. The scripts (the env boundary per
lib/config's environment-agnostic contract) now pass it through. CI gains
a template-config job pinning the contract: CHAIN_ID=121214 gen-config
must resolve chain 121214 (+ template typecheck).
@anil-rome anil-rome self-assigned this Jul 23, 2026
@anil-rome
anil-rome merged commit 2b55780 into main Jul 23, 2026
6 checks passed
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