fix(eval): require expected-doc coverage for acceptSourceOnly quality pass#562
Conversation
… pass Addresses the Codex P2 on PR #538: scoreAnswerQualityEvalCase's acceptSourceOnly relevance branch accepted any source-only/unsupported answer without checking that it still surfaced the expected documents, so a retrieval regression that stopped returning e.g. MHSP.Duress.pdf / MHSP.Discharge.pdf could hide in the quality canary (contradicting the "expectedFiles keeps the retrieval guard" intent). Wire the existing citesOrNamesExpectedDocument helper into the acceptSourceOnly branch so a source-only answer must still cite or name the expected doc. Updates the discharge test to assert both the cited (relevant) and uncited (not relevant) cases. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
📝 WalkthroughWalkthroughDiffuse-question relevance scoring now requires answers to cite or name the expected document, with tests covering both cited and uncited source-only answers. ChangesRelevance scoring
Estimated code review effort: 2 (Simple) | ~10 minutes Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 1 warning)
✅ Passed checks (9 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c4868031b2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… relevance (#564) Follow-up to #562 (Codex P2). The acceptSourceOnly relevance guard used citesOrNamesExpectedDocument, whose answer-text fallback matches bare topic tokens (documentExpectationAlternatives("MHSP.Duress.pdf") includes "duress"), so an uncited gap answer that merely mentions the topic still scored relevant, defeating the retrieval-regression guard. Require citation coverage via expectedFileCoverage(...).anyHit instead. Strengthens the test so a topic mention without a citation scores 0. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Summary
Follow-up to #538 (Codex P2).
scoreAnswerQualityEvalCase'sacceptSourceOnlyrelevance branch accepted any source-only/unsupported answer with only(grounded || unsupported) && expectedClassOk— it never checked that the answer still surfaced the expected documents. Combined with the droppedmustContainAnycue, a source-only answer that stopped retrieving e.g.MHSP.Duress.pdf/MHSP.Discharge.pdfcould still score relevant and intent-covered, hiding a retrieval regression in the quality canary (and contradicting the documented "expectedFiles keeps the retrieval guard" intent).Fix: wire the existing
citesOrNamesExpectedDocumenthelper into theacceptSourceOnlybranch, so a source-only answer must still cite or name the expected doc to score relevant. This also tightens the already-merged discharge sibling.Note: this is defense-in-depth — the core
duress-procedure/discharge-documentationcases already enforceexpectedHit && citationsin the quality summary, so the regression was never hidden globally.Verification
Offline only (pure eval-scoring logic; no answer-generation or provider behavior changed):
tests/rag-eval-cases.test.tsupdated — asserts a source-only answer scores relevant only when it cites the expected doc, and 0 when it does not; 24 passeval-quality+eval-utilsharness tests: green (35 pass across suites)--max-warnings 0: cleanClinical Governance Preflight
Eval-scoring-only change; does not touch ingestion, answer generation, retrieval, or document access. It makes the source-only eval stricter (must still surface expected docs), improving regression detection.
🤖 Generated with Claude Code