📝 CodeRabbit Chat: Simplify PR code#534
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Important Review skippedThis PR was authored by the user configured for CodeRabbit reviews. CodeRabbit does not review PRs authored by this user. It's recommended to use a dedicated user account to post CodeRabbit review feedback. ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
3016507
into
claude/rag-review-improvements-f1bf84
…afety caveats + retrieval telemetry (#514) * fix(rag): honor preformatted answers, render high-yield bold, guard safety caveats + retrieval telemetry Client display fixes (offline-proven, no retrieval-ranking impact): - F1: the client now honors the server `preformatted` flag, so document-support-list and table/visual answers are no longer re-mangled by the prose sanitizer on display (document names and facility codes were being deleted). Adds a lossless normalizePreformattedDisplayText and threads the flag through the display chain. - F3: high-yield **bold** now reaches the rendered answer via SafeBoldText (display-only preserveBold; the shared server answer-gen path is unchanged), and the copy/paste clinical draft no longer leaks literal `**`. - F4: the compact primary-answer cap never drops a safety-signal fragment (withhold/stop/threshold/escalate/...); byte-identical when none is present. Retrieval observability (additive, retrieval results byte-identical): - F8: lexical RPC errors (match_document_chunks_text, match_document_table_facts_text, match_documents_for_query) now record hybrid_rpc_errors telemetry before returning empty, instead of silently degrading to zero candidates with no signal. Infra: - F7: replay-safe migration documenting the retrieval owner-filter drift with a verified, owner-runnable byte-perfect codification procedure. Live already gates all 8 primary retrieval RPCs with the fail-closed retrieval_owner_matches; the gap is committed-source reproducibility only. Verification: typecheck, lint, format, full vitest (1655 passed), eval:rag:offline, and the @critical demo answer-flow E2E all green. Live eval:retrieval:quality 36/36. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix: apply CodeRabbit auto-fixes Fixed 5 file(s) based on 4 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai> * 📝 Add docstrings to `claude/rag-review-improvements-f1bf84` Docstrings generation was requested by @BigSimmo. * #514 (comment) The following files were modified: * `src/components/ClinicalDashboard.tsx` * `src/components/clinical-dashboard/answer-content.tsx` * `src/components/clinical-dashboard/answer-result-surface.tsx` * `src/components/clinical-dashboard/display-text.ts` * `src/components/clinical-dashboard/evidence-panels.tsx` * `src/components/clinical-dashboard/output-panel.tsx` * `src/lib/answer-render-policy.ts` * `src/lib/rag-answer-text.ts` * `src/lib/rag.ts` * `src/lib/source-text-sanitizer.ts` * fix: preserve safety cues in compact answers * fix(rag): keep short safety caveats past the usefulness/length filter The compact-answer safety loop only rescued fragments that survived the `.map`/`.filter` usefulness gate, so a short caveat like "Contraindicated in pregnancy" (7 words, not flagged "useful") was dropped before it could be preserved. Make the map/filter safety-aware so safety-bearing fragments pass through untouched, and add regression tests for short and full-word escalation/contraindication caveats beyond the compact head. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * style: format source-text-sanitizer.test.ts (CodeRabbit autofix left it unformatted) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(ci): resolve PR #514 review findings and Supabase preview drift - Skip whole-text clinicalProseUsefulness in primaryAnswerDisplayText so short safety sentences (Stop/Cease/held) survive to the fragment bypass - Add held to the safety signal matcher for passive withhold caveats - Strip catalogue/source artifacts on a de-bolded copy when preserveBold is set, then restore surviving emphasis spans - Restore the 20260712000000 migration stub so the Supabase preview branch matches local migration history (verify guard only; RPC bodies deferred) - Add regression tests for stop/held caveats and bolded catalogue stripping Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * 📝 CodeRabbit Chat: Simplify PR code (#534) Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> * fix: apply Prettier formatting to answer-content.tsx --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Co-authored-by: CodeRabbit <noreply@coderabbit.ai> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Code changes was requested by @BigSimmo.
The following files were modified:
src/components/ClinicalDashboard.tsxsrc/components/clinical-dashboard/answer-content.tsxsrc/components/clinical-dashboard/answer-result-surface.tsxsrc/components/clinical-dashboard/evidence-panels.tsxsrc/components/clinical-dashboard/output-panel.tsxsrc/lib/rag-answer-text.ts