Claude/gate answer persistence flag 4b55da#537
Conversation
…_ANSWER_TEXT (PIA-3) rag_queries.answer stored the full generated answer text un-redacted — PHI-derived content at rest even though the query itself is hashed. Gate answer-text persistence behind a new RAG_PERSIST_ANSWER_TEXT flag (default off), mirroring the existing RAG_PERSIST_RAW_QUERY_TEXT precedent. - env: new RAG_PERSIST_ANSWER_TEXT (default false) - query-privacy: answerTextForStorage() + answerPrivacyMetadata() helpers - rag.ts insertRagQuery: central chokepoint nulls the answer and records metadata.answer_retained; covers every logRagQuery caller at once - eval-cases route: answer persistence moved onto the dedicated flag so one switch governs answer text everywhere (free-text note stays on raw-query flag) - production-readiness: block RAG_PERSIST_ANSWER_TEXT=true in production - docs: .env.example + privacy-impact-assessment (PIA-3 -> Resolved) The offline eval pipeline reads the in-memory answer (logQuery:false) and never reads the persisted column, so default-off does not affect eval. Tests: answerTextForStorage/answerPrivacyMetadata unit tests; rag_queries insert nulls the answer by default at the real chokepoint; eval-cases decoupling test. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Review fix: the earlier PIA-3 wording overclaimed that generated answer text is "dropped at rest by default." The durable rag_queries.answer log is gated by RAG_PERSIST_ANSWER_TEXT, but rag_response_cache.payload still holds the full answer (owner-scoped, ~5-min TTL). Tighten the register/APP-11/recommendation wording to the durable log and add an explicit "Residual (scoped out)" note for the short-lived response cache, which is intentionally not gated (nulling its payload would defeat caching). No behaviour change; documentation accuracy only. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
@copilot resolve the merge conflicts in this pull request |
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
Head branch was pushed to by a user without write access
Done — resolved all merge conflicts in |
💡 Codex ReviewLines 116 to 120 in c26e54f When ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
|
fix this issue below please P1 Badge Gate cached answers behind the retention flag |
Summary
Testing
|
Summary
Verification
npm run verify:pr-localDuring development, use
npm run verify:cheapas the faster iteration gate before the final PR-local preflight.npm run verify:uiwhen UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changednpm run verify:releasebefore release or handoff confidence claimsFor retrieval, ranking, selection, chunking, source/citation rendering, or answer-contract changes,
verify:pr-localrunseval:rag:offlineautomatically. Run the offline command directly during iteration before spending a live eval.npm run eval:retrieval:quality(must stay 36/36) when retrieval, ranking, selection, chunking, or scoring behavior changed — CI cannot run it (needs live keys), so run it locally and paste the summary. A metadata/governance-weighting change once buried correct docs (recall 1.0→0.76) and only this eval caught it.npm run eval:rag -- --limit 15+npm run eval:quality -- --rag-onlywhen answer generation, the synthesis prompt, or answer post-processing changed (grounded-supported must not drop; citation-failure 0)npm run check:production-readinesswhen clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changednpm run check:deployment-readinesswhen deployment startup, hosting, or rollout behavior changedClinical Governance Preflight
Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes