Skip to content

fix(search): close the loose ends left by the also-matches disclosure - #2727

Closed
BigSimmo wants to merge 5 commits into
mainfrom
claude/jolly-keller-vy36h2
Closed

fix(search): close the loose ends left by the also-matches disclosure#2727
BigSimmo wants to merge 5 commits into
mainfrom
claude/jolly-keller-vy36h2

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • The "Also in your library" tray dropped its match count from assistive tech at every width. The visible count carries aria-hidden with a comment saying the button's name should not read it twice, but that tray has no live region to say it once, and below sm the count is display: none anyway. An sr-only copy now carries it, so the closed control announces what it opens onto.
  • On phones the cross-mode panel said "Tap to open", because the lookup waited for the click there. That is the blind door the desktop path was deliberately built to avoid: the header could not state a count, and an empty tray was still offered. The lookup is now eager at every width and the no-match tray is dropped at every width. The cost is one extra cross-mode lookup per phone search.
  • The page thumbnails kept the 3px accent top bar that was removed from the best-match card, so the strip the owner asked to lose had simply moved down the page. Removed, leaving the hairline border.
  • One inline style={{ maxWidth }} in a design-scratch mockup became max-w-[30ch], putting the design-drift ratchet at 232 against its 233 ceiling. It had no headroom, so the next PR to add a legitimate inline style would have failed on a limit unrelated to it.
  • Two tests pinned the behaviour that was removed and were repointed rather than weakened: ui-stress required the tray to exist at 320px without ever mocking /api/search/universal (it passed only because the lazy phone path rendered a header regardless), and audit-navigation-auth-regressions asserted the exact (isWide || modeId === "answer" || expanded) gate.
  • One inbox request recorded, for the pr-required failures on the predecessor branch that were never explained. Local gates were green throughout and CI log access stayed blocked by the babysit marker, so the failing job was never read. The recorded next action is to unlock the marker and read the log before offering a cause.

Verification

  • npm run verify:pr-local — all 36 gates green including test (18,034 passed) and build.
    • The first build attempt failed on a torn .next/dev/types/routes.d.ts written by an interrupted dev server on 2026-09-06 (ontacts": never mid-file). Cleared .next/dev and rebuilt clean; not related to this diff.
  • Focused browser proof, Chromium: ui-universal-search 20 passed, ui-smoke + ui-stress 112 passed. The full Chromium suite is left to CI, which runs it on this change — the planner escalated to full only because the mockup file has no spec attribution.
  • npm run check:design-drift-ratchetinline style={{ }} attributes: 232 (ceiling 233).
  • Ward Flow advisory lane verified separately and clean: ui-ward-discharges 2 passed, ui-ward-morning 2 skipped by the documented owner-approved test.skip from MERGE 02. No change needed, no code touched.
  • npm run verify:ui — UI verification not run in full: superseded by the focused proof above plus CI's complete Chromium run on a non-draft PR.
  • Not applicable: eval:retrieval:quality, eval:rag, check:production-readiness, check:deployment-readiness.

Risk and rollout

  • Risk: Low, and concentrated in one place. The phone cross-mode lookup now runs on submit rather than on tap, which is one additional request per phone search on mobile data. Everything else is presentational or test-only.
  • Rollback: Single-commit revert of ad1b84b8; the three test commits stand or fall with it.
  • Provider or production effects: None. No Supabase, OpenAI, migration, or env change.
  • RAG impact: none — no retrieval, ranking, selection, or scoring surface is touched.

Clinical Governance Preflight

Not applicable. This change touches presentation and accessibility of the cross-mode suggestion tray only. No ingestion, answer generation, ranking, source rendering, document access, privacy, or clinical output behaviour changes.

Notes

  • The user chose the best-match card top bar for removal in an earlier turn; the page thumbnails were the same treatment one level down and were missed then.
  • The inbox request is merge-safe and applies to the canonical ledger via npm run issues:reconcile after this lands.

🤖 Generated with Claude Code

https://claude.ai/code/session_01KYV1sTeo2DHUyJBjzprTRU


Generated by Claude Code


Note

Low Risk
Changes are UI, cross-mode fetch timing on mobile, and query-state wiring for the also-matches tray—no auth, RAG, or data-path changes; extra universal search requests on phone are the main behavioral cost.

Overview
This PR finishes the Also matches / cross-mode tray work: it fixes a draft-vs-submitted query bug, makes phone behavior match desktop for counts and empty trays, and cleans up a11y and small UI drift.

Cross-mode lookup now follows the last submitted search, not the composer draft. ClinicalDashboard adds submittedModeQuery and a setModeSearchSubmitted(submitted, submittedText?) wrapper so typing in the bottom composer without Enter no longer drives universalAlsoMatchesQuery or replaces the tray while primary results still reflect the prior submission. Answer mode continues to use latestAnswerQuery; a new source-reading test locks the contract.

On phones, cross-mode search runs on submit (not on expand). universal-search-also-matches drops the narrow-screen deferral and "Tap to open" header; empty trays are omitted at every width so the closed row can show a real count. That adds one /api/search/universal call per mobile search. Related Playwright and audit tests are updated; ui-stress mocks universal search so the prescribing panel still appears at 320px.

Accessibility and polish: the "Also in your library" disclosure gets an sr-only match count (visible count stays decorative/aria-hidden). Document page preview thumbnails lose the 3px clinical accent top bar. A mockup inline maxWidth becomes max-w-[30ch] for the design-drift ratchet.

Process: an outstanding-issues inbox entry documents unexplained pr-required CI failures on the predecessor branch.

Reviewed by Cursor Bugbot for commit 2a327b1. Configure here.

…ind it

Four small follow-ups to the "Also matches" disclosure, each independent.

The "Also in your library" tray dropped its match count from assistive tech at
every width. The visible count carries aria-hidden with a comment saying the
button's name should not read it twice, but that tray has no live region to say
it once, and below sm the count is display:none anyway. An sr-only copy now
carries it, so the closed control announces what it opens onto.

On phones the same panel showed "Tap to open", because the cross-mode lookup
waited for the click there. That is the blind door the desktop path was
deliberately built to avoid: the header could not state a count, and an empty
tray was still offered. The lookup is now eager at every width and the no-match
tray is dropped at every width. The cost is one extra cross-mode lookup per
phone search.

The page thumbnails kept the 3px accent top bar that was removed from the
best-match card, so the strip the owner asked to lose simply moved down the
page. Removed, leaving the hairline border.

One inline style={{ maxWidth }} in a design-scratch mockup became max-w-[30ch],
which puts the design-drift ratchet at 232 against its 233 ceiling. It had no
headroom, so the next PR to add a legitimate inline style would have failed on
a limit unrelated to it.

Verified: lint, typecheck, drift ratchet 232/233. Focused browser proof on the
specs the planner attributes to these files; the full Chromium suite is left to
CI, which runs it on this change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYV1sTeo2DHUyJBjzprTRU
… now vanish

It requires the cross-mode panel to exist at 320px and to sit below the
medication results, but it never mocked /api/search/universal. That passed only
because the phone lookup was lazy, so the panel rendered a "Tap to open" header
whether or not anything was behind it. With the lookup eager the panel correctly
drops itself when the query has no cross-mode match, and the ordering assertion
went with it.

Mocks one documents-domain match for this test only, so the ordering guarantee
stays real rather than vacuous. The body is NDJSON, matching the endpoint: a
single JSON object parses to no groups and reproduces the same empty panel.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYV1sTeo2DHUyJBjzprTRU
…ained

The aggregate went red several times on a UI-only branch while every local gate
was green, and CI log access stayed blocked by the babysit marker for the whole
session, so the failing job was never read. Recorded with the next action, which
is to unlock the marker and read the log before offering a cause.

Inbox request only. It applies to the canonical ledger via issues:reconcile
after this lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYV1sTeo2DHUyJBjzprTRU
…at was removed

It asserted the exact `(isWide || modeId === "answer" || expanded)` gate, which
was the deferral that produced the phone blind door. Repointed at the eager gate,
at the empty-tray guard that now runs at every width, and at the three-way header
so the "Tap to open" arm cannot come back unnoticed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KYV1sTeo2DHUyJBjzprTRU
@supabase

supabase Bot commented Sep 7, 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 ↗︎.

@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 698d846d-f86a-4cf4-a94a-98daa1390afc


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-07T10:55:21.355722Z 3040e1e Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cursor

cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_6d7a3f49-4212-4ba7-a511-299a5452f816)

@chatgpt-codex-connector chatgpt-codex-connector Bot 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: 3040e1e092

ℹ️ 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 thread src/components/clinical-dashboard/universal-search-also-matches.tsx
@BigSimmo

BigSimmo commented Sep 7, 2026

Copy link
Copy Markdown
Owner Author

@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. The only repository destination is BigSimmo/Database, and the only branch destination is the pull request head branch claude/jolly-keller-vy36h2 at starting commit 3040e1e; never publish fixes to a detached or synthetic work branch and never create a stacked pull request. Use the authenticated GitHub connector to commit each approved fix to BigSimmo/Database:claude/jolly-keller-vy36h2, then verify that the pull request head contains the published commit before reporting success. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. For a fixed thread, reply with as the first line and as the second line. For a no-code disposition, use followed by . These result markers authorize the workflow to close that exact thread only after it verifies a fixed commit is the pull request head; a local-only commit is not a fix. If publication or verification fails, do not use either result marker, do not claim success, and leave the thread open with the blocker. If human input or new authorization is required, do the same. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 3040e1e092

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

…query

Editing the bottom composer on a result view calls setQuery alone: the
results and modeSearchSubmitted both stay as they were. The lookup was
keyed on that live query, so a paused draft fetched cross-mode matches
for a search the reader never ran, replaced the tray and its "N related
modes" count, and left those matches disagreeing with the primary cards
still on screen for the last submitted search.

The dashboard now holds the submitted query separately from the draft.
Every submission records the text it submitted, clearing the flag clears
the query with it, and an auto-run URL seeds it so a restored result view
is not blank. Answer mode is unchanged, since it already keyed off the
generated answer's query. Tools and Favourites never record a submission
and fall through to the draft, which is the only query they have.

Prescribing is deliberately left alone. Its medication list is itself
debounced against the same draft, so the tray following the draft agrees
with the cards above it there rather than contradicting them.

tests/universal-also-matches-submitted-query.test.ts pins the derivation,
that only the submission wrapper may write the submitted query, and that
every submission passes its text. 7 passed, and 113 passed across the 13
dashboard, seed, thread and also-matches suites.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0142trjgjRAP2GA9wzqoYUAE
@cursor

cursor Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_a52f1d99-96ed-4874-ab0e-744b0c54ca23)

@BigSimmo

Copy link
Copy Markdown
Owner Author

Consolidated into #2736 at db6376e. The complete original head 2a327b1 is retained as an ancestor, including its code, tests and audit requests. Closing this duplicate review/CI stream under the authorised consolidation; source branch retained. Current verification and remaining merge prerequisites are recorded on #2736. This closure does not claim that the successor is merged or that its required CI is green.

@BigSimmo BigSimmo closed this Sep 10, 2026
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