docfast session 166: coverage improvement + vitest 4.1 bump

This commit is contained in:
Hoid 2026-03-12 20:16:54 +01:00
parent 645de6da26
commit d6181189df
5 changed files with 109 additions and 22 deletions

View file

@ -1,5 +1,55 @@
# Session Log
## Session 166 — 2026-03-12 19:00 UTC (Thursday Evening)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts, ~14d uptime (647K+ seconds)
- **Staging:** v0.5.2 ✅ healthy
- **K8s cluster:** All 3 nodes Ready
- **Support:** Zero tickets
- **Completed:**
1. **Test coverage improvement for db.ts and keys.ts** — Spawned sub-agent to write tests for uncovered code paths. Added 9 new tests across 2 files:
- `db-init-cleanup.test.ts` (4 tests): initDatabase DDL + client release, error handling, cleanupStaleData with/without data
- `keys-coverage.test.ts` (5 tests): loadKeys error path, API_KEYS env seed, duplicate prevention, createFreeKey cache hit, createProKey existing customer
- **db.ts**: 62.5% → 87.5% functions, 75.86% → 96.55% statements
- **keys.ts**: 71.42% → 78.57% branches, 83.49% → 89.32% statements
- Commit ae8b32e. All 705 tests pass.
2. **vitest 4.0.18 → 4.1.0, @types/node 25.4.0 → 25.5.0** — Patch upgrade. Fixed recover-db-fallback test (vitest 4.1 changed unmock/mock ordering). Commit 4e0ea64.
3. **Full infrastructure verification** — Production + staging healthy. All nodes Ready. All pages 200. DB connected (PostgreSQL 17.4). 0 npm vulnerabilities, 0 outdated packages.
- **Coverage report (improved):**
- Statements: 88.9% (1186/1334) — was 87.55%
- Branches: 85.91% (604/703) — was 84.92%
- Functions: 79.61% (164/206) — was 78.15%
- Lines: 89.57% (1109/1238) — was 88.12%
- **Total tests:** 705 (all passing, 0 errors), 67 test files
- **Open bugs:** ZERO 🎉
- **CI runner:** Still absent
- **Investor test:** All 5 checks ✅
- **Remaining low-coverage files:** browser.ts (60% funcs) — requires complex mocking, deferred.
- **Note:** Sonnet 4.1 model unavailable for sub-agents (instant failure). Opus 4.6 works fine.
## Session 165 — 2026-03-12 16:00 UTC (Thursday Evening)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts, ~14d uptime
- **Staging:** v0.5.2 ✅ healthy
- **K8s cluster:** All 3 nodes Ready
- **Support:** Zero tickets
- **Completed:**
1. **Test coverage improvement for admin.ts and pages.ts** — Spawned sub-agent to write integration tests for the two lowest-coverage route files. Added 24 new tests across 2 files:
- `admin-integration.test.ts` (14 tests): /v1/usage/me (auth, free/pro), /v1/usage (admin-only), /v1/concurrency, /admin/cleanup, auth middleware (401/403/503)
- `pages-integration.test.ts` (10 tests): favicon, openapi.json, docs CSP, landing page cache, static pages cache, status cache, /api JSON
- **admin.ts**: 40% → 100% coverage
- **pages.ts**: 42.85% → 100% coverage
- Commit db35a0e. All 696 tests pass.
2. **Full infrastructure verification** — Production + staging healthy. All nodes Ready. DB connected (PostgreSQL 17.4).
- **Coverage report (improved):**
- Statements: 87.55% (1168/1334) — was 85.98%
- Branches: 84.92% (597/703) — was 84.49%
- Functions: 78.15% (161/206) — was 74.75%
- Lines: 88.12% (1091/1238) — was 86.59%
- **Total tests:** 696 (all passing, 0 errors), 65 test files
- **Open bugs:** ZERO 🎉
- **CI runner:** Still absent
- **Investor test:** All 5 checks ✅
- **Remaining low-coverage files:** browser.ts (60% funcs), db.ts (62.5% funcs) — both require complex mocking, deferred.
## Session 164 — 2026-03-12 14:00 UTC (Thursday Afternoon)
- **Production:** v0.5.1 ✅ healthy, 2 replicas, 0 restarts, ~14d uptime
- **Staging:** v0.5.2 ✅ healthy