Skip to content

fix: Implement audit design fixes and fallback improvements - #1351

Merged
cursor[bot] merged 12 commits into
mainfrom
audit-design-fixes-clean
Jul 28, 2026
Merged

fix: Implement audit design fixes and fallback improvements#1351
cursor[bot] merged 12 commits into
mainfrom
audit-design-fixes-clean

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 28, 2026

Copy link
Copy Markdown
Owner

Resolves missing error boundaries and accessibility issues identified in the UI audit.

  • Adds route error boundary placeholders for unhandled search-app routes
  • Adjusts EmptyState to use live='polite'
  • Throttles Retry buttons on signed images and lightbox views
  • Implements motion-reduce:animate-none for fallback page skeletons and answer status transitions
  • Generates smarter zero-result query suggestions to avoid rephrasing boolean searches.

Summary by CodeRabbit

  • New Features

    • Added clearer “not found” pages for missing documents and differentials with return links.
    • Added structured “Copy Diagnostics” actions on error screens.
    • Added query suggestions to help recover from no-results searches.
  • Bug Fixes

    • Improved signed-image and lightbox retry behavior by throttling repeated retries and showing “Retrying...” progress.
    • Updated unavailable tables/diagrams fallback to show a consistent empty state.
    • Missing documents now trigger the proper not-found boundary.
  • Accessibility & UX

    • Improved reduced-motion support and skeleton animations.
    • Updated live-region behavior for empty states.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 6 minutes

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

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

Run ID: fc75f012-69fc-409b-a632-4b7a34222d02

📥 Commits

Reviewing files that changed from the base of the PR and between fe22726 and b003722.

📒 Files selected for processing (3)
  • src/app/(search-app)/differentials/not-found.tsx
  • src/app/(search-app)/documents/[id]/not-found.tsx
  • tests/ui-smoke.spec.ts
📝 Walkthrough

Walkthrough

Adds route-specific not-found and error pages, clipboard diagnostics for error states, throttled image retries, query suggestions for empty search results, updated empty-state accessibility, and reduced-motion-aware UI feedback.

Changes

Error resilience and interface feedback

Layer / File(s) Summary
Route-level error and empty states
src/app/(search-app)/**/error.tsx, src/app/(search-app)/**/not-found.tsx, src/app/(search-app)/documents/[id]/page.tsx, src/components/ui-primitives.tsx, src/components/document-viewer/document-rail-panels.tsx
Adds route error boundaries, document and differential not-found states, 404 handling, and standardized EmptyState fallbacks.
Diagnostic copying in error surfaces
src/app/global-error.tsx, src/components/route-error-boundary.tsx
Adds structured diagnostic payload copying with success, failure, timeout, and cleanup handling.
Dashboard retry and query feedback
src/components/clinical-dashboard/search-utils.ts, src/components/ClinicalDashboard.tsx, src/components/clinical-dashboard/image-lightbox.tsx, src/components/clinical-dashboard/signed-image.tsx, src/components/clinical-dashboard/answer-status.tsx
Adds zero-result query suggestions, throttled image retries, retry feedback, and reduced-motion transition handling.
Loading animation accessibility
src/components/mode-home-page-skeleton.tsx
Adds fade-in animations to page skeletons and disables them for reduced-motion users.
Not-found smoke coverage
tests/ui-smoke.spec.ts
Updates missing-document assertions to verify the segment-level not-found boundary and library return link.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DocumentPage
  participant PublicApi
  participant NextNotFound
  participant DocumentNotFound
  DocumentPage->>PublicApi: load document details
  PublicApi-->>DocumentPage: return 404 PublicApiError
  DocumentPage->>NextNotFound: call notFound()
  NextNotFound->>DocumentNotFound: render missing-document state
Loading

Possibly related PRs

Suggested reviewers: claude

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only includes a brief summary and omits required verification, risk/rollout, governance, and notes sections from the template. Add the Summary, Verification, Risk and rollout, Clinical Governance Preflight, and Notes sections, including relevant checkboxes or a verification-not-run note.
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the PR’s main theme of audit-driven fixes and fallback/accessibility improvements.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

@supabase

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

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

CI triage

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

  • Production 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 #6430 (success).

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

@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: 47f69ffeba

ℹ️ 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/search-utils.ts
Comment thread src/components/route-error-boundary.tsx Outdated
Comment thread src/app/(search-app)/differentials/not-found.tsx
Comment thread src/app/(search-app)/documents/[id]/not-found.tsx
@BigSimmo

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. 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. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. 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. More of your lovely PRs please.

Reviewed commit: 47f69ffeba

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

cursoragent and others added 5 commits July 28, 2026 16:06
Fix EmptyState prop rename (action → actions) on not-found routes and
re-home the DocumentViewer empty-tables EmptyState onto DocumentViewerRail
after the #1311 extraction so the branch merges cleanly with main.

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>
@cursor
cursor Bot enabled auto-merge (squash) July 28, 2026 17:23

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 6

🧹 Nitpick comments (2)
src/components/clinical-dashboard/image-lightbox.tsx (1)

40-40: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a regression test for the retry throttle.

Use fake timers to verify that a second click does not call retry() and that the control becomes available after two seconds. Cover the analogous SignedImage path as well.

Based on the PR objective to add targeted tests for behavior changes.

Also applies to: 51-57

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/clinical-dashboard/image-lightbox.tsx` at line 40, Add
regression tests around the retry throttle in the image lightbox, using fake
timers to verify a second click does not invoke retry() and that the retry
control becomes available after two seconds. Cover both the primary image path
and the analogous SignedImage path, targeting the retryDisabled state and its
associated click behavior.
src/components/clinical-dashboard/search-utils.ts (1)

319-345: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add focused tests for suggestion ordering and edge cases.

Cover blank input, long queries, quoted phrases, contractions, boolean operators with extra whitespace/punctuation, and the three-item limit.

Based on the PR objective to add targeted tests for behavior changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/clinical-dashboard/search-utils.ts` around lines 319 - 345,
Add focused tests for generateQuerySuggestions covering blank and
whitespace-only input, long queries, quoted phrases, contractions, boolean
operators with extra whitespace or punctuation, and ensuring results never
exceed three items. Assert exact suggestion ordering and expected edge-case
behavior, including that contractions are handled distinctly from quoted
phrases.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/app/`(search-app)/differentials/[id]/not-found.tsx:
- Around line 15-17: Update the Link in the not-found page to derive its href
from the repository’s existing app-mode, tools-catalog, or universal-search
route source instead of the hardcoded "/differentials" path. Preserve the
current destination and Link styling while reusing the established route symbol.

In `@src/app/`(search-app)/documents/[id]/not-found.tsx:
- Around line 15-17: Update the Link destination in the not-found page to use
the repository’s existing shared route source for the document library instead
of the hardcoded "/documents" path. Preserve the current link styling and label
while referencing the established route symbol used for internal navigation.

In `@src/app/global-error.tsx`:
- Around line 22-34: Update handleCopyDiagnostics to guard against an
unavailable navigator.clipboard and catch writeText failures, setting copied
only after a successful write. Track the reset timeout, clear any existing
timeout before scheduling a new one, and preserve the two-second reset behavior
for repeated clicks.

In `@src/components/clinical-dashboard/search-utils.ts`:
- Around line 331-337: Update the quote and boolean detection in the
search-suggestion logic around trimmed and upperQuery to use token-aware
parsing: identify paired quote tokens rather than apostrophes in contractions,
recognize AND/OR/NOT at token boundaries despite repeated whitespace or
punctuation, and ignore operators inside quoted text. Preserve the existing
suggestion messages and behavior for valid detected cases.

In `@src/components/document-viewer/document-rail-panels.tsx`:
- Around line 243-247: Update the EmptyState title in the document rail panels
to retain the “clinically useful” qualifier, matching the existing body text and
accurately describing the state when auditImages still contains retained tables
or diagrams.

In `@src/components/route-error-boundary.tsx`:
- Around line 49-61: Update handleCopyDiagnostics to guard clipboard
availability and handle writeText rejections without unhandled promises,
providing the existing user-facing fallback behavior where appropriate. Store
the copied-state reset timeout identifier, clear any previously scheduled timer
before creating a new one, and retain the two-second reset after successful
copying.

---

Nitpick comments:
In `@src/components/clinical-dashboard/image-lightbox.tsx`:
- Line 40: Add regression tests around the retry throttle in the image lightbox,
using fake timers to verify a second click does not invoke retry() and that the
retry control becomes available after two seconds. Cover both the primary image
path and the analogous SignedImage path, targeting the retryDisabled state and
its associated click behavior.

In `@src/components/clinical-dashboard/search-utils.ts`:
- Around line 319-345: Add focused tests for generateQuerySuggestions covering
blank and whitespace-only input, long queries, quoted phrases, contractions,
boolean operators with extra whitespace or punctuation, and ensuring results
never exceed three items. Assert exact suggestion ordering and expected
edge-case behavior, including that contractions are handled distinctly from
quoted phrases.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 848da7e2-ef63-4cd7-99f5-32a2fcd2eb71

📥 Commits

Reviewing files that changed from the base of the PR and between dee52de and ed39e60.

📒 Files selected for processing (15)
  • src/app/(search-app)/differentials/[id]/not-found.tsx
  • src/app/(search-app)/documents/[id]/not-found.tsx
  • src/app/(search-app)/dsm/error.tsx
  • src/app/(search-app)/formulation/error.tsx
  • src/app/(search-app)/medications/error.tsx
  • src/app/(search-app)/therapy-compass/error.tsx
  • src/app/global-error.tsx
  • src/components/clinical-dashboard/answer-status.tsx
  • src/components/clinical-dashboard/image-lightbox.tsx
  • src/components/clinical-dashboard/search-utils.ts
  • src/components/clinical-dashboard/signed-image.tsx
  • src/components/document-viewer/document-rail-panels.tsx
  • src/components/mode-home-page-skeleton.tsx
  • src/components/route-error-boundary.tsx
  • src/components/ui-primitives.tsx

Comment thread src/app/(search-app)/differentials/[id]/not-found.tsx Outdated
Comment thread src/app/(search-app)/documents/[id]/not-found.tsx Outdated
Comment thread src/app/global-error.tsx Outdated
Comment thread src/components/clinical-dashboard/search-utils.ts Outdated
Comment thread src/components/document-viewer/document-rail-panels.tsx
Comment thread src/components/route-error-boundary.tsx Outdated
cursoragent and others added 2 commits July 28, 2026 17:33
Safety and config checks failed on a transient npm ci network abort;
Build/Unit/Static already passed on this tip.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Move differentials not-found to the real segment ancestor, call notFound()
for document 404s, wire zero-result query suggestions, harden clipboard
copy diagnostics, and use shared mode home hrefs for recovery links.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
src/components/ClinicalDashboard.tsx (1)

3564-3564: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a focused regression test for zero-result suggestions.

Cover both boolean queries and ordinary natural-language queries so the boolean-specific guidance remains protected.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/components/ClinicalDashboard.tsx` at line 3564, Add a focused regression
test for the zero-result response path in ClinicalDashboard, covering both
boolean queries and ordinary natural-language queries. Assert that the generated
response includes the appropriate query suggestions and preserves
boolean-specific guidance for boolean inputs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/components/ClinicalDashboard.tsx`:
- Line 3564: Add a focused regression test for the zero-result response path in
ClinicalDashboard, covering both boolean queries and ordinary natural-language
queries. Assert that the generated response includes the appropriate query
suggestions and preserves boolean-specific guidance for boolean inputs.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 0d70ff3b-84c1-4d4c-853e-2875d26a2aa5

📥 Commits

Reviewing files that changed from the base of the PR and between ed39e60 and 412a802.

📒 Files selected for processing (8)
  • src/app/(search-app)/differentials/not-found.tsx
  • src/app/(search-app)/documents/[id]/not-found.tsx
  • src/app/(search-app)/documents/[id]/page.tsx
  • src/app/global-error.tsx
  • src/components/ClinicalDashboard.tsx
  • src/components/clinical-dashboard/search-utils.ts
  • src/components/document-viewer/document-rail-panels.tsx
  • src/components/route-error-boundary.tsx
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/app/(search-app)/documents/[id]/not-found.tsx
  • src/components/route-error-boundary.tsx
  • src/app/global-error.tsx
  • src/components/clinical-dashboard/search-utils.ts
  • src/components/document-viewer/document-rail-panels.tsx

cursoragent and others added 3 commits July 28, 2026 18:13
Missing documents now call notFound() instead of DocumentViewer’s
“Source unavailable” panel; update the chromium smoke assertion.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
EmptyState titles render as paragraphs; smoke DomIntegrity requires
exactly one h1, so document/differential not-found fallbacks now use an
explicit heading while keeping polite status announcement.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Replace EmptyState paragraph titles so DomIntegrity’s single-h1 contract
passes on document and differential missing-resource fallbacks.

Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@cursor
cursor Bot merged commit c2ec2d7 into main Jul 28, 2026
19 checks passed
@cursor
cursor Bot deleted the audit-design-fixes-clean branch July 28, 2026 19:05
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