docfast session 136: fix timer leaks in browser.ts + test cleanup

This commit is contained in:
Hoid 2026-03-06 17:08:47 +01:00
parent 9f484a15cb
commit 2430b37fe2
3 changed files with 56 additions and 89 deletions

View file

@ -1,5 +1,20 @@
# Session Log
## Session 136 — 2026-03-06 16:00 UTC (Friday Late Afternoon)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts, ~8d uptime
- **Staging:** v0.5.2 ✅ commit 4473641 (45+ commits ahead of prod)
- **K8s cluster:** All 3 nodes Ready
- **Support:** Zero tickets
- **Completed:**
1. **Timer leak fix in browser.ts (TDD)** — Production code: `renderPdf` and `renderUrlPdf` used `Promise.race` with a `setTimeout` for PDF_TIMEOUT that was never cleared on success. Every successful PDF render leaked a 30-second timer. Fixed by adding `.finally(() => clearTimeout(timeoutId))`. New TDD test verifies `vi.getTimerCount() === 0` after successful render.
2. **Test unhandled rejection fix** — Browser-pool tests had 6 unhandled errors from hanging promises in PDF_TIMEOUT and QUEUE_FULL tests. Fixed by: (a) catching hanging `renderPdf` promises with `.catch(() => {})`, (b) using `.catch((e) => e)` pattern instead of `rejects.toThrow()` to ensure rejections are handled before `advanceTimersByTimeAsync` fires them.
3. **Infrastructure health check** — All 3 K8s nodes Ready, both prod replicas healthy (0 restarts, ~8d uptime), DB connected (PostgreSQL 17.4), browser pool 15/15.
- **Total tests:** 516 (all passing, 0 unhandled errors), 36 test files
- **Open bugs:** ZERO 🎉
- **CI runner:** Still absent. Managed by Cloonar — needs investor action.
- **Investor test:** All 5 checks pass ✅
- **Recommendation:** Staging v0.5.2 production-ready with clean test suite. Awaiting investor approval for production tag.
## Session 135 — 2026-03-06 13:00 UTC (Friday Afternoon)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts, ~9.3d uptime
- **Staging:** v0.5.2 ✅ commit 0283e9d (44+ commits ahead of prod)

View file

@ -3,7 +3,7 @@
"phaseLabel": "Build Production-Grade Product",
"status": "launch-ready",
"product": "DocFast — HTML/Markdown to PDF API",
"currentPriority": "Production on v0.5.1. Staging v0.5.2 (44+ commits ahead). npm audit 0 vulns. 515 tests passing (36 files). ZERO open bugs. Added PDF render timing observability (X-Render-Time header). Ready for production tag when investor approves.",
"currentPriority": "Production on v0.5.1. Staging v0.5.2 (45+ commits ahead). npm audit 0 vulns. 516 tests passing (36 files). ZERO open bugs. ZERO unhandled test errors (fixed timer leaks). Ready for production tag when investor approves.",
"ownerDirectives_PRIORITY": "Process these IN ORDER. Do not skip. Remove items marked ✅ DONE/FIXED during housekeeping.",
"ownerDirectives": [
"Stripe Product ID for DocFast: prod_TygeG8tQPtEAdE — webhook handler must filter by this product_id to ignore events from other projects on the same Stripe account."
@ -83,7 +83,7 @@
"LOW": [],
"note": "All bugs resolved. BUG-105 fixed 4f6659c. BUG-104 fixed 503e651. BUG-103 (template validation bypass) fixed 47571c8. BUG-102 (sanitized options ignored) fixed ba2e542. BUG-101 (body limits) fixed c03f217. BUG-100 (flush poisoning) fixed d2f819d. BUG-099 (memory leak) fixed 5f776db. BUG-098 (interceptor leak) fixed 024fa00."
},
"sessionCount": 135
"sessionCount": 136
},
"blockers": [],
"startDate": "2026-02-14"