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)