feat(eval): canary retrieval artifact + alias-aware ranking-snapshot builder with freshness provenance (ADDENDUM 4 A-PR-1)#999
Conversation
…shot builder with freshness provenance - eval-canary.yml golden step writes --json-out and uploads .local/eval-canary/ (pinned upload-artifact, 30-day retention) so ranking-snapshot regeneration no longer needs a paid dispatch - --json-out no longer forces --json: the artifact file writes independently while stdout keeps the human-readable log the failure-issue analyzer parses - clinicalDocumentAliases/clinicalContentAliases move verbatim to scripts/lib/clinical-aliases.ts, shared by the live gates and the snapshot builder; the builder now grades documentMatch/contentMatch through the sanctioned aliases so tuner ground truth agrees with the live eval - snapshot metadata gains generatedAt + optional sourceRunId provenance; validateRankingSnapshot accepts them and relaxes exactly-36 to at-least-36 for the planned fixture expansion; a 30-day freshness test activates on first regeneration - build:ranking-snapshot npm script for discoverability 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
|
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 (9)
📝 WalkthroughWalkthroughThe change centralizes clinical aliases, updates retrieval output handling, preserves canary evaluation artifacts, and adds provenance metadata plus relaxed case-count validation for ranking snapshots. Tests cover alias matching, freshness, provenance, and truncated artifacts. ChangesRanking snapshot evaluation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant EvalCanary
participant EvalRetrieval
participant ArtifactStorage
EvalCanary->>EvalRetrieval: run evaluation with --json-out
EvalRetrieval->>ArtifactStorage: write JSON and human-readable log
EvalCanary->>ArtifactStorage: upload evaluation directory
sequenceDiagram
participant SnapshotBuilder
participant AliasMatchers
participant SnapshotValidator
SnapshotBuilder->>AliasMatchers: match document and content labels
AliasMatchers-->>SnapshotBuilder: return alias-aware matches
SnapshotBuilder->>SnapshotValidator: validate generated snapshot
SnapshotValidator-->>SnapshotBuilder: accept snapshot metadata and cases
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
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
Measurement floor for the approved evidence-gated ranking-tuning phase — no ranking behavior change anywhere in this diff. Three gaps closed:
--json-outand a pinnedactions/upload-artifactstep uploads.local/eval-canary/on success and failure (30-day retention = the freshness window).--json-outis decoupled from--jsoninscripts/eval-retrieval.tsso the artifact file writes independently while stdout keeps the human-readable per-case lines and summary that the tee'd log — and the failure-issueanalyzeFailureTextstep — depend on. Ranking-snapshot regeneration stops costing a paid dispatch.clinicalDocumentAliases/clinicalContentAliasesmove verbatim fromscripts/eval-retrieval.tsinto sharedscripts/lib/clinical-aliases.ts; the snapshot builder now gradesdocumentMatch/contentMatchthrough the same sanctioned expansions the live gates use (documentLabelMatchesWithAliases/contentLabelMatchesWithAliasesinscripts/lib/ranking-snapshot-builder.ts). Previously alias-satisfied hits (e.g. the EMHS agitation guideline, spelled-out "absolute neutrophil count") graded as misses, feeding the offline tuner mislabeled ground truth. Discriminating tests pin that rawlabelMatchesfails both cases and the alias-aware matchers pass them.generatedAt(+ optional--source-run-id);validateRankingSnapshotaccepts/validates both and relaxes exactly-36 to at-least-36 (floor still rejects truncated artifacts;sourceCaseCountmatch and per-case candidate minimums unchanged) ahead of the planned fixture expansion. A 30-day freshness test intests/ranking-tuning.test.tsactivates on first regeneration and then blocks silent corpus drift, with the regeneration command in its failure message. Newbuild:ranking-snapshotnpm script.Static hyphen audit of all 36 golden cases' content terms (CIWA-Ar class): no currently-blocked term (canary #52 is 36/36). Residual risk classes documented for the artifact-grounded A-PR-2 pass: punctuation-joined corpus tokens (IM/PO, schizo-affective, post-natal) and inert stem entries (
obsess/compuls/hyperactiv/impulscan never match under the whole-token matcher; those cases currently pass via whole-word OR-alternates).Builder verified end-to-end on a synthetic 36-case artifact: alias grading, provenance stamping, and validator acceptance all confirmed.
Verification
npm run verify:pr-local— Verification not run locally: hostedpr-requiredcovers build/bundle-scan/RAG-fixture validation; locally ran the full unit suite + the workflow-specific gates below inside the pre-18:00Z merge windowtests/ranking-tuning.test.ts,tests/eval-retrieval.test.ts,tests/eval-quality.test.ts), re-run green on the main-synced headnpm run test— 3019 passed / 1 failed: the known container-onlypdf-extraction-budgetchild-process artifact (baselined on clean main)npm run lint+npm run typecheck— cleannpm run check:github-actions+npm run check:ci-scope— PASS (workflow diff)npm run check:production-readiness— expected missing-secret FAILs only (demo-mode container, no live keys)npm run eval:retrieval:qualitynot run: no retrieval/ranking/selection/scoring behavior changed (eval harness scaffolding + workflow only; live gates consume the identical alias maps). Live confirmation is free: tonight's 18:00 UTC scheduled canary runs the unchanged gates and emits the first artifact.Risk and rollout
if: always()+if-no-files-found: ignore; pin verified against the repo allowlist), or--json-outdecoupling alters eval stdout (mitigated: per-case lines and human summary asserted unchanged by existing eval tests; JSON dump only ever printed under explicit--json). Snapshot-validator relaxation cannot loosen ground truth: ≥36 floor,sourceCaseCountequality, and per-case candidate minimums all still enforced..local/eval-canary/.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy) — workflow env unchangedNotes
docs/branch-review-ledger.md, content commit81ab969).clinicalDocumentAliasesinsrc/lib/eval-document-matching.ts(consumed bysrc/lib/rag/rag-eval-cases.ts) should be reconciled with the shared module; (b) once the fixture grows past 36, pin the validator floor to the live fixture length instead of the coarse ≥36; (c) after first regeneration stampsgeneratedAt, consider making it required so a hand-edit cannot silently re-disable the freshness gate.🤖 Generated with Claude Code
https://claude.ai/code/session_01EXsJcLrbZUXwnBeG91cVo9
Summary by CodeRabbit
New Features
Validation
Documentation