Skip to content

fix(differentials): retitle "Urgency: urgent" export artifact to "Focused Diagnostic Trap Tables"#500

Merged
BigSimmo merged 5 commits into
mainfrom
claude/differentials-artifact-filter-c5aea0
Jul 11, 2026
Merged

fix(differentials): retitle "Urgency: urgent" export artifact to "Focused Diagnostic Trap Tables"#500
BigSimmo merged 5 commits into
mainfrom
claude/differentials-artifact-filter-c5aea0

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Fixes an export-parser artifact in the differentials catalogue: the focused-diagnostic-trap-tables appendix (03_individual_entries/T_Focused_Diagnostic_Trap_Tables.txt) has no title line, so the parser promoted its first metadata row, Urgency: urgent, into a presentation titled "Urgency: urgent" (slug urgency-urgent) — with detail routes and, once presentations became a searchable domain, universal-search hits for "urgent".
  • Root-cause fix (retitle, not exclude): parseEntryTitle now falls back to the === HEADER === text when the first line after the header is a metadata row (detected by isDifferentialMetadataArtifactTitle), so the entry is titled "Focused Diagnostic Trap Tables" (slug focused-diagnostic-trap-tables) instead of "Urgency: urgent". The snapshot was regenerated (net diff = the retitle + exportedAt; stays 31 presentations).
  • Why retitle rather than exclude: the entry is a legitimate comparison workflow ("Distinguishes intrusive/obsessional phenomena from psychotic or violent intent"), and 4 of its 7 option diagnoses (gad-worry-depressive-rumination, overvalued-idea, psychotic-delusion, ptsd-intrusive-memories-flashbacks) exist in no other entry. Excluding it would orphan those diagnoses and break the invariant added by feat(differentials): interactive diagnosis detail page with honest safety snapshot #483 — enforced in tests/differential-detail.test.ts — that every diagnosis belongs to a presentation. Retitling fixes the reported bug while keeping all diagnoses parented and that test green.
  • Stale-row prune (operator, live Supabase): the retitle changes the slug (urgency-urgentfocused-diagnostic-trap-tables), and seeding upserts by slug and never deletes, so already-seeded owners keep the old differential_records row and its registry-corpus document. npm run differentials:seed -- --owner-id <uuid> --write now prunes presentation rows whose slug the current snapshot no longer produces (staleSeededPresentations) and their corpus documents. Documented in docs/process-hardening.md.
  • Tests: snapshot still 31; added coverage for the header-title fallback, the no-metadata-title invariant, and the stale-slug prune helper.

Verification

  • npm run verify:pr-local
  • npm run verify:cheap — green (runtime, GitHub-actions pins, CI-scope, sitemap, lint, typecheck, full unit suite incl. differential-detail)
  • npm run format:check — green (required CI gate, separate from verify:cheap)
  • Focused vitest: differentials, differential-detail, differentials-route, registry-corpus, cross-mode-links, universal-search, site-map — 91/91

Not run and why:

  • npm run verify:uiN/A: no UI/routing/styling/browser/component changes. The .tsx deltas on this branch are inherited from main via the catch-up merge, not part of this change's net diff.
  • npm run eval:retrieval:quality — N/A: this change does not alter retrieval, ranking, selection, chunking, or scoring. It renames one catalogue entry and adds a deletion-id helper for pruning; no golden retrieval case is affected. (The gate also needs live Supabase/OpenAI keys, which are provider-gated.)
  • npm run eval:rag / eval:quality — N/A: no answer-generation, synthesis-prompt, or post-processing change.
  • npm run check:production-readiness — provider-gated (live Supabase); not run automatically. No production env, privacy, or deployment behavior changed.

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use — unchanged; this only gives a mis-titled catalogue entry an honest title.
  • No patient-identifiable document workflow was introduced or expanded.
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy) — no Supabase target/env change.
  • Service-role keys and private document access remain server-only — the new prune path runs only in the operator seed CLI and the existing server-only seed helper.
  • Demo/synthetic content remains clearly separated from real clinical sources — unchanged.
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative — governance derivation unchanged; only a presentation title/slug changed.
  • Deployment classification/TGA SaMD impact checked — no clinical decision-support behavior changed; the entry's diagnoses and comparison content are unchanged, only its title.

Notes

  • Branch was caught up to origin/main (through PR perf(db): drop redundant clinical_registry_record_sources_record_idx #491) via two merge commits (never rebased); the only conflicts were additive collisions in differentials.ts imports and registry-corpus.ts helper placement, both resolved by keeping both sides.
  • The fix was iterated: an initial exclude-based approach was pivoted to retitle after differential-detail.test.ts surfaced the orphaned-diagnosis invariant from feat(differentials): interactive diagnosis detail page with honest safety snapshot #483. History is intended to be squash-merged, collapsing the iteration into one commit.
  • Operator follow-up (live Supabase, not done here): run npm run differentials:seed -- --owner-id <uuid> --write for each already-seeded owner to prune the retired urgency-urgent row and its corpus document/chunks.

🤖 Generated with Claude Code

BigSimmo and others added 5 commits July 11, 2026 21:38
…esentations

The differentials export's focused-diagnostic-trap-tables appendix
(T_Focused_Diagnostic_Trap_Tables.txt) has no title line, so the parser
promoted its first metadata row ("Urgency: urgent") into a presentation
titled "Urgency: urgent" (slug urgency-urgent) with detail routes and
search visibility once presentations became a searchable domain.

Exclude titleless metadata-row entries at three layers sharing one
predicate (isDifferentialMetadataArtifactTitle):
- buildDifferentialSnapshot drops such entries from presentations (their
  options remain diagnoses — 4 exist in no other entry) and keeps the
  artifact title out of diagnosis currentPresentation.
- usableDifferentialPresentations() is the single source of truth for the
  runtime catalogue, seed rows, and stale-row pruning.
- Regenerated the snapshot (31 -> 30 presentations).

Seeding upserts and never deletes, and auto-seed only fires for zero-row
owners, so already-seeded owners keep the stale differential_records row
and its registry corpus document; differentials:seed now prunes stale
seeded presentations and their corpus documents per owner (live Supabase,
operator-run). Tests updated to 30 with regression coverage for the
exclusion and the prune helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…artifact-filter-c5aea0

# Conflicts:
#	src/lib/differentials.ts
#	src/lib/registry-corpus.ts
…cluding it

Pivots the "Urgency: urgent" artifact fix from exclusion to a root-cause
retitle after the #483 invariant (every diagnosis belongs to a
presentation, enforced by differential-detail.test.ts) surfaced: the
appendix is the sole parent of 4 diagnoses that exist in no other entry
(gad-worry-depressive-rumination, overvalued-idea, psychotic-delusion,
ptsd-intrusive-memories-flashbacks), so excluding it orphaned them.

parseEntryTitle now falls back to the "=== HEADER ===" text when the
first line after the header is a metadata row, titling the entry
"Focused Diagnostic Trap Tables" (slug focused-diagnostic-trap-tables)
instead of "Urgency: urgent". Reverts the runtime/seed exclusion filters
added by the earlier approach; the snapshot stays 31 presentations with
all diagnoses parented. staleSeededPresentations still prunes the retired
"urgency-urgent" slug (and its corpus document) for already-seeded owners,
since the slug changed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@BigSimmo, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 13 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fc64fda0-f406-4fa7-80dd-17fe3d267f37

📥 Commits

Reviewing files that changed from the base of the PR and between 50acc4e and 03dbb33.

📒 Files selected for processing (8)
  • data/differentials-snapshot.json
  • docs/process-hardening.md
  • scripts/lib/parse-differentials-export.ts
  • scripts/seed-differential-records.ts
  • src/lib/differential-seed.ts
  • src/lib/differential-snapshot.ts
  • src/lib/registry-corpus.ts
  • tests/differentials.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/differentials-artifact-filter-c5aea0
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch claude/differentials-artifact-filter-c5aea0

Comment @coderabbitai help to get the list of available commands.

@supabase

supabase Bot commented Jul 11, 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 merged commit 35f6bfa into main Jul 11, 2026
15 checks passed
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.

1 participant