📋 Description
Shutdown ordering lives in shutdown.ts and is wired from bootstrap.ts. Exports run as longer-lived jobs via exportService.ts. There is no test proving that on SIGTERM the shutdown sequence waits for in-flight export jobs to finish (or checkpoint) before closing the DB and exiting.
Why this matters: killing the process mid-export corrupts or loses the artifact. A drain test pins the contract that shutdown waits for in-flight work, preventing a regression that reorders teardown.
🎯 Requirements & Context
Context & constraints
- TypeScript, jest. Mock the export job's completion signal; do not perform real file I/O.
🛠️ Suggested Execution
git checkout -b test/shutdown-export-drain
npm --prefix backend test -- shutdown
- Edge cases: no in-flight jobs (immediate teardown); job finishes just before timeout; job exceeds timeout (forced); multiple concurrent exports.
Example commit message
test(backend): assert shutdown drains in-flight exports before DB close
Pins the teardown ordering and the bounded drain-timeout fallback.
✅ Acceptance Criteria & Guidelines
| Requirement |
Target |
| Drain-before-close asserted |
Required |
| Bounded timeout fallback covered |
Required |
| Coverage of shutdown sequence |
≥ 95% |
| jest + lint clean |
Required |
| Timeframe |
96 hours from assignment |
💬 Community & Support
Join Discord: https://discord.gg/VpngvTjWa — comment to claim. 🚀
📋 Description
Shutdown ordering lives in
shutdown.tsand is wired frombootstrap.ts. Exports run as longer-lived jobs viaexportService.ts. There is no test proving that on SIGTERM the shutdown sequence waits for in-flight export jobs to finish (or checkpoint) before closing the DB and exiting.🎯 Requirements & Context
Context & constraints
🛠️ Suggested Execution
git checkout -b test/shutdown-export-drain npm --prefix backend test -- shutdownExample commit message
✅ Acceptance Criteria & Guidelines
💬 Community & Support
Join Discord: https://discord.gg/VpngvTjWa — comment to claim. 🚀