Skip to content

Revert "chore: production readiness improvements and E2E fixes" - #106

Closed
BigSimmo wants to merge 2 commits into
mainfrom
revert-103-feature/production-readiness-fixes
Closed

Revert "chore: production readiness improvements and E2E fixes"#106
BigSimmo wants to merge 2 commits into
mainfrom
revert-103-feature/production-readiness-fixes

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

Verification

  • npm run verify:cheap
  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
  • npm run verify:release before release or handoff confidence claims
  • npm run format:check
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed

Clinical Governance Preflight

Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output.

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed

Notes

@chatgpt-codex-connectorchatgpt-codex-connectorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit:1af528ae51

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

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".

Comment threadsrc/lib/rag.ts
) ||
/\b(?:what\s+action|action\s+is\s+required|required\s+action|suspected\s+\w+\s+toxicity)\b/.test(normalized)
) {
if (/\b(?:red|amber|green|anc|fbc|wbc|result|results|threshold|withhold|cease|stop|stopped)\b/.test(normalized)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Classify toxicity actions as red-result intent

For queries phrased like What action is required for suspected lithium toxicity? (the existing quality-lithium-toxicity-action eval case expects red_result_action), this condition no longer matches because both toxicity and the what action / action is required wording were removed. Those queries now fall through to general, so the extraction path uses generic entity overlap instead of red-result action evidence tokens and can return generic lithium/toxicity prose rather than the required action guidance.

Useful? React with 👍 / 👎.

Comment threadsrc/lib/rag.ts
Comment on lines 3782 to 3784
if (!hasRelevantQueryOverlap(sentence, query, intent)) continue;
const kind = factKindForSentence(sentence, query, intent);
if (!kind) continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore per-fact intent validation

Once the result-level gate admits a source, this loop now keeps any sentence that merely overlaps the query and has any fact kind. For red/ANC action queries, a sentence such as monitoring cadence can pass overlap and be ranked even though it is monitoring, not a threshold/action; the removed per-fact intent check was the guard that rejected mismatched fact kinds before answer synthesis.

Useful? React with 👍 / 👎.

Comment threadsrc/lib/rag.ts
const existingGapAnswer =
!answer.grounded &&
/could not find enough clean|no relevant clinical source|no current source|cannot provide a clinical answer|cannot provide a source-backed clinical answer|nearby indexed passages|not strong enough to support a reliable answer/i.test(
/could not find enough clean|no relevant clinical source|no current source|cannot provide a clinical answer|cannot provide a source-backed clinical answer/i.test(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Normalize nearby unsupported answers

When retrieval finds only nearby passages, the unsupported route still seeds the answer with I found nearby indexed passages, but they are not strong enough...; after this regex stopped recognizing nearby indexed passages / not strong enough, finalizeRagAnswerQuality no longer rewrites that sentinel into the specific fail-closed gap copy. That leaks source-inventory wording for unsupported-but-nearby clinical queries and also misses the quality scorer's expected fail-closed phrases such as no current source or could not find.

Useful? React with 👍 / 👎.

Comment threadsrc/lib/rag.ts
if (/\b[A-Za-z]{4,}[A-Z]{2,}[A-Za-z]{2,}\b/.test(normalized)) return true;
if ((normalized.match(/>/g) ?? []).length >= 2) return true;
if (/^\s*(?:references?|bibliography)\b/i.test(normalized)) return true;
if (hasClinicalAnswerQualityIssue(normalized)) return true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep reference boilerplate out of extractive facts

For retrieved chunks whose content is a references/bibliography block that happens to contain query terms like monitoring or dose, this function now lets the text through because the structural artifact checks for references, PubMed, randomized trial citations, contact details, etc. were removed. Those sentences can then be classified as clinical facts and cited in extractive answers instead of being filtered as non-clinical source metadata.

Useful? React with 👍 / 👎.

<DetailLedger view={clinicalDetailView} onViewChange={setClinicalDetailView} />

<MobileDetailList activeSection={activeMobileSection} />
<MobileDetailList />

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Render only the selected mobile medication tab

On mobile medication pages, MedicationSummaryTabs still updates activeMobileSection, but the detail list no longer receives it, so every section is rendered regardless of the selected tab. Tapping Dosing/Safety/More only scrolls through a long page and leaves unrelated cards (including More/Sources) visible under every tab, which regresses the tabbed mobile workflow that this state is meant to drive.

Useful? React with 👍 / 👎.

@BigSimmo
BigSimmo deleted the revert-103-feature/production-readiness-fixes branch June 29, 2026 10:37
BigSimmo pushed a commit that referenced this pull request Jul 29, 2026
Confirms the squash merge landed by content: the diff between squash
commit f4a3f50 and branch tip bebc6c0 is empty, so nothing was orphaned
by the auto-merge race despite four concurrent pushes during the merge
window. Also records that the coverage follow-ups were renumbered
#98/#99 -> #106/#107 (main claimed #98-#105 concurrently) with both
rows verified intact, and that the three red `PR required` results were
concurrency cancellations rather than defects.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012YRCXgX4AWZ579bKN6sk6b
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.

1 participant

@BigSimmo