Merge component wiring and regression hardening fixes into main#813
Merge component wiring and regression hardening fixes into main#813BigSimmo wants to merge 11 commits into
Conversation
…in-merge-safe-final-20260718-resubmit
|
Updates to Preview Branch (codex/main-merge-safe-final-20260718-final) ↗︎
Tasks are run on every commit but only new migration files are pushed.
❌ Branch Error • Sat, 18 Jul 2026 06:36:06 UTC View logs for this Workflow Run ↗︎. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThe pull request updates RAG retrieval and Supabase query-correction infrastructure, adds handler-aware sitemap generation, revises service and forms interfaces, expands regression coverage, and refreshes repository documentation and tooling behavior. ChangesRAG retrieval and database scalability
Sitemap route discovery
Dashboard and mode interfaces
Documentation and repository tooling
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Unblock the design-audit merge stack by matching Playwright H1 expectations to the rendered Clinical Guide heading, serving service registry details in browser mocks, dropping reduced-motion-incompatible dock duration asserts, and falling empty presentation `query` values through to legacy `q`. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 4
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/lib/rag.ts (1)
2445-2468: 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy liftThread
args.signalthrough the remaining RAG helpers.
src/lib/rag.ts#L2445-L2468: passargs.signalintofetchEnabledRagAliases; the helper already supports aborts, but this call site drops them.src/lib/rag.ts#L2533-L2565andsrc/lib/rag.ts#L2800-L2852: add abort plumbing to the fast-path enrichment helpers and the parallel candidate/RPC helpers so aborted requests don’t keep doing Supabase work or cache results.🤖 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/lib/rag.ts` around lines 2445 - 2468, Thread args.signal through the RAG retrieval flow so aborted requests stop Supabase work and do not populate caches. In src/lib/rag.ts:2445-2468, pass args.signal to fetchEnabledRagAliases; in src/lib/rag.ts:2533-2565 and 2800-2852, propagate it through the fast-path enrichment and parallel candidate/RPC helpers; and in src/lib/rag-candidate-sources.ts:185-207, add the corresponding signal handling to the candidate-source helpers.
🤖 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 `@scripts/generate-site-map.ts`:
- Around line 397-407: Restore product route-handler placement by merging
handlers from productRouteHandlerPaths into the “Main product routes” entries in
scripts/generate-site-map.ts, while keeping them excluded from utility routes;
update tests/site-map.test.ts so the product-section assertion uses toContain
instead of requiring omission.
In `@supabase/migrations/20260717010000_harden_rag_scalability_patch.sql`:
- Around line 63-96: Scope the correction vocabulary RPC to the effective
retrieval tenant by adding owner and include-public parameters and applying
matching predicates to aliases, canonicals, and document-title words in
supabase/migrations/20260717010000_harden_rag_scalability_patch.sql:63-96 and
supabase/schema.sql:3520-3552. Pass the same retrieval scope through the callers
in src/lib/rag-candidate-sources.ts:263-266 and src/lib/rag.ts:2484-2490. Update
tests/supabase-schema.test.ts:1388-1406 to assert the scoped RPC parameters and
owner/public filters.
In `@tests/audit-navigation-auth-regressions.test.ts`:
- Line 129: Align the accessible dashboard H1 assertions on the intended heading
text, using “Clinical KB” consistently. Update
tests/audit-navigation-auth-regressions.test.ts:129-129,
tests/ui-accessibility.spec.ts:51-51, and tests/ui-smoke.spec.ts:870-870 and
1265-1265 so every source and browser assertion expects the same H1.
In `@tests/ui-tools.spec.ts`:
- Line 1623: Update mockAnswerDashboardApi in tests/ui-tools.spec.ts to return
matching service detail fixtures for non-form /services/... detail requests,
ensuring the direct service UI tests at the referenced usages receive a
successful response instead of 404 and can reach the asserted UI.
---
Outside diff comments:
In `@src/lib/rag.ts`:
- Around line 2445-2468: Thread args.signal through the RAG retrieval flow so
aborted requests stop Supabase work and do not populate caches. In
src/lib/rag.ts:2445-2468, pass args.signal to fetchEnabledRagAliases; in
src/lib/rag.ts:2533-2565 and 2800-2852, propagate it through the fast-path
enrichment and parallel candidate/RPC helpers; and in
src/lib/rag-candidate-sources.ts:185-207, add the corresponding signal handling
to the candidate-source helpers.
🪄 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: 3f7d26bd-7de7-438c-b104-a4c9b369a5d4
📒 Files selected for processing (27)
docs/branch-review-ledger.mddocs/codebase-index.mddocs/site-map.mdplaywright.config.tsscripts/check-github-action-pins.mjsscripts/generate-site-map.tssrc/app/layout.tsxsrc/app/page.tsxsrc/components/clinical-dashboard/master-search-header.tsxsrc/components/forms/forms-home-page.tsxsrc/components/services/services-navigator-page.tsxsrc/lib/rag-candidate-sources.tssrc/lib/rag.tssupabase/drift-manifest.jsonsupabase/migrations/20260714180000_patch_rag_and_corrector_scalability.sqlsupabase/migrations/20260714190000_document_table_facts_trgm_idx.sqlsupabase/migrations/20260717010000_harden_rag_scalability_patch.sqlsupabase/schema.sqltests/audit-content-services-regressions.test.tstests/audit-navigation-auth-regressions.test.tstests/rag-variant-early-exit.test.tstests/site-map.test.tstests/supabase-schema.test.tstests/ui-accessibility.spec.tstests/ui-smoke.spec.tstests/ui-tools.spec.tstsconfig.json
| const publicUtilityRouteHandlers = data.publicRouteHandlers.filter( | ||
| (route) => !productRouteHandlerPaths.has(route.route), | ||
| ); | ||
|
|
||
| const lines = [ | ||
| "# Clinical KB Site Map", | ||
| "", | ||
| "This file is generated by `npm run sitemap:update`. Run `npm run sitemap:check` to verify it is current.", | ||
| "", | ||
| ...section( | ||
| "Main product pages", | ||
| "Main product routes", |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Restore product route-handler placement.
The generator excludes product handlers from both the product and utility sections, while the regression test incorrectly requires that omission.
scripts/generate-site-map.ts#L397-L407: merge handlers inproductRouteHandlerPathsinto the “Main product routes” entries.tests/site-map.test.ts#L64-L96: change the product-section assertion totoContain.
📍 Affects 2 files
scripts/generate-site-map.ts#L397-L407(this comment)tests/site-map.test.ts#L64-L96
🤖 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 `@scripts/generate-site-map.ts` around lines 397 - 407, Restore product
route-handler placement by merging handlers from productRouteHandlerPaths into
the “Main product routes” entries in scripts/generate-site-map.ts, while keeping
them excluded from utility routes; update tests/site-map.test.ts so the
product-section assertion uses toContain instead of requiring omission.
| select candidate.term, similarity(candidate.term, tok) | ||
| into best, best_sim | ||
| from ( | ||
| ( | ||
| select lower(alias) as term | ||
| from public.rag_aliases | ||
| where enabled | ||
| and length(alias) between 4 and 40 | ||
| and lower(alias) % tok | ||
| order by similarity(lower(alias), tok) desc, lower(alias) | ||
| limit 32 | ||
| ) | ||
| union all | ||
| ( | ||
| select lower(canonical) as term | ||
| from public.rag_aliases | ||
| where enabled | ||
| and length(canonical) between 4 and 40 | ||
| and lower(canonical) % tok | ||
| order by similarity(lower(canonical), tok) desc, lower(canonical) | ||
| limit 32 | ||
| ) | ||
| union all | ||
| ( | ||
| select word as term | ||
| from public.document_title_words | ||
| where length(word) between 4 and 40 | ||
| and word % tok | ||
| order by similarity(word, tok) desc, word | ||
| limit 32 | ||
| ) | ||
| ) candidate | ||
| order by similarity(candidate.term, tok) desc, candidate.term | ||
| limit 1; |
There was a problem hiding this comment.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
Scope query-correction vocabulary to the current retrieval tenant.
The security-definer RPC searches every tenant’s aliases and document-title words, while callers provide no owner/public scope. Private vocabulary can therefore steer another tenant’s correction or act as a corpus-membership oracle.
supabase/migrations/20260717010000_harden_rag_scalability_patch.sql#L63-L96: add owner/include-public parameters and filter all three candidate sources.supabase/schema.sql#L3520-L3552: mirror the scoped final function definition.src/lib/rag-candidate-sources.ts#L263-L266: pass the effective retrieval scope.src/lib/rag.ts#L2484-L2490: pass the same scope used by downstream retrieval.tests/supabase-schema.test.ts#L1388-L1406: assert owner/public predicates and scoped RPC parameters.
📍 Affects 5 files
supabase/migrations/20260717010000_harden_rag_scalability_patch.sql#L63-L96(this comment)supabase/schema.sql#L3520-L3552src/lib/rag-candidate-sources.ts#L263-L266src/lib/rag.ts#L2484-L2490tests/supabase-schema.test.ts#L1388-L1406
🤖 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/20260717010000_harden_rag_scalability_patch.sql` around
lines 63 - 96, Scope the correction vocabulary RPC to the effective retrieval
tenant by adding owner and include-public parameters and applying matching
predicates to aliases, canonicals, and document-title words in
supabase/migrations/20260717010000_harden_rag_scalability_patch.sql:63-96 and
supabase/schema.sql:3520-3552. Pass the same retrieval scope through the callers
in src/lib/rag-candidate-sources.ts:263-266 and src/lib/rag.ts:2484-2490. Update
tests/supabase-schema.test.ts:1388-1406 to assert the scoped RPC parameters and
owner/public filters.
| it("keeps the root dashboard H1 as Clinical KB", () => { | ||
| expect(clinicalDashboardSource.match(/<h1\b/g)).toHaveLength(1); | ||
| expect(clinicalDashboardSource).toMatch(/<h1 className="sr-only">\s*Clinical (?:Guide|KB)\s*<\/h1>/); | ||
| expect(clinicalDashboardSource).toMatch(/<h1 className="sr-only">\s*Clinical Guide\s*<\/h1>/); |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Align the dashboard H1 contract across test suites.
The source regression requires Clinical Guide, while both browser suites now require Clinical KB. Choose the intended accessible heading and use it consistently.
tests/audit-navigation-auth-regressions.test.ts#L129-L129: align the source assertion with the intended dashboard H1.tests/ui-accessibility.spec.ts#L51-L51: use the same accessible heading.tests/ui-smoke.spec.ts#L870-L870: use the same accessible heading.tests/ui-smoke.spec.ts#L1265-L1265: use the same accessible heading.
📍 Affects 3 files
tests/audit-navigation-auth-regressions.test.ts#L129-L129(this comment)tests/ui-accessibility.spec.ts#L51-L51tests/ui-smoke.spec.ts#L870-L870tests/ui-smoke.spec.ts#L1265-L1265
🤖 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/audit-navigation-auth-regressions.test.ts` at line 129, Align the
accessible dashboard H1 assertions on the intended heading text, using “Clinical
KB” consistently. Update
tests/audit-navigation-auth-regressions.test.ts:129-129,
tests/ui-accessibility.spec.ts:51-51, and tests/ui-smoke.spec.ts:870-870 and
1265-1265 so every source and browser assertion expects the same H1.
Pull request was closed
Summary
mainfrom the latest reviewed branch set.Verification
npm run verify:cheapgate is blocked by a concurrent activerun-heavy.mjsprocess; rerun once completed.Risk and rollout
src/lib/rag*,src/app,src/components) and Supabase schema/migration artifacts.npm run verify:pr-localbefore any production promotion if regressions are detected.Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Summary by CodeRabbit
New Features
Bug Fixes
Documentation