Skip to content

fix: adcp crash backoff loop#4688

Merged
EmmaLouise2018 merged 1 commit into
mainfrom
EmmaLouise2018/fly-adcp-docs-debug
May 17, 2026
Merged

fix: adcp crash backoff loop#4688
EmmaLouise2018 merged 1 commit into
mainfrom
EmmaLouise2018/fly-adcp-docs-debug

Conversation

@EmmaLouise2018

Copy link
Copy Markdown
Contributor

No description provided.

@EmmaLouise2018

Copy link
Copy Markdown
Contributor Author

Root cause

adcp-docs machines were crash-looping with:

TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module
"file:///app/dist/training-agent/fixtures/verification-walkthrough/northwind-brand.json"
needs an import attribute of "type: json"

Introduced by #4675 — added four bare JSON imports in server/src/training-agent/fixtures/verification-walkthrough/index.ts. Node 22 ESM rejects JSON imports that don't carry with { type: 'json' }. The compiled dist/index.js threw on boot, fly-runner restarted, both web machines hit max restart count (10), no requests could land on a healthy backend.

Why we didn't just add with { type: 'json' }

That was the obvious first attempt. TypeScript rejected it:

TS2823: Import attributes are only supported when the '--module' option is set
to 'esnext', 'node18', 'node20', 'nodenext', or 'preserve'.

server/tsconfig.json is on module: "ES2022". Bumping the module setting fixes the typecheck but has repo-wide blast radius and didn't feel right for a hotfix on a crash loop.

What this PR does

Inlines the four fixture documents as as const object literals in index.ts and deletes the standalone .json files. No filesystem reads at runtime, no import attributes needed, no tsconfig change.

Alternatives considered

  1. Bump tsconfig module to ESNext/NodeNext + add with { type: 'json' } — keeps the .json files but changes module emission for the whole server build. Heavier than warranted for a hotfix.
  2. Convert each .json → sibling .ts (northwind-brand.ts etc., each export default { ... } as const;) — preserves the per-fixture file layout from feat(training-agent): seller-verification walkthrough fixtures #4675 without needing import attributes. Functionally equivalent to the inline approach; trade-off is N files vs. one consolidated file.

Happy to split (2) back out if reviewers prefer keeping the per-fixture layout — let me know.

Verification

  • npm run typecheck clean
  • npx tsc emits dist/training-agent/fixtures/verification-walkthrough/index.js
  • node -e "import(...)" against the compiled module loads cleanly with all named exports and WALKTHROUGH_FIXTURES roles intact
  • Only consumers are server/src/training-agent/index.ts and the walkthrough integration test, both via the WALKTHROUGH_FIXTURES export

@EmmaLouise2018 EmmaLouise2018 force-pushed the EmmaLouise2018/fly-adcp-docs-debug branch from 4141c41 to 34bd7f5 Compare May 17, 2026 21:32
@EmmaLouise2018 EmmaLouise2018 merged commit 0041833 into main May 17, 2026
18 checks passed
@EmmaLouise2018 EmmaLouise2018 deleted the EmmaLouise2018/fly-adcp-docs-debug branch May 17, 2026 21:32
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