Files
worldmonitor/scripts/seed-bundle-resilience-validation.mjs
Elie Habib 8cc8781b19 fix(resilience): unbreak validation cron — Node 22 tsx loader path (#3041)
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.
2026-04-13 08:05:59 +04:00

757 B