Skip to content

Fix service-related options placement and test sync#843

Merged
9 commits merged into
mainfrom
codex/design-audit-main-safe-20260718-separate
Jul 18, 2026
Merged

Fix service-related options placement and test sync#843
9 commits merged into
mainfrom
codex/design-audit-main-safe-20260718-separate

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Move service-related related-options controls out of the header and place them directly below service results to match expected layout behavior across variable page structures.
  • Align affected UI tests with current runtime (including Clinical Guide title variant and stabilized selectors) so they reflect live rendering while preserving regression coverage.

Verification

  • npx playwright test tests/ui-accessibility.spec.ts --project=chromium --workers=1
  • npx playwright test tests/ui-universal-search.spec.ts --project=chromium --workers=1
  • npm run test -- tests/site-map.test.ts tests/supabase-schema.test.ts

Risk and rollout

  • Changes are limited to navigator layout and existing UI test assertions; no database/schema/API logic is modified.
  • Keep old test expectations behind a follow-up if production DOM diverges further on unknown viewport/path combinations.

Clinical Governance Preflight

  • No clinical logic edits in this change.
  • No source, ingestion, or answer-generation behavior changes.
  • No production configuration, environment, or provider credential changes.
  • Rollback: Revert this branch/PR; previous behavior returns.

Summary by CodeRabbit

  • New Features

    • Improved search responsiveness for document facts and clinical content.
    • Fullscreen scope selection now uses available viewport height more effectively.
    • Service results and related matches display more consistently across loading and empty states.
  • Bug Fixes

    • Improved search-mode menu dismissal and focus behavior.
    • Standardized unavailable-answer messaging.
    • Corrected differential presentation redirects and handling of empty search queries.
    • Refined source-status and source-link display behavior.
  • Documentation

    • Updated site-map route descriptions and redirect patterns.

BigSimmo and others added 9 commits July 18, 2026 16:36
* fix: stop Escape focus restore from closing the app-mode menu

Scope dismiss deferred a focus restore onto the answer-options trigger.
When a mode-menu open landed in the same frame window, that restore stole
focus, blur-dismissed the menu, and flaked the Documents mode switch in
Production UI CI. Skip restore when the mode menu is open or focus already
moved, and wait for the scope popover to hide before opening the menu.

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

* fix(test): fail closed when scope popover does not dismiss

Only wait for the scope popover when it is visible, and let that wait
throw if dismissal times out so the mode-menu open cannot recreate the
Escape focus-restore race.

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

---------

Co-authored-by: Cursor Agent <cursoragent@cursor.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@supabase

supabase Bot commented Jul 18, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy due to reaching the limit of concurrent preview branches.
Go to Project Integrations Settings ↗︎ if you wish to update this limit.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The PR updates route documentation and query handling, adjusts search UI rendering and menu behavior, removes abort plumbing and coalescing telemetry from retrieval flows, and adds Supabase trigger/index changes with corresponding regression-test updates.

Changes

Routing and site-map alignment

Layer / File(s) Summary
Redirect and search parameter contracts
src/app/differentials/presentations/route.ts, src/app/page.tsx
The presentations redirect uses nullish-coalescing query selection, and home-page search parameters use an explicit typed shape.
Site-map generation and validation
scripts/generate-site-map.ts, docs/site-map.md, tests/site-map.test.ts, tests/audit-navigation-auth-regressions.test.ts
Presentations routes use [workflow-slug], factsheet descriptions are removed from generation, and related sitemap expectations are updated.

Search interface behavior

Layer / File(s) Summary
Result and error rendering
src/components/ClinicalDashboard.tsx, src/components/services/services-navigator-page.tsx
Answer errors use a consistent title, cross-mode matches are conditionally placed, and the right rail remounts across selection categories.
Header menu and fullscreen behavior
src/components/clinical-dashboard/master-search-header.tsx, playwright.config.ts
Fullscreen height, mode-menu blur handling, dropdown interaction, and header spacing are changed; reduced-motion configuration is reformatted without changing its value.
Search and service regression coverage
tests/audit-content-services-regressions.test.ts, tests/audit-navigation-auth-regressions.test.ts, tests/ui-tools.spec.ts, tests/ui-universal-search.spec.ts
Regression assertions cover updated source rendering, readiness gating, bottom-dock visibility, form-mode wording, and universal-search input.

Retrieval cancellation and memoization

Layer / File(s) Summary
Direct retrieval RPC calls
src/lib/rag-candidate-sources.ts, tests/rag-abort-signal.test.ts
Versioned and legacy retrieval RPCs use direct Promise-based calls without abortable RPC wrappers.
Shared classifier request handling
src/lib/rag.ts, tests/rag-classifier-memo.test.ts
Classifier memoization no longer awaits through caller signals, and callers no longer pass signal options; fallback reuse is tested.
Answer coalescing lifecycle
src/lib/rag.ts
Coalesced waiter and origination telemetry calls are removed while inflight cleanup remains.

Supabase migration and schema validation

Layer / File(s) Summary
Trigger and index migrations
supabase/migrations/*
Document title-word cleanup predicates use explicit comparisons, and document-table facts receive a GIN trigram index.
Migration metadata and schema assertions
supabase/drift-manifest.json, tests/supabase-schema.test.ts
Migration metadata and SQL-shape expectations are updated for the revised trigger, similarity guards, migration fixture, and index.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: codex

Suggested reviewers: copilot, cursoragent, claude

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: moving service-related options and syncing tests.
Description check ✅ Passed The description includes the key sections and most required context, though it doesn't follow the exact checklist-style verification template.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/design-audit-main-safe-20260718-separate

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

@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: 2

🧹 Nitpick comments (1)
supabase/migrations/20260714190000_document_table_facts_trgm_idx.sql (1)

1-11: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Consider CONCURRENTLY for the index creation if migrations are not transaction-wrapped.

Squawk flags that CREATE INDEX without CONCURRENTLY blocks writes. Since this index is intentionally temporary (dropped by the harden migration), the blocking window is brief. If your migration runner supports non-transactional execution, CREATE INDEX CONCURRENTLY IF NOT EXISTS would avoid write blocking. If migrations run inside transactions (common in Supabase), CONCURRENTLY cannot be used and this can be safely disregarded.

🤖 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 `@supabase/migrations/20260714190000_document_table_facts_trgm_idx.sql` around
lines 1 - 11, Update the document_table_facts_text_trgm_idx creation to use
concurrent index creation only if the migration runner executes migrations
outside transactions; otherwise retain the current non-concurrent CREATE INDEX
because PostgreSQL disallows CONCURRENTLY within transactional migrations.

Source: Linters/SAST tools

🤖 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/components/ClinicalDashboard.tsx`:
- Line 3651: Update the error title logic in ClinicalDashboard so only
answer-result errors use “Answer unavailable”; document and differential search
failures must retain a non-answer-specific title. Use the result-kind condition
surrounding the title to select the appropriate mode-specific label.

In `@tests/supabase-schema.test.ts`:
- Around line 1399-1401: Replace the tautological conditional assertion in the
relevant schema test with an unconditional assertion that verifies the expected
corrector content, or assert a distinct related property inside the guard;
ensure the test fails when the similarity-threshold statement is absent.

---

Nitpick comments:
In `@supabase/migrations/20260714190000_document_table_facts_trgm_idx.sql`:
- Around line 1-11: Update the document_table_facts_text_trgm_idx creation to
use concurrent index creation only if the migration runner executes migrations
outside transactions; otherwise retain the current non-concurrent CREATE INDEX
because PostgreSQL disallows CONCURRENTLY within transactional migrations.
🪄 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 Plus

Run ID: dc7e90aa-cee1-4c72-8ccb-4e1b513ad97a

📥 Commits

Reviewing files that changed from the base of the PR and between 7815204 and 714fe45.

📒 Files selected for processing (21)
  • docs/site-map.md
  • playwright.config.ts
  • scripts/generate-site-map.ts
  • src/app/differentials/presentations/route.ts
  • src/app/page.tsx
  • src/components/ClinicalDashboard.tsx
  • src/components/clinical-dashboard/master-search-header.tsx
  • src/components/services/services-navigator-page.tsx
  • src/lib/rag-candidate-sources.ts
  • src/lib/rag.ts
  • supabase/drift-manifest.json
  • supabase/migrations/20260714180000_patch_rag_and_corrector_scalability.sql
  • supabase/migrations/20260714190000_document_table_facts_trgm_idx.sql
  • tests/audit-content-services-regressions.test.ts
  • tests/audit-navigation-auth-regressions.test.ts
  • tests/rag-abort-signal.test.ts
  • tests/rag-classifier-memo.test.ts
  • tests/site-map.test.ts
  • tests/supabase-schema.test.ts
  • tests/ui-tools.spec.ts
  • tests/ui-universal-search.spec.ts

<EmptyState
icon={CircleAlert}
title={activeModeResultKind === "answer" ? "Answer unavailable" : "Search unavailable"}
title="Answer unavailable"

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep the error title mode-specific.

error is shared by document and differentials searches too, so those failures now display “Answer unavailable.” Restore a non-answer title for non-answer result kinds.

Proposed fix
- title="Answer unavailable"
+ title={activeModeResultKind === "answer" ? "Answer unavailable" : "Search unavailable"}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
title="Answer unavailable"
title={activeModeResultKind === "answer" ? "Answer unavailable" : "Search unavailable"}
🤖 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 3651, Update the error title
logic in ClinicalDashboard so only answer-result errors use “Answer
unavailable”; document and differential search failures must retain a
non-answer-specific title. Use the result-kind condition surrounding the title
to select the appropriate mode-specific label.

Comment on lines +1399 to +1401
if (corrector.includes("set pg_trgm.similarity_threshold = 0.3")) {
expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3");
}

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.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Tautological assertion provides no test coverage.

The if condition and the expect assertion check the exact same string ("set pg_trgm.similarity_threshold = 0.3"). If the string is present, the assertion trivially passes; if absent, the block is skipped. This effectively tests nothing. Either remove the conditional and assert unconditionally, or assert a different related property inside the guard.

♻️ Suggested fix
-      if (corrector.includes("set pg_trgm.similarity_threshold = 0.3")) {
-        expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3");
-      }
+      expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if (corrector.includes("set pg_trgm.similarity_threshold = 0.3")) {
expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3");
}
expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3");
🤖 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 `@tests/supabase-schema.test.ts` around lines 1399 - 1401, Replace the
tautological conditional assertion in the relevant schema test with an
unconditional assertion that verifies the expected corrector content, or assert
a distinct related property inside the guard; ensure the test fails when the
similarity-threshold statement is absent.

@BigSimmo BigSimmo closed this pull request by merging all changes into main in 5c3a0e5 Jul 18, 2026
@BigSimmo
BigSimmo deleted the codex/design-audit-main-safe-20260718-separate branch July 18, 2026 10:40
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.

1 participant