Skip to content

Refactor clinical KB search and UI flows - #111

Closed
BigSimmo wants to merge 11 commits into
mainfrom
codex/RAG_FIX
Closed

Refactor clinical KB search and UI flows#111
BigSimmo wants to merge 11 commits into
mainfrom
codex/RAG_FIX

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • Refactors Clinical KB search, mode-home, forms, differentials, document, and medication UI flows on codex/RAG_FIX.
  • Cleans up branch-sync conflict artifacts and stabilizes the affected UI smoke/stress tests.
  • Adds shared ModeHomeTemplate support, URL run=1 auto-run handling, and heading-level control for embedded mode-home panels.
  • Formats the touched source/test files after the handoff cleanup.

Verification

  • npm run verify:cheap
  • npm run verify:ui when UI, routing, styling, browser behavior, reduced-motion, or forced-colors behavior changed
    • Blocked before full-suite execution by local Next/Turbopack dev-server instability: repeated Turbopack panics and duplicate dev server startup attempts in dev-server.log.
    • Targeted Chromium checks passed:
      • node scripts/run-playwright.mjs tests/ui-smoke.spec.ts --project=chromium --grep "dashboard loads without page overflow at laptop|dashboard loads without page overflow at mobile-landscape|private mode unauthenticated dashboard gates real-mode search|prescribing workflow uses in-app medication routes|upload drawer exposes setup checklist and explicit upload labels" after fixes, with the final prescribing/upload subset passing after cold-route timeout adjustment.
      • node scripts/run-playwright.mjs tests/ui-tools.spec.ts --project=chromium --grep "differentials global search posts the standalone differentials mode"
      • node scripts/run-playwright.mjs tests/ui-stress.spec.ts --project=chromium --grep "desktop" reported the desktop stress test as passed, but the wrapper exited non-zero afterward when the dev server disappeared and left no failure artifact.
  • npm run verify:release before release or handoff confidence claims
  • npm run format:check
    • Fails on existing repository formatting debt outside this PR surface; touched source/test files were formatted with Prettier and npm run verify:cheap passed afterward.
  • npm run check:production-readiness when clinical workflow, privacy, environment, Supabase, source governance, or deployment behavior changed
    • Ran with provider keys cleared to avoid unapproved API/provider use. Supabase project checks passed for Clinical KB Database / sjrfecxgysukkwxsowpy; check failed only on missing OPENAI_API_KEY in that no-provider environment.
  • npm run check:deployment-readiness when deployment startup, hosting, or rollout behavior changed

Clinical Governance Preflight

  • 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

  • This PR is based on current origin/main and includes the previously pushed Refactor clinical KB search and UI flows work plus follow-up handoff stabilization commits.
  • No direct merge into main was performed from this local workflow.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot wasn't able to review this pull request because it exceeds the maximum number of files (300). Try reducing the number of changed files and requesting a review from Copilot again.

@BigSimmo
BigSimmo enabled auto-merge July 1, 2026 15:29
@BigSimmo
BigSimmo disabled auto-merge July 1, 2026 16:04
@BigSimmo
BigSimmo enabled auto-merge July 1, 2026 16:04
@BigSimmo BigSimmo closed this Jul 2, 2026
auto-merge was automatically disabled July 2, 2026 03:04

Pull request was closed

@BigSimmo
BigSimmo deleted the codex/RAG_FIX branch July 2, 2026 08:12
BigSimmo pushed a commit that referenced this pull request Jul 29, 2026
Resolves the `docs/outstanding-issues.md` conflict. Two independent causes:

1. Rows #98#105 diverged. `main` carries the newer text (PR #1377 landed
   "Done 2026-07-29" outcomes and rewrote several summaries); this branch
   carried the pre-#1377 wording. Took `main`'s rows wholesale — the branch
   made no edits to that range, it simply forked before them.

2. `#108`/`#109` were allocated twice. `main` used them for the verified-landed
   branch deletions and the shallow-clone finding; this branch had used the same
   two ids for the design-system token manifest and the `ui-overlap` flake. The
   `issues:next-id` marker has no concurrency protection, which is exactly the
   failure the branch's own PR notes predicted. Renumbered this branch's two rows
   to #110/#111 and bumped the marker to 112. No content was dropped from either
   side; all 111 rows are unique.

Also records #111 as done, since this branch is what fixes it: the ui-overlap
inset measurement now retries inside `toPass` with the 2px symmetry tolerance
and the assertions unchanged. Leaving it open with a "Next: apply the retry
shape" action would have re-queued work this PR already did.
BigSimmo pushed a commit that referenced this pull request Jul 29, 2026
Three review findings, all correct.

`openGuide` and the mode-menu retry both re-ran an action that had already
succeeded. `toPass` schedules another attempt whenever the inner assertion's
own deadline expires, which can happen a moment AFTER the click landed — so
under the contention these retries exist to tolerate:

- `openGuide` clicked a Settings trigger the modal was already covering, or
  reopened the phone menu on top of it, and timed out.
- the mode-menu retry clicked a TOGGLE a second time, closing a menu that had
  just opened, and could oscillate until the budget ran out — failing a UI that
  was working.

Both now return early when the thing they were about to produce already exists.

The mobile branch needed a second guard: a swallowed Settings click leaves the
phone menu OPEN, so `openMobileClinicalGuideMenu` on the retry would toggle it
shut and then fail to find Settings inside it. It now reuses an open menu and
only summons one when there is none. Without this the <768px branch could not
recover on retry at all, which is the branch the PR claims to fix.

Also moves #111 from Open items to Resolved / archive. The row recorded the
ui-overlap fix as done and simultaneously sat in the queue describing the test
as still flaking, so an operator reading the file as a work queue would have
scheduled the investigation again. The repo's own conventions say a resolved
item is archived, not left open with a done note.

verify:cheap exit 0 — Test Files 429 passed (429), Tests 4404 passed | 4 skipped.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvU8z73P6TXUXoYBqN5K1P
BigSimmo added a commit that referenced this pull request Jul 29, 2026
 (#1391)

Follow-ups to #1375 (Clinical Sky design system), which merged before these landed.

`text-4xs` was dead on main. #1375 retired the `--text-4xs` token, so Tailwind
emits no such rule and every remaining `text-4xs` class was a silent no-op with
the text falling back to inherited size. Two files carrying it landed from main
while #1375 was in flight and were dead on arrival. Repointed to `text-3xs`, the
10px floor, and guarded: the design-token contract now fails if any tracked file
under `src/` references the retired class outside a comment. Mockups are
deliberately not exempt — a dead utility breaks a mockup exactly as it breaks
production.

Six hydration races fixed at the source. In this app visible never implies
interactive: the server-rendered tree paints before React owns it, so a single
un-retried action asserted once is a coin flip under load. Every fix retries the
action together with the effect it should produce, so a swallowed first attempt
retries while a genuine regression still fails.

Both retries added to ui-smoke are idempotent, which review caught and which
matters more than it looks. `toPass` schedules another attempt whenever the
inner assertion's own deadline expires — which can happen after the click
already landed. Without a guard, `openGuide` clicked a Settings trigger the
modal was already covering, and the mode-menu retry clicked a TOGGLE a second
time, closing a menu that had just opened and oscillating until the budget ran
out. The mobile branch needed a second guard: a swallowed Settings click leaves
the phone menu open, so re-running `openMobileClinicalGuideMenu` would toggle it
shut and then fail to find Settings inside it — meaning the <768px branch could
not recover on retry at all.

The ui-overlap phone-inset measurement now retries inside `toPass` with the 2px
symmetry tolerance and the assertions byte-for-byte unchanged, so a genuinely
asymmetric header still fails once the retry budget is spent.

Documentation records that the intermediate font weights on the variable face
are deliberate rather than drift, and that redefining Tailwind's own leading
names silently retunes every existing call site.

Also resolves an `issues:next-id` double-allocation: #108/#109 were claimed
concurrently by two branches, so this branch's two rows are renumbered #110/#111
and the marker moved to 112. #111 is archived rather than left open, since this
change is what closes it.

RAG impact: no retrieval behaviour change — test robustness, two mockup class
names, and docs only; nothing under `src/lib/rag/**`, clinical-search,
ranking-config, the eval harness or the golden fixture is touched.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FvU8z73P6TXUXoYBqN5K1P
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.

3 participants