📌 Description
Per the README, SIGTERM/SIGINT triggers createShutdownHandler (src/utils/shutdown.ts) to stop accepting new connections, mark /health/ready unready, and force-exit after 10s if not closed. src/utils/shutdown.test.ts exists but it's worth explicitly verifying the drain behavior end-to-end: an in-flight request started just before shutdown should still complete successfully.
🧩 Requirements and context
- Add a test that starts a slow request (mock a delayed handler or use an existing route with an artificial delay hook), triggers shutdown mid-request, and asserts the response still completes with its normal status.
- Assert
/health/ready flips to 503 immediately on shutdown start, before the in-flight request finishes.
- Assert no new request initiated after shutdown begins is accepted (connection refused or immediate rejection).
🛠️ Suggested execution
- Extend
src/utils/shutdown.test.ts (or add src/index.test.ts coverage) using a real HTTP server instance and CloseableServer.
- If a gap is found (e.g. readiness doesn't flip immediately), fix it in
shutdown.ts/utils/readiness.ts.
- Keep the 10s force-exit path covered separately with a fast-forwarded/mocked timer.
✅ Acceptance criteria
🔒 Security notes
No new attack surface; hardens an operational correctness guarantee already documented in the README.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
Per the README,
SIGTERM/SIGINTtriggerscreateShutdownHandler(src/utils/shutdown.ts) to stop accepting new connections, mark/health/readyunready, and force-exit after 10s if not closed.src/utils/shutdown.test.tsexists but it's worth explicitly verifying the drain behavior end-to-end: an in-flight request started just before shutdown should still complete successfully.🧩 Requirements and context
/health/readyflips to503immediately on shutdown start, before the in-flight request finishes.🛠️ Suggested execution
src/utils/shutdown.test.ts(or addsrc/index.test.tscoverage) using a real HTTP server instance andCloseableServer.shutdown.ts/utils/readiness.ts.✅ Acceptance criteria
/health/readyflips to503at shutdown start, not at completion.🔒 Security notes
No new attack surface; hardens an operational correctness guarantee already documented in the README.
📋 Guidelines