Skip to content

feat(search): alert on silent clinical-search degradation (council pre-beta req)#88

Merged
thefiredev-cloud merged 1 commit into
mainfrom
claude/pg-silent-degradation-detection
Jun 1, 2026
Merged

feat(search): alert on silent clinical-search degradation (council pre-beta req)#88
thefiredev-cloud merged 1 commit into
mainfrom
claude/pg-silent-degradation-detection

Conversation

@thefiredev-cloud
Copy link
Copy Markdown
Owner

What

Silent-degradation detection for clinical search — required before TestFlight beta per the resubmission AI-council (2026-06-01).

Two failure modes no longer fail silently:

  1. Semantic search degrades to keyword-only (embedding 403 / invalid key / circuit-open) — now a Sentry error alert, not a buried log.
  2. A clinical query that resolved to a real agency returns ZERO results ("blank screen mid-call") — now alerted.

Changes

  • NEW server/_core/embeddings/degradation-alert.ts (Sentry + logger, false-alarm-safe: only fires for resolved-agency clinical queries).
  • embeddings/search.ts: alert at both BM25-fallback sites.
  • routers/search/semantic.ts: alert on resolved-agency empty results.
  • NEW tests/embedding-degradation-alert.test.ts — 5 DB-free unit tests, all pass.

Safety / scope

Additive only (alerts on existing failure paths). No behavior change to results. Does NOT deploy on its own — backend ships via the pg-ship/backend gate after review.

Verification

pnpm vitest run tests/embedding-degradation-alert.test.ts → 5/5 pass. No new type errors from these files.

…e-beta req)

- New degradation-alert.ts: Sentry alerts for (a) semantic->keyword-only fallback
  on embedding 403/circuit-open, (b) resolved-agency clinical query returning ZERO results.
- Wire both fallback sites in embeddings/search.ts + the empty-result path in semantic.ts.
- 5 DB-free unit tests (all pass), incl. false-alarm guards.
Required before TestFlight beta per resubmission AI-council 2026-06-01.
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 1, 2026

Deploy Preview for protocol-guide ready!

Name Link
🔨 Latest commit 40ad9aa
🔍 Latest deploy log https://app.netlify.com/projects/protocol-guide/deploys/6a1e0d48fe6f8900082b2ae5
😎 Deploy Preview https://deploy-preview-88--protocol-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@thefiredev-cloud thefiredev-cloud merged commit 04b9452 into main Jun 1, 2026
16 of 17 checks passed
@thefiredev-cloud thefiredev-cloud deleted the claude/pg-silent-degradation-detection branch June 1, 2026 23:06
thefiredev-cloud added a commit that referenced this pull request Jun 1, 2026
…89)

Council #88 follow-up: isClinical was dosing-keyword-only, so bare emergent
queries (chest pain, stroke, cardiac arrest) that blank-screen for a resolved
agency did NOT alert. New pure isClinicalQuery() reuses the normalizer's
intent / isEmergent / extractedConditions / extractedMedications signals.
+5 unit tests (10/10 pass).

Co-authored-by: Claude Assistant <claude@anthropic.com>
Sign up for free to 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