fix(tools): inline dotenv.parse in generate-config — kill canary CI breakage from layout sweep - #1562
Merged
Merged
Conversation
…reakage from layout sweep The layout sweep (PR #1557, task #214) moved `generate-config.ts` from `src/generator/` to `tools/generator/`. Node's module resolution walks ancestors of the SCRIPT location, not `process.cwd()`, so the `import * as dotenv from 'dotenv'` at the top now traverses `tools/generator/` -> `tools/` -> `/` looking for `node_modules/dotenv` and finds nothing — `dotenv` only exists at `src/node_modules/dotenv` (a SIBLING of `tools/`, not an ancestor). Every TS-validation CI job that invokes `npx tsx ../tools/generator/generate-config.ts` has been failing on canary since the layout sweep merged: Error: Cannot find module 'dotenv' Require stack: - /home/runner/work/continuum/continuum/tools/generator/generate-config.ts Surfaced via PR #1561's validate / ts-eslint-baseline-ratchet / verify-architectures / verify-after-rebuild checks. NOT caused by that PR's diff — pre-existing canary infra regression that has been silently breaking every TS PR check since the layout sweep landed. Fix: replace `dotenv.parse()` with a 15-line inline `parseEnvText`. The script only ever called `.parse()` (the pure string-to-KV transform), never the `.config()` side-effect path that mutates process.env. Inline parser handles the same shape (KEY=value, optional surrounding quotes, # comments, blank lines). Like-for-like behavioral replacement at zero dep cost. Doctrinal bonus: generator scripts now have a node-stdlib-only footprint, matching `generate-version.ts`'s shape. No upward-walk module-resolution surprises possible. Aligns with task #209 ("npm start IS the headless Rust binary, period") — fewer Node deps in the build path is unambiguously good. Verified locally: cd src && npx tsx ../tools/generator/generate-config.ts -> "shared/config.ts unchanged" (idempotent on re-run) -> HTTP_PORT/WS_PORT defaults pick up correctly -> ACTIVE_EXAMPLE resolved from main package.json Net diff: -1 import + 6 lines removed, +33 lines added (parseEnvText + doc block explaining WHY this exists). No behavior change on the happy path. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
What
Replace
import * as dotenv from 'dotenv'intools/generator/generate-config.tswith an inline 15-lineparseEnvTextfunction. Removes the dotenv dep entirely from this script.Why
The layout sweep (PR #1557, task #214) moved
generate-config.tsfromsrc/generator/totools/generator/. Node's module resolution walks ancestors of the script location, notprocess.cwd(). Fromtools/generator/, the upward walk goestools/generator/->tools/->/and finds nonode_modules/dotenv— that module only lives atsrc/node_modules/dotenv(a sibling oftools/, not an ancestor).Every TS-validation CI job has been failing on canary since the layout sweep merged:
Surfaced via PR #1561's failing checks (validate / ts-eslint-baseline-ratchet / verify-architectures / verify-after-rebuild). NOT caused by that PR — pre-existing canary infrastructure regression.
How
dotenvwas only ever used for its.parse(text)function (pure string-to-KV transform). Inlined asparseEnvTextwith the same semantics:KEY=valuelines#comments + blank lines ignoredThe
.config()side-effect path (which mutatesprocess.env) was never used here. Like-for-like behavioral replacement.Doctrinal bonus
Generator scripts now have a Node-stdlib-only footprint, matching
generate-version.ts's shape. No upward-walk module-resolution surprises possible. Aligns with task #209 (Node deps trimming).Test plan
cd src && npx tsx ../tools/generator/generate-config.ts-> "shared/config.ts unchanged" (idempotent re-run), ports + active_example resolved correctlyGenerated with Claude Code