Second hidden-dependency crash from the cherry-picked COPY list. First was _proxy-utils.cjs (fixed post-merge on PR #3041). Now backtest-resilience-outcomes.mjs imports _country-resolver.mjs from PR #3052 and the validation cron crashed in prod with ERR_MODULE_NOT_FOUND.
The explicit file list was meant to keep the image small, but every new local import since has required a matching Dockerfile edit that nobody remembers until the cron crashes. Copy the whole scripts/ tree instead — ~2 MB larger, robust to any future import.
Two bugs compounded to crash the validation bundle since creation:
1. tsx resolution ambiguity: installing root devDeps + scripts deps put
tsx at both /app/node_modules and /app/scripts/node_modules. Node 22
picked the wrong one for --import tsx/esm — reproducible with an
incomplete dist/ in one of the two installs.
2. tsx/esm triggers ERR_REQUIRE_CYCLE_MODULE on Node 22 when the loaded
.ts graph has its own imports. tsx's esm-only loader uses require()
internally and Node 22's stricter require-of-esm cycle detection
rejects it. Reproduced locally with node-v22.22.2.
Fix: install only tsx at /app/node_modules (single-package npm install,
no package.json), use absolute path to tsx's default loader
(dist/loader.mjs, not dist/esm/index.mjs), and ship only the scripts
the bundle actually touches — including _proxy-utils.cjs which
_seed-utils.mjs top-level-requires.
Verified end-to-end against Node 22.22.2: all three validation scripts
(External-Benchmark, Outcome-Backtest, Sensitivity-Suite) run to
completion with no module or cycle errors.
Railway auto-detects root Dockerfile even with builder=NIXPACKS, which
builds the nginx/vite app stripped of scripts/ and server/ — causing
ERR_MODULE_NOT_FOUND for tsx and dimension-scorers at runtime.
Dockerfile.seed-bundle-resilience-validation installs tsx at /app/node_modules
(via NODE_ENV=development to keep devDeps) and copies scripts/ + server/ +
shared/ + data/ so dynamic ../server/*.ts imports resolve.
Railway service dockerfilePath updated to this file.