refactor(eval): share public-sentinel owner default across read/eval scripts; close #347 answer-path gate - #370
Merged
Conversation
…scripts Hoist DEFAULT_EVAL_OWNER_ID + resolveEvalOwnerId() into scripts/eval-utils.ts and apply it at the final owner-resolution point in eval-retrieval, eval-quality, eval-rag, eval-answer-quality, and eval-search. Previously only eval-retrieval (PR #348) defaulted to the public-owner sentinel, so the answer-path evals still returned 0/N against the all-public (owner_id=NULL) live corpus unless RAG_EVAL_OWNER_ID was set by hand. The helper preserves precedence (explicit --owner-id / RAG_EVAL_OWNER_ID / LOCAL_NO_AUTH_OWNER_ID, then --owner-email / RAG_EVAL_OWNER_EMAIL, then the sentinel) and emits a one-line warning on the sentinel fallback so the narrowing to public-only scope is visible, not silent. Scope labels in eval-rag/eval-search now key off the explicit input so a sentinel run still reads "public". Read/eval scripts only — write/backfill scripts are intentionally untouched. Adds first-ever resolveEvalOwnerId unit coverage to tests/eval-utils.test.ts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdP9DwsGdvtEvyVh3juYZ5
The public-owner sentinel default is now the shared resolveEvalOwnerId() helper in eval-utils.ts, covering eval:retrieval:quality, eval:quality (incl. --rag-only), eval:rag, eval:answer-quality, and eval:search — with a one-line fallback warning. Write/backfill scripts intentionally excluded. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdP9DwsGdvtEvyVh3juYZ5
…h gate Adds the 2026-07-08 follow-up: DEFAULT_EVAL_OWNER_ID + resolveEvalOwnerId() are now shared across all read/eval scripts (item 1), with a one-line sentinel-fallback warning (item 3). Records the live eval:quality --rag-only result closing #347's answer-path gate (item 2): cases=44, unsupported_correct=1.0, citation_failure=0.0455, numeric_grounding=0.0227 (all identical to #343 baseline); grounded_supported=0.90, with the 5 failing cases all in #343's documented latency/route live-variance set. Corrects the earlier overstatement so #348 reads as closing the retrieval half only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BdP9DwsGdvtEvyVh3juYZ5
This pull request has been ignored for the connected project Preview Branches by Supabase. |
BigSimmo
marked this pull request as ready for review
July 8, 2026 06:26
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
BigSimmo
enabled auto-merge
July 8, 2026 06:26
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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
Follow-up to #348. That PR defaulted the golden retrieval eval's owner to the public sentinel
00000000-…0000, but only inscripts/eval-retrieval.ts— soeval:quality(incl.--rag-only),eval:rag,eval:answer-quality, andeval:searchstill resolved the owner asargs.ownerId ?? emailLookup ?? undefinedand returned 0/N against the all-public (owner_id = NULL) live corpus unlessRAG_EVAL_OWNER_IDwas set by hand. This closes that gap and the outstanding #347 part-2 answer-path eval gate.DEFAULT_EVAL_OWNER_ID+resolveEvalOwnerId(supabase, args)intoscripts/eval-utils.tsand applied it at the final owner-resolution point in all five read/eval scripts.eval-retrieval.tsis refactored onto the helper and its local duplicate constant removed. Precedence preserved: explicit--owner-id/RAG_EVAL_OWNER_ID/LOCAL_NO_AUTH_OWNER_ID→--owner-email/RAG_EVAL_OWNER_EMAILlookup → sentinel.eval:qualityrun below.)enrich-documents,classify-documents,backfill-*) are deliberately excluded — defaulting an owner there could write under the wrong owner.resolveEvalOwnerIdunit coverage added totests/eval-utils.test.ts.Verification
npm run verify:cheap— green (check:runtime,sitemap:check, lint 0 errors / pre-existing warnings only, typecheck, unit tests 1277 passed / 3 skipped incl. the 3 newresolveEvalOwnerIdtests)npm run verify:ui— N/A (no UI/routing/styling change)npm run verify:release— not run (no release claim)npm run format:check— Prettier clean on changed filesnpm run eval:retrieval:quality— 36/36,failed_cases=0(regression check on the refactoredeval-retrieval.ts; behavior unchanged vs fix(eval): default golden retrieval eval owner to public sentinel #348)npm run eval:quality -- --rag-only— closes the refactor(rag): decompose rag.ts part 2 (extractive-answer, retrieval-variants, cache) — move-only #347 part-2 answer-path gate (live, no manual owner — the helper warned + used the sentinel):The 3 rate invariants match #343's live baseline exactly. The 5 failing answer cases are all in #343's documented live-variance set: 2 pure latency-threshold failures (
clozapine-fbc-acronym-threshold,agitation-im-po-route-short-terms— this environment's Supabase p95 ≈ 49 s, the local→remote latency #343 called out) and 3 route/retrieval flakes (illegal-substances,discharge-documentation,community-admission— #343 named these as pre-existing variance outside the touched paths). Since this change is eval-config only (owner resolution) and touches no answer-generation code, the identical invariant rates confirm the part-2 decomposition preserved answer behavior.npm run check:production-readiness— N/A (no clinical/privacy/env/Supabase runtime change)Clinical Governance Preflight
Touches only eval-harness owner configuration + docs — not ingestion, answer generation, search/ranking runtime, source rendering, document access, privacy, production env, or clinical output.
Clinical KB Database(sjrfecxgysukkwxsowpy) — reads only, no config touched.env.local, never committed)Notes
eval-retrievaltoo (which previously had none).docs/process-hardening.mdrecords the result and corrects the earlier phrasing (fix(eval): default golden retrieval eval owner to public sentinel #348 closed the retrieval half; this closes the answer-path half — refactor(rag): decompose rag.ts part 2 (extractive-answer, retrieval-variants, cache) — move-only #347 part-2 fully settled).docs/retrieval-quality-runbook.mdnotes the default now spans the whole eval suite.🤖 Generated with Claude Code
https://claude.ai/code/session_01BdP9DwsGdvtEvyVh3juYZ5
Generated by Claude Code