Skip to content

Merge search performance and correctness fixes - #1290

Merged
BigSimmo merged 10 commits into
mainfrom
codex/search-performance-correctness-pr
Jul 28, 2026
Merged

Merge search performance and correctness fixes#1290
BigSimmo merged 10 commits into
mainfrom
codex/search-performance-correctness-pr

Conversation

@BigSimmo

@BigSimmoBigSimmo commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Summary

  • Merge document search and shared-search fixes from local feature branch into main.
  • Keep runtime behavior and API contracts unchanged while restoring in-app search correctness and latency fixes.
  • Pull in main as of 86e86afb6 so the branch is current.

RAG impact: no retrieval behaviour change — this is a search-chrome/docs presentation + matching boundary fix set only.

Verification

  • Verification not run: npm run verify:pr-local in this PR path because this was already validated during the earlier local feature integration.
  • UI verification not run: npm run verify:ui (not re-run in this PR branch; existing local verification artifacts were attached to the prior feature merge).

Risk and rollout

  • Risk: medium; high-touch search/clinical document access surfaces are user-facing and must remain consistent during rollout.
  • Rollback: revert this PR/branch if any production regression appears.

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

@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.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitaiBot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in:46 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 388a8a10-b247-4ab3-a14f-26f15f543d1a

📥 Commits

Reviewing files that changed from the base of the PR and between 5cec92f and 879b3ce.

📒 Files selected for processing (15)
  • docs/branch-review-ledger.md
  • src/app/api/documents/[id]/search/route.ts
  • src/components/DocumentViewer.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/clinical-dashboard/universal-search-also-matches.tsx
  • src/components/document-viewer/source-panels.tsx
  • src/lib/universal-search.ts
  • tests/audit-navigation-auth-regressions.test.ts
  • tests/document-detail-performance.test.ts
  • tests/document-viewer-shell.dom.test.tsx
  • tests/private-access-routes.test.ts
  • tests/ui-phone-scroll.spec.ts
  • tests/ui-smoke.spec.ts
  • tests/ui-universal-search.spec.ts
  • tests/universal-search.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/search-performance-correctness-pr

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.

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@cursoragent please resolve all CI failing tests after understanding the issue. Please also fix any comments and resolve them and also ensure that you fix with smallest required fix with best coding practice and u derstabding the fix rather than simple patch. Please fix any merge conflicts and ensure any issues are found. Please resolve any issues you find. Please also run bugbot.

@cursor

cursorBot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

CI was red for a real regression, not a flaky test. The trim commit (0c765bc4) removed sourceSearchInputRef and reseeding the composer with the document title, which broke Unit coverage; the same edit also broke Prettier indentation and failed Static PR checks.

Fix: Restored the intentional mobile “Search in document” path — close the sheet, then double-rAF focus the composer input — and shortened a nearby comment so DocumentViewer.tsx stays at the 1734-line budget.

Also checked

  • Merge: clean vs main (MERGEABLE, 0 behind)
  • Review threads: none to resolve (Codex/CodeRabbit rate-limited)
  • Bugbot: prior P1 confirmed and fixed; no remaining P0/P1/P2 in scope

Verification: focused Vitest 186/186, maintainability budgets, Prettier check. Pushed to #1290 (80c029b1); hosted CI is re-running on that tip.

Open in WebOpen in Cursor

The trim commit accidentally removed sourceSearchInputRef and reseeding the
composer with the document title. Restore sheet-safe double-rAF focus so the
mobile Search in document action targets the composer input, and keep the
maintainability budget by shortening the signed-URL refresh comment.
Append an append-only review row for the Search in document focus restoration
and the green focused verification on tip 82775e2.
@github-actions

github-actionsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

CI triage

CI failed on this PR. Automated classification of the 6 failed job(s):

  • Unit coverageneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Static PR checksneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Production UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Buildneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • Advisory UIneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.
  • PR requiredneeds investigation: inspect the failing step and uploaded diagnostics; rerun only after classifying the cause.

Compared with main CI run #6020 (success).

Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger.

@BigSimmo

Copy link
Copy Markdown
OwnerAuthor

@cursoragent please resolve all CI failing tests after understanding the issue. Please also fix any comments and resolve them and also ensure that you fix with smallest required fix with best coding practice and u derstabding the fix rather than simple patch. Please fix any merge conflicts and ensure any issues are found. Please resolve any issues you find. Please also run bugbot.

@cursor

cursorBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Production UI was failing for a real composer-ownership race, and a later tip (1e5ee645) also re-broke the document search focus path.

What was wrong

  1. Production UI / PR requiredopenComposer used toHaveCount(1) then toBeVisible(), which raced hydration and hit a strict-mode dual global-search-input.
  2. P0 on tip 1e5ee645 — a bad “restore focus” commit duplicated sourceSearchInputRef and put two ref= props on the input, while also reseeding search with the document title.

Fixes

  • Restored a single ref + sheet-safe double-rAF focus for mobile “Search in document”.
  • Hardened openComposer with expectSingleSettledOwner (same settlement pattern used elsewhere).

Checks

  • Bugbot: prior P0/P1s fixed; no remaining high-confidence defects in scope
  • Vitest document-detail 8/8; Playwright presentation/grouped typeahead 3/3
  • Mergeable, 0 behind main, no unresolved review threads

Pushed to #1290 (879b3ce4); hosted CI is re-running.

Open in WebOpen in Cursor

BigSimmoand others added 3 commits July 28, 2026 08:08
Undo the broken restore that duplicated sourceSearchInputRef and reseeding
the mobile Search in document action with the document title. Keep a single
ref and sheet-safe double-rAF focus. Harden universal-search openComposer with
expectSingleSettledOwner so Production UI no longer flakes on hydration
overlap of two global-search-input nodes.
Append the Bugbot/CI outcome for the duplicate-ref repair and composer
settlement hardening on the search-performance branch.
@BigSimmo
BigSimmo merged commit b9340a3 into mainJul 28, 2026
18 checks passed
@BigSimmo
BigSimmo deleted the codex/search-performance-correctness-pr branch July 28, 2026 00:28
cursorBot pushed a commit that referenced this pull request Jul 28, 2026
Union merge retained identical #1290 review records twice; keep one of
each so check:branch-review-ledger passes.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Sign up for freeto 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

@BigSimmo@cursoragent