Skip to content

refactor(eval): share public-sentinel owner default across read/eval scripts; close #347 answer-path gate - #370

Merged
BigSimmo merged 5 commits into
mainfrom
claude/fix-eval-owner-default-m7zoww
Jul 8, 2026
Merged

refactor(eval): share public-sentinel owner default across read/eval scripts; close #347 answer-path gate#370
BigSimmo merged 5 commits into
mainfrom
claude/fix-eval-owner-default-m7zoww

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

Follow-up to #348. That PR defaulted the golden retrieval eval's owner to the public sentinel 00000000-…0000, but only in scripts/eval-retrieval.ts — so eval:quality (incl. --rag-only), eval:rag, eval:answer-quality, and eval:search still resolved the owner as args.ownerId ?? emailLookup ?? undefined and returned 0/N against the all-public (owner_id = NULL) live corpus unless RAG_EVAL_OWNER_ID was set by hand. This closes that gap and the outstanding #347 part-2 answer-path eval gate.

  • Item 1 (shared default): hoisted DEFAULT_EVAL_OWNER_ID + resolveEvalOwnerId(supabase, args) into scripts/eval-utils.ts and applied it at the final owner-resolution point in all five read/eval scripts. eval-retrieval.ts is 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_EMAIL lookup → sentinel.
  • Item 3 (no silent narrowing): the helper prints a one-line warning whenever it falls back to the sentinel, so the narrowing to public-only scope is visible. (Observed firing in the live eval:quality run below.)
  • Scope guard: write/backfill scripts (enrich-documents, classify-documents, backfill-*) are deliberately excluded — defaulting an owner there could write under the wrong owner.
  • First-ever resolveEvalOwnerId unit coverage added to tests/eval-utils.test.ts.

Verification

## Answer Metrics
| Cases | 44 |
| Grounded supported rate | 0.90 | (#343 baseline 0.9333)
| Unsupported correct rate | 1 | (#343 baseline 1 — invariant held)
| Citation failure rate | 0.0455 | (#343 baseline 0.0455 — identical)
| Numeric grounding failure rate | 0.0227 | (#343 baseline 0.0227 — identical)

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.

  • Source-backed claims still require linked source verification (unchanged)
  • No patient-identifiable document workflow introduced or expanded
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy) — reads only, no config touched
  • Service-role keys and private document access remain server-only (eval secrets kept in gitignored .env.local, never committed)
  • Demo/synthetic content remains separated from real clinical sources
  • Source metadata/review-status/outdated behavior remain conservative
  • Deployment classification/TGA SaMD impact — no clinical decision-support behavior changed

Notes

🤖 Generated with Claude Code

https://claude.ai/code/session_01BdP9DwsGdvtEvyVh3juYZ5


Generated by Claude Code

claude added 3 commits July 8, 2026 05:20
…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
@supabase

supabaseBot commented Jul 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review July 8, 2026 06:26
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@BigSimmo
BigSimmo enabled auto-merge July 8, 2026 06:26
@BigSimmo
BigSimmo merged commit 745e9c8 into mainJul 8, 2026
5 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@BigSimmo@claude