fix(eval): require citation coverage (not prose) for acceptSourceOnly relevance#564
Merged
Merged
Conversation
… relevance 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>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
BigSimmo
enabled auto-merge (squash)
July 13, 2026 07:43
Contributor
📝 WalkthroughWalkthroughSource-only relevance scoring now requires expected-document citation coverage instead of prose or document-name matching. The corresponding test clarifies that topic mentions without the expected citation do not satisfy relevance. ChangesSource-only relevance 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)
✅ Passed checks (10 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the #562 fix (Codex P2). The
acceptSourceOnlyrelevance guard usedcitesOrNamesExpectedDocument, whose answer-text fallback matches bare topic tokens —documentExpectationAlternatives("MHSP.Duress.pdf")includesduress— so an uncited gap answer like "No current source for the duress procedure…" still scored relevant, defeating the retrieval-regression guard #562 was adding.Fix: require citation coverage in the
acceptSourceOnlybranch viaexpectedFileCoverage(testCase.expectedFiles, answer.citations, …).anyHitinstead of the cite-or-name helper. (citesOrNamesExpectedDocumentis left intact — still used by the separate targeting metric at its other call site.)Defense-in-depth as before: the core
duress-procedure/discharge-documentationcases already enforceexpectedHit && citations, so the regression was never hidden globally.Verification
Offline only (pure eval-scoring logic):
tests/rag-eval-cases.test.ts: strengthened — a source-only answer whose prose mentions the topic ("discharge") but cites nothing now scores 0; citing the expected doc scores 1. 24 pass.--max-warnings 0: cleanClinical Governance Preflight
Eval-scoring-only; no ingestion/answer-generation/retrieval/document-access changes. Makes the source-only quality gate stricter (must cite expected docs).
🤖 Generated with Claude Code