From 1dfc0c9b984152f6518060712ab050311f3f77c9 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Aug 2026 15:10:28 +0000 Subject: [PATCH 1/2] test(coverage): re-ratchet domain coverage floors past their 5pp drift trigger (ledger #192) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ledger #192 (maturity X6) asked for higher, CI-enforced coverage floors on the clinical-safety/retrieval/answer surfaces. That was already substantially in place: vitest.config.mts already carries four per-domain threshold groups plus a whole-repo floor, all enforced by the required CI "coverage" job. Re-measured with `npm run test:coverage` (606 files, 6549 tests passed, all current thresholds green — no false failure). Two branch thresholds had drifted past this file's own documented 5pp re-ratchet trigger, so those two were raised (never lowered): evidence/verification branches 81 -> 84 (measured 86.04%, gap 5.04pp) and core RAG/answer branches 72 -> 76 (measured 78.22%, gap 6.22pp). Every other value already sat within the 5pp band and is unchanged. No file in the four domain groups showed a genuine untested critical path (lowest: 76.4% statements, 57.7% branches), so no tests were added — only the floors were re-measured and tightened where real. Marks maturity-backlog-workorders.md X6 DONE with the evidence trail. --- docs/maturity-backlog-workorders.md | 36 +++++++++++++++++++++++------ vitest.config.mts | 19 +++++++++++++-- 2 files changed, 46 insertions(+), 9 deletions(-) diff --git a/docs/maturity-backlog-workorders.md b/docs/maturity-backlog-workorders.md index 4033b0bbd1..251f085a7f 100644 --- a/docs/maturity-backlog-workorders.md +++ b/docs/maturity-backlog-workorders.md @@ -158,15 +158,37 @@ structural change, not a single mixed PR. - **Verification:** `npm run check:drift` + the CI `db-reset-verify` replay; **live-DB work is confirmation-required** per the AGENTS.md provider boundary. -### X6 · Raise coverage floors for clinical domains — `OPEN` +### X6 · Raise coverage floors for clinical domains — `DONE` - **Outcome:** higher targeted thresholds where correctness matters most (clinical-safety, retrieval, answer) than the current global 38–50%. -- **Approach:** add per-path coverage thresholds in `vitest.config.mts`; add the targeted tests - needed to clear them (ratchet up, don't drop the bar retroactively). -- **Files:** `vitest.config.mts` (+ new `tests/*` specs). -- **Risk:** MEDIUM — needs real tests, not just a threshold bump. -- **Verification:** `npm run test:coverage` meets the new per-path floors. +- **Landed (ledger #192, 2026-08-14):** `vitest.config.mts` already carried four per-domain + coverage-threshold groups — retrieval (`clinical-search`, `retrieval-selection`, + `answer-ranking`, `clinical-value-binding`, `medication-entities`, + `rag-candidate-sources`, `rag-context-selection`, `rag-retrieval-variants`, + `rag-routing`), evidence/verification (`answer-verification`, `evidence`, + `evidence-relevance`, `rag-claim-support`, `rag-evidence-gates`, + `rag-quote-verification`, `rag-source-segmentation`), core RAG/answer (`rag`, + `rag-extractive-answer`, `rag-comparison`, `rag-answer-support`), and + clinical-safety/governance (`clinical-safety`, `source-governance`, `source-review`, + `clinical-review-queue`, `answer-response`) — plus a whole-repository floor, all + CI-enforced by the required `coverage` job (`npm run test:coverage`) on every PR that + touches executable scope. This closed out most of X6 before this ledger item was + worked; re-measuring on 2026-08-14 confirmed the floors were honest (no false + failure) and found two branch thresholds that had drifted past this file's own + documented 5pp re-ratchet trigger, so those two were raised (never lowered) to + restore headroom: evidence/verification branches 81 → 84 (measured 86.04%, gap was + 5.04pp) and core RAG/answer branches 72 → 76 (measured 78.22%, gap was 6.22pp). No + other value in this file needed a change — every other floor already sat within the + 5pp band. No file in the four domain groups showed a genuine untested critical path: + the per-file low points were 76.4% statements (`rag-quote-verification.ts`) and 57.7% + branches (`rag-answer-support.ts`), well clear of the "under 30%" bar this ledger item + treats as scary, so no padding tests were added, per the ledger's own stop condition. +- **Files:** `vitest.config.mts`, `docs/maturity-backlog-workorders.md`. +- **Risk:** MEDIUM — needs real tests, not just a threshold bump. (No new tests were + needed this pass; the floors were already backed by real, passing coverage.) +- **Verification:** `npm run test:coverage` — 606 files / 6549 tests passed, all + thresholds green, both before and after the two branch-floor raises. ### X7 · Complete the `src/lib` domain-directory reorg — `OPEN` @@ -291,7 +313,7 @@ collaborators join — `AGENTS.md` + the PR template already carry that load. | X3 Monolith decomposition | Next | IN PROGRESS (DocumentViewer #1025 + Dashboard #1034/#1042/#1047 done; rag.ts open) | | X4 SAST-blocking on parser | Next | **DONE** (gate + policy check) | | X5 ACL-migration consolidation | Next | PROVIDER-GATED (DB owner) | -| X6 Coverage floors | Next | OPEN | +| X6 Coverage floors | Next | **DONE** (ledger #192) | | X7 `src/lib` domain reorg (rest) | Next | OPEN (follow-on to X2; needs RAG flag on answer/retrieval clusters) | | L1 Archive one-shot scripts | Later | IN PROGRESS (#1033 archived m13/july8; refs reconciled; backfills open) | | L2 Action-SHA uniformity | Later | **DONE** (#992) | diff --git a/vitest.config.mts b/vitest.config.mts index 1eae3841de..774e77bfcd 100644 --- a/vitest.config.mts +++ b/vitest.config.mts @@ -50,8 +50,18 @@ const config = { // Aggregate behavioral floors ratchet the full post-fixture group rather // than making individual large RAG modules brittle. Each value is the // greater of the measured whole-group floor or the broad floor + 5pp. + // Ledger #192 (maturity X6, 2026-08-14): re-measured against + // `npm run test:coverage` on this exact file set. Group B branches (81) + // and Group C branches (72) had drifted >5pp below measured — the same + // re-ratchet trigger documented above for the whole-repo floor — so + // those two values were raised to sit ~2pp under the fresh measurement. + // Every other value here already sat within that 5pp band and is + // unchanged: raising a floor that already tracks its baseline closely + // would risk a false failure from ordinary day-to-day branch-count + // variance, not close a real gap. "src/lib/{clinical-search,retrieval-selection,answer-ranking,clinical-value-binding,medication-entities,rag/rag-candidate-sources,rag/rag-context-selection,rag/rag-retrieval-variants,rag/rag-routing}.ts": { + // Measured 2026-08-14: 90.32/81.02/92.86/93.88 (stmt/branch/func/line). statements: 86, branches: 78, functions: 88, @@ -59,18 +69,23 @@ const config = { }, "src/lib/{answer-verification,evidence,evidence-relevance,rag/rag-claim-support,rag/rag-evidence-gates,rag/rag-quote-verification,rag/rag-source-segmentation}.ts": { + // Measured 2026-08-14: 93.89/86.04/95.24/96.44. Branches raised + // 81 -> 84 (gap was 5.04pp, just past the 5pp trigger). statements: 92, - branches: 81, + branches: 84, functions: 94, lines: 94, }, "src/lib/rag/{rag,rag-extractive-answer,rag-comparison,rag-answer-support}.ts": { + // Measured 2026-08-14: 87.55/78.22/92.57/91.84. Branches raised + // 72 -> 76 (gap was 6.22pp, the largest in this file). statements: 83, - branches: 72, + branches: 76, functions: 90, lines: 88, }, "src/lib/{clinical-safety,source-governance,source-review,clinical-review-queue,answer-response}.ts": { + // Measured 2026-08-14: 96.72/85.11/98.73/98.95. statements: 94, branches: 83, functions: 96, From 7821558e80ef37e82ee8adb4cafc72ef17eb6318 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 14 Aug 2026 15:12:31 +0000 Subject: [PATCH 2/2] docs(ledger): record PR #1964 review (ledger #192 / maturity X6) Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01QLbw9qpfjv5CeNz6XpmteN --- ...fa8f81b78f3ec3e137053c64dbd30e5af948b0b041bd6ba537b.record.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/branch-review-records/023564085ea84fa8f81b78f3ec3e137053c64dbd30e5af948b0b041bd6ba537b.record.md diff --git a/docs/branch-review-records/023564085ea84fa8f81b78f3ec3e137053c64dbd30e5af948b0b041bd6ba537b.record.md b/docs/branch-review-records/023564085ea84fa8f81b78f3ec3e137053c64dbd30e5af948b0b041bd6ba537b.record.md new file mode 100644 index 0000000000..0343aa24eb --- /dev/null +++ b/docs/branch-review-records/023564085ea84fa8f81b78f3ec3e137053c64dbd30e5af948b0b041bd6ba537b.record.md @@ -0,0 +1 @@ +| 2026-08-14 | PR-1964 | 1dfc0c9b984152f6518060712ab050311f3f77c9 | vitest.config.mts, docs/maturity-backlog-workorders.md (ledger #192 / maturity X6 coverage floors) | APPROVED — coverage-threshold re-ratchet, no RAG/clinical behaviour change; verify:pr-local green except pre-existing unrelated check:medication-lexicon-report staleness | test:coverage,verify:pr-local |