feat(eval): snapshot regeneration from live artifact + alias tiering docs + fixture-length pin (ADDENDUM 4 A-PR-2)#1001
Conversation
…size to the golden fixture (A-PR-2 part 1) - cross-referencing headers in scripts/lib/clinical-aliases.ts (strict golden tier) and src/lib/eval-document-matching.ts (deliberately wider captured-case tier) kill the accidental-drift/bulk-merge failure mode the governance review flagged — merging the wide tier into the golden gates would silently loosen clinical ground truth - tests/ranking-tuning.test.ts pins snapshot case count to the live golden fixture length (replacing the hardcoded 36) so fixture and snapshot can only evolve in lockstep, with regeneration instructions in the failure message Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThe PR regenerates ranking snapshots with provenance metadata, requires valid snapshot timestamps, updates retrieval and alias-tier evidence, aligns tests with the golden fixture count, and records measurement-floor verification results. ChangesRanking measurement-floor refresh
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested labels: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
…equire generatedAt (A-PR-2 part 2) - snapshot rebuilt from eval-canary run 29763761133's artifact (sha256 5af5b802..., 36/36 green, doc_recall 1.0 / content_recall 1.0) via the alias-aware builder with --source-run-id provenance — first regeneration since the builder gained alias grading; agitation-im-po-options gains 5 graded positives (EMHS guideline now recognized), flowchart-next-step remains the sole zero-positive case (known flowchart rr headroom) - generatedAt promoted from optional to required in RankingSnapshot + validateRankingSnapshot: every builder output is stamped, and an absent value would silently disable the now-active 30-day freshness gate - two data-coupled test pins updated for the fresh snapshot: missing-positive count 2 -> 1 (the alias improvement above), and the broad_summary equality pin against defaultRankingConfig dropped — the shipped defaults' provenance was the retired snapshot; fresh-snapshot recommendations are Phase B input, while the invariant loop (determinism, objective gain, recall non-regression, zero high-risk failures) still pins behavior Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
…idence (A-PR-2 part 3) lithium-therapy-monitoring was the only golden case with no document expectation, making its rr@10 a hardcoded 0.00 — measurement noise that masked real ordering headroom (live top-5: Lithium Clinical Guideline (EMHS) #1, Lithium Therapy Initiation (FSH) #2, Lithium (CAMHS) #3). expectedDocumentSubstrings gains ["Lithium"]: deliberately broad because the corpus carries multiple legitimate lithium guidelines (same pattern as the agitation pair) — the gate asserts subject precision in the top 5, not a single pinned title that would flake between equally-correct docs. Measured mrr@10 rises ~+0.028 from de-noising alone. Snapshot rebuilt from the same run-29763761133 artifact with the updated expectation so fixture and snapshot stay in lockstep (ranks 1-4 now grade as relevant; the psychotropic-generic rank 5 and the wrong-medication hard negative stay 0). Clinical sign-off note: this changes eval ground truth only — no runtime ranking behavior. Flagged in the PR for review. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Summary
Phase A completion (ADDENDUM 4, PR 2 of 2) — all parts landed; eval ground truth + measurement scaffolding only, no runtime ranking behavior change.
scripts/lib/clinical-aliases.ts(strict golden tier) andsrc/lib/eval-document-matching.ts(deliberately wider captured-case tier). Investigation of the A-PR-1 governance finding showed bulk-merging would silently loosen golden ground truth (e.g. "Clozapine GP Shared Care" satisfying the pinned prescribing-guideline expectation) — so the tiers stay separate, now explicitly. Comments only (reviewer-verified byte-identical tables via pure-additive diffs).rag-ranking-candidate-snapshot.v1.jsonrebuilt from canary run 29763761133's artifact (sha2565af5b802…verified byte-identical after transfer; 36/36 green, doc_recall 1.0, content_recall 1.0 — first perfect content recall, CIWA alias confirmed live). The alias-aware builder proves itself on real data:agitation-im-po-optionsgoes 0→5 graded positives (EMHS guideline recognized);flowchart-next-stepconfirmed as the sole zero-positive case.generatedAtnow validator-required (was optional): every builder output is stamped, and an absent value would silently disable the now-active 30-day freshness gate. Closes the governance review's hand-edit follow-up.lithium-therapy-monitoringwas the only golden case with no document expectation — its rr@10 was a hardcoded 0.00 (measurement noise). It gainsexpectedDocumentSubstrings: ["Lithium"], deliberately broad because the corpus carries multiple legitimate lithium guidelines (EMHS clinical Bump actions/checkout from 4 to 6 #1, FSH initiation Bump actions/setup-node from 4 to 6 #2, CAMHS Bump @types/node from 20.19.41 to 25.9.1 #3 live) — the gate asserts subject precision, not a single title that would flake between equally-correct documents. Measured mrr@10 rises ~+0.028 from de-noising alone. Snapshot rebuilt in lockstep from the same artifact. ⚕️ Clinical sign-off requested on this one fixture change (marking this PR ready = sign-off).ciwa- arvariant), 4 are ordinary prose punctuation (treatment,mood,(opioidptsd.[35]) invisible to the whitespace-delimited matcher. Per the approved plan, this systemic class is proposed as its own reviewed follow-up (word-boundary matching), not bundled here.Deferred with reasons: new-query fixture cases (saturated-tie shapes, captured
rag_query_misses) need live validation before they may gate — unlocked by Phase D-1 (branch-eval dispatch input) or a dedicated validation dispatch. Real Phase B ordering headroom, now cleanly measured: flowchart 0.20, alcohol-ciwa 0.25, patient-safety 0.33, opioid 0.33 rr@10 — alltext_fast_path.Verification
ranking-tuning,eval-retrieval,eval-quality,rag-eval-cases) — re-run green after each stagenpm run test— 3019 passed / 1 failed: the known container-onlypdf-extraction-budgetartifact (baselined on clean main)npm run lint+npm run typecheck— clean (typecheck covers thegeneratedAttype change across all snapshot consumers)pr-required: success on final head99e8be5(run 4088)npm run eval:retrieval:qualitynot run locally (no live keys in sandbox): the source artifact IS the live 36/36 evidence, and the next scheduled canary re-validates the gated lithium case live (it ranks Bump actions/checkout from 4 to 6 #1–4 in the current artifact, so the gate is satisfied with margin)Risk and rollout
src/runtime consumer of any touched module/fixture). The lithium gate could theoretically fail a future canary if the corpus lost all lithium-titled documents from the top-5 — which would be a real retrieval regression worth failing on. Validator hardening cannot brick other consumers (typecheck + reviewer grep of all three consumers).Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
generatedAtrequirement safe for all three consumers, and no safety gate weakened by the pin updates. Two informational P3s recorded: (a) treat 2026-07-20 as a baseline step when trending absolute mrr@10 (the lithium de-noising is a one-time +~0.028 that gates nothing); (b) the now-active freshness gate will fail the offline suite ~2026-08-19 unless the snapshot is regenerated from a fresh canary artifact — the intended fail-closed anti-drift mechanism, with a recurring ~$1–2 regeneration cost (or $0 when piggybacked on the weekly scheduled run).e58c827,5b664f8,3d8f798).RAG_RANKING_CONFIG→ live canary pair) starts from this snapshot.🤖 Generated with Claude Code
https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
Summary by CodeRabbit
Improvements
Documentation