fix: resolve merge conflict for PR #343 (retrieval-correctness → main) - #345
Merged
Merged
Conversation
…d-nav module (move-only) The prepared dashboard-nav.tsx sibling from #250 had drifted from the live monolith (missing prop members, stale colour tokens), so it was regenerated verbatim from the current monolith block (1072-1436) before wiring. Exports: ToolsHub, buildMobileSectionFabState, MobileSectionFab; back-imports (ApplicationsLauncherWorkspace, navigationHashes, mobileSectionFabMediaQuery) follow the existing benign back-edge pattern. Monolith 4373 -> 4007 lines. Live-surface data-testid/aria-label corpus verified byte-identical pre/post. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPVNBVo4cg9PEYtNhJZBQY
…og module (move-only) The prepared settings-dialog.tsx from #250 predated the auth-email sign-in flow (useAuthSession/settingsEmail/submitSettingsEmail all absent), so it was regenerated verbatim from the current monolith block (518-1070) before wiring. Repointed both consumers: the monolith render and global-mockup-search-shell (which now imports SettingsDialog from the module and only recentQueryStorageKey from the monolith). Stripped 24 now-orphaned monolith imports. Monolith 4007 -> 3454 lines. Live-surface data-testid/aria-label corpus verified byte-identical pre/post. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPVNBVo4cg9PEYtNhJZBQY
…l markers
H2 line-level residue, found by the new fast-check property suite: extraction
glues control markers ('Document owner:', 'review date') onto body text, and
stripInternalImageDataBlocks compacts excerpts to a single line before
stripLowYieldLines runs — so the control-line filter deleted whole clinical
lines when they carried threshold values but no clinical keyword. Shrunken
counterexample: 'The Glasgow Coma Scale ranges from 3 to 15 with 1 or below
indicating severe head injury. Document owner: Pharmacy Department.'
sanitized to an empty string.
The line-level heuristics now get the same clinicalThresholdSignalPattern
rescue the fragment-level heuristics received in the original H2 fix: a line
carrying unit-bearing figures, ranges, or comparatives is never dropped by the
control-line/source-marker rules. Pure control lines without clinical values
are still removed (pinned by test).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>Adds fast-check (dev dependency) and three property-test files wired into the existing vitest suite: - property-numeric-token-preservation: no unit-bearing numeric token (doses, ranges, percentages, comparatives) ever disappears through clinicalProseUsefulness, sourceTextForDisplay, sourceTextForModel, or sourceTextForVerbatimQuote, across generated clinical prose with injected provenance/control/banner noise. This suite caught the line-level H2 residue fixed in the previous commit. - property-chunking: chunkTextWithOverlap terminates for any size/overlap combination including overlap >= chunkSize (audit M17 region), loses no characters (order-preserving subsequence check tolerant of overlap duplication), and invents nothing (every chunk is a contiguous run of the input). Generators respect removePageNoise's documented line contracts so the assertions target the chunker, not the noise filter. - property-accessible-table: normalizeAccessibleTable always yields a rectangular grid, never invents or loses numeric values, preserves row counts for first-cell-anchored rows, flags ambiguous clinical tables low-confidence with the raw grid preserved 1:1, and the low-confidence caveat survives both formatAnswerForClipboard and formatWardNote (audit H4/M8/M16 invariants), with a non-vacuity canary. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…log; record operator approvals The document-admin/ directory (document-drawer.tsx, label-helpers.ts, index.ts) was an unwired leftover shadowed by the live document-admin.tsx file in module resolution — nothing imported it. The process-hardening Phase-3 log now reflects that #250/#251 landed and the admin cutover is finished. docs/archive/operator-decisions-2026-07-06.md records the operator's approval to apply the two pending live migrations (M13, storage_cleanup_jobs index reconcile) and deploy the indexing-v3-agent edge function from any live-connected session. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XPVNBVo4cg9PEYtNhJZBQY
All 21 findings (H1-H4, M1-M17) from the 2026-07-01 audit verified closed on current main; H3 closed by PR #118 supersession. Documents the eval debt for the sanitizer fix (eval:quality --rag-only needs live keys) per the standing gates. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…mp-final # Conflicts: # src/components/ClinicalDashboard.tsx # src/components/clinical-dashboard/document-admin/document-drawer.tsx # src/components/clinical-dashboard/settings-dialog.tsx
One small step for each open item from the universal-search workstream
(docs/rag-hybrid-findings-and-todo.md items 17-25):
- Item 17 (alias promotion blocked by redaction): weak-search misses now
store RET-H4-safe candidate aliases — canonical terms from the curated
clinical vocabulary that the query matched (output text comes from the
fixed vocabulary table, never the raw query), via new
queryVocabularyAliasesForStorage. Raw tokens still require
RAG_PERSIST_RAW_QUERY_TEXT.
- Item 19 (demo fallback masks live failures): the shared fallback choke
point (nonProductionSupabaseDemoFallbackReason) now console.warns loudly,
naming the env vars to check; behaviour and headers unchanged.
- Item 20 (governance-weighting guard): verified already covered by the
existing keys-free structural test in retrieval-selection.test.ts —
marked done in the findings doc.
- Item 21 (gate recalibration): synthetic_similarity_count and
text_or_relaxation_used now persist into rag_retrieval_logs.metadata
(they were computed but dropped by the telemetry whitelist), so the
recalibration has data to work from.
- Owner-auth e2e: new universal-search-owner-live.test.ts signs in with the
E2E password user via supabase-js and exercises the real route handler
with a genuine bearer token; skips cleanly when live env is absent
(browser-login coverage is not feasible — header sign-in is
magic-link/OAuth only).
- Cross-mode chips now show live counts ("Forms (2)") from the universal
typeahead response, only when fresh results exist for the exact query.
- Items 18 (index-unit HNSW/ef_search), 22 (registry-to-corpus embedding),
23 (finding #11 Phase 2), 24 (OCR dropped letters), 25 (latency):
upgraded from vague notes to concrete measured/stepped specs in the
findings doc — each needs live keys or major scope, so a spec is the
honest smallest step.
Verified: verify:cheap green (1143 tests; live spec skips without keys),
format:check clean, ui-universal-search.spec.ts 3/3 against a live
demo-mode dev server (npm run ensure now works in this container thanks to
the upstream EAFNOSUPPORT fix).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011QiyE8jMm7VnrtknHF6jnJWhen authorizationHeader changes (sign-in, sign-out, or token refresh), clear cached result groups so the dropdown shows loading instead of stale results from the previous access tier until the refetch completes.
Read-only live profiling (explain_retrieval_rpc + direct EXPLAIN ANALYZE via MCP; profile:retrieval's underlying RPC — no local Supabase credentials). Headline findings: table-facts text RPC already at 6.75s (unindexable trigram OR-disjunct, ~linear growth); index-units hybrid has no vector arm (and no HNSW index); ef_search=40 silently caps every vector arm below its LIMIT (measured 40 vs 72); ~5GB of HNSW on a 256MB-buffer instance; 10-14 RPC fan-out per cold request. Ranked mitigation list included; all changes held for eval-gated follow-up work. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…raction
PyMuPDF get_text(sort=True) splits a dose in a narrow table cell across
lines ('12.5\nmg'); the <=2-char debris rule then deleted the unit line,
indexing a unitless dose. removePageNoise now rejoins a unit-only line
(mg, mcg, mL, IU, %, ...) to a preceding digit-ending line before
filtering. A lone unit with no preceding number is still dropped, and
page footers are never merged into.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>…ract comment Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…operty-tests # Conflicts: # docs/process-hardening.md
…sign Replace the rigid five-column pill grid with a wrap-friendly layout, add shortLabel support for long pathway names, and restyle the services shortcuts section with a subtle eyebrow title. Co-authored-by: Cursor <cursoragent@cursor.com>
Full state model of documents x ingestion_jobs x indexing_v3_agent_jobs x index generations: legal composite states, writer x transition matrix, and crash-window analysis for all four writers (worker, edge agent, API routes, ops scripts). Violations found by 7 scoped race-hunter agents (one per writer x transition group), consolidated into 24 claims and re-derived by an independent adversarial verifier: 24/24 confirmed (5 narrowed, 0 refuted). Seven are deterministic - no concurrency required - including: aborted DELETEs poison the storage-cleanup ledger so the janitor destroys live documents' storage (R11); retrying a failed job of an indexed doc destroys its live committed index (R15); every successful reindex permanently strands the prior image generation (R12); recovery supersede silently cancels queued reindexes (R22). Root concurrency enabler: no lease heartbeat (R1), making every >45-min job multi-master. Ranked phase-3 fix backlog included; fixes HELD until the db-reliability branch merges. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…generator fixes, session hook Follow-up to PR #320's search page review, addressing the remaining items: - Services navigator: stop silently rendering fixture records when the registry is unauthorized or errored - show the same session-expired / load-error notices as the services home and detail pages. Demo mode is unaffected (the registry API serves fixtures as status ready). - Documents flow: findEvidence no longer borrows another document's fixture evidence, so deep links to documents without extracted evidence render an explicit "No extracted evidence" state in the reader hit panel and a dedicated notice page on the evidence detail route. - Differentials export parser: drop the markdown preamble section that became a bogus "# Scenario Presets" preset and "# Red Flag Flows" flow, and drop bare-number field-weight rows from the search alias table; cleaned the checked-in snapshot to match and added parser regression tests. Runtime loader filters from #320 remain as defence in depth. - Differentials search results: rank the real catalogue with rankDifferentialRecords/searchPresentationWorkflows when a query is present (the acute-confusion walkthrough remains the empty-query demo), and reword the demo-content notice accordingly. - Forms results: inert mock controls (secondary tabs, refine rail, view full pathway, mobile filters) are now disabled with "Coming soon" affordances matching the documents page; "View all forms" links to /forms and "Open Form 4A" links to the transport order form. - Favourites: drop the key={query} remount so clearing a search no longer wipes set/type/view/sort selections, and span the empty row correctly on both sides of the lg breakpoint. - Deleted the unused ServicesNavigatorPreview component (no importers, hardcoded overflow badge, fixture-only search). - Added a web-only SessionStart hook that installs Node 24 (the repo is engine-strict node 24.x) into a cached location and runs npm ci when node_modules is missing, so remote sessions are productive immediately. - Lint: removed the unused AnswerEmptyState onPickSample prop and two unused type imports; added the derived canUsePrivateApis to the DocumentViewer fetch effect deps (no behavioural change - its inputs were already dependencies). - Documented the answer-thread Back-button URL/state question in docs/process-hardening.md as an open product decision with a guardrail. Verified with typecheck, lint, vitest (1142 passing), format:check, and npm run verify:ui (106 chromium Playwright tests passing). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rc3tTjs65D4gFBuCQhZGs
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…n policy check:drift generalizes search_schema_health()'s single-hash approach: a service-role schema_drift_snapshot() RPC (migration 20260706200000, prepared NOT applied) returns the normalized live inventory of every function (comment/whitespace-stripped pg_get_functiondef md5 + sorted ACLs), index, RLS policy, table shape, constraint, trigger, view and bucket, compared against supabase/drift-manifest.json — generated by drift:manifest, which replays schema.sql from scratch into a Docker supabase/postgres container (so replayability is re-proven on every regeneration). Known divergence lives in a 124-entry reasoned allowlist; offline halves (manifest freshness sha256, migration<->schema.sql parity, engine unit tests) run in verify:cheap. Baseline three-way audit (live vs schema.sql vs migration chain, 166 divergent keys, all classified): schema.sql was not from-scratch replayable (document_index_units ordering — fixed); 15 worker-written columns existed only on live (codified in 20260707000000 with the live-only functions/triggers/constraints/reloptions, idempotent and byte-aligned so live apply is a no-op); 20260703030000 is recorded as applied on live but its effects are absent; schema.sql text realigned to migration-chain truth for 4 functions and 6 policies. DR rehearsal: schema restore measured ~19s; search_schema_health ok and all four hybrid retrieval RPCs proven on the restored copy with seeded vectors; runbook with RPO/RTO and the did-not-survive list in docs/disaster-recovery-runbook.md. Expand/contract policy for retrieval tables added to docs/supabase-migration-reconciliation.md. Live project was read-only throughout; both new migrations await an approved supabase db push. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Use isUsableBrowserSupabaseKey and placeholder detection so CI with placeholder-ci-anon-key never runs the live route. When credentials are present but Supabase rejects sign-in, warn and return instead of failing the unit suite. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Search pages follow-up: registry error states, no-evidence handling, generator fixes, session hook
Finish ClinicalDashboard admin decomposition: SettingsDialog + dashboard-nav cutover, dead-code cleanup
fix(chunking): keep dose units wrapped onto their own line by PDF extraction
…hm-ryrps7 Search follow-ups: privacy-safe alias capture, telemetry persistence, loud demo fallback, owner-auth e2e, live chip counts
Ingestion concurrency + scale review (phases 1-2); fixes held for db-reliability
…operty-tests # Conflicts: # docs/process-hardening.md
…s' into claude/audit-sweep-property-tests
Demo evidence matches rename the pills section from Recent work; keep the geometry assertions unchanged. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Audit re-triage (all 21 closed), line-level H2 sanitizer fix, fast-check property suite
Mode home pills titles moved from h2 to eyebrow paragraphs in the pathway-pills redesign. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…k text Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…edesign fix(ui): services pathway pills overflow and section redesign
* feat(ui): mode-param redirects, cross-mode links, source-preview popover, medication badges - Redirect /?mode=favourites and /?mode=differentials to their standalone routes preserving q/focus/run query params; add matching Playwright tests - Add CrossModeLinksSection component and cross-mode-links/differentials libs; show in ClinicalDashboard after document search - Add SourcePreviewPopover component fixing missing-module build error (answer-content.tsx already imported it); fix click-outside anchorRef race - Add clinical-badge.tsx and medication-badges.ts with badge logic + unit tests - standalone /applications route now uses desktopSearchPlacement=hero - differentials route passes run param; DifferentialsHomePage respects it - Update global search shell, sidebar, answer surfaces, source-actions, medications API, and prescribing workspace for this feature set - Expand ui-smoke and ui-tools Playwright coverage for new routing * test(ui): assert cross-mode library links render inside answer surface Lock in the inline placement contract so the strip stays directly below answer content rather than at the page footer. Co-authored-by: Cursor <cursoragent@cursor.com> * ci: retrigger checks after billing fix Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(ci): remove duplicate cross-mode smoke test and run Prettier Merge left two identically named Playwright tests in ui-smoke.spec.ts; keep the answer-surface placement assertion. Format six files that failed format:check on CI. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(ui): wire /applications hero search and correct mode-button e2e assertions Pass modeHomeDesktopComposerSlotId and URL query into the standalone applications launcher so the shared global search portals into the hero. Fix ui-tools search-route coverage to assert each mode's own toggle (Forms, Favourites, Differentials) instead of always Mode Services. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * style: run Prettier on launcher page and ui-tools spec (fixes verify format check) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(ui): sync /applications launcher with global search context Read the shell query from SearchCommandProvider so typing in the shared composer live-filters the tools grid on /applications. Drop /applications from tablet hero-centering coverage (wider hub layout) and remove the /?mode=favourites hero-sizing case now that it redirects to the command library surface. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(applications): sync live search from global composer on /applications - Only pass controlled query prop when URL has ?q= so SearchCommandProvider can drive filtering when the user types in the shared composer - Drop /applications from mobile centering loop (tools hub layout differs) - Drop /favourites from tablet centering loop (command library layout differs) Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * style: format applications page for Prettier Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
…or merged schema.sql
Updates to Preview Branch (copilot/fix-merge-issue) ↗︎
Tasks are run on every commit but only new migration files are pushed.
❌ Branch Error • Tue, 07 Jul 2026 05:40:43 UTC View logs for this Workflow Run ↗︎. |
BigSimmo
marked this pull request as ready for review
July 7, 2026 05:36
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR #343 was blocked by a single merge conflict caused by a parallel commit (
aef8824) landing onmainafter the PR branched, updating the same items (18–21) indocs/rag-hybrid-findings-and-todo.md.Changes
Conflict resolution (
docs/rag-hybrid-findings-and-todo.mditems 18–21):main's versions (19 & 20 marked ✅ done; 18 gained concrete measurement plan)main's "DATA NOW FLOWING" telemetry update and incorporated the PR's full RC9 consumer audit +deriveConfidencefix noteDrift manifest (
supabase/drift-manifest.json): updatedschema_sha256to match the mergedschema.sql. The merge auto-merged additional columns frommain's migrations (e.g.document_images.caption_confidence,document_index_quality.anchor_coverage), changing the schema hash; the stale hash causedtests/drift-detection.test.tsto fail.Verification
npm run verify:cheap— 1237 tests pass, 0 failuresnpm run verify:uiwhen UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changednpm run verify:releasebefore release or handoff confidence claimsnpm run format:checknpm run eval:retrieval:quality(must stay 23/23) 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