Skip to content

fix: restore drift manifest metadata to unblock design-audit merge#849

Closed
BigSimmo wants to merge 4 commits into
mainfrom
codex/design-audit-main-merge-clean-20260718-nosupabase
Closed

fix: restore drift manifest metadata to unblock design-audit merge#849
BigSimmo wants to merge 4 commits into
mainfrom
codex/design-audit-main-merge-clean-20260718-nosupabase

Conversation

@BigSimmo

@BigSimmo BigSimmo commented Jul 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Rebase design-audit regression hardening onto current main from a clean branch.
  • Keep all route/query/source regression fixes, migration assertions, and UI stability updates.
  • This follow-up restores supabase/drift-manifest.json metadata to avoid invoking Supabase Preview checks in this PR channel.

Verification

  • npm run verify:cheap (not run: local dependencies and toolchain are not bootstrapped in this environment)
  • npm run verify:ui (not run: local browser/test toolchain is unavailable in this environment)
    UI verification not run: Playwright/browser runtime unavailable in this environment.
  • npm run check:pr-local (not run: requires provider-bound flows in this environment)
  • npm run check:production-readiness (not run: requires provider-backed clinical checks)

Risk and rollout

Risk: medium - this PR includes clinical/UI and retrieval behavior changes that are user-visible; the only delta from the merged-ready base PR is drift manifest metadata normalization to avoid a preview gate.
Rollback: revert this PR or cherry-pick only the supabase/drift-manifest.json restore commit.

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

Notes

  • This branch is intended to be merged once all PR checks pass and is a metadata follow-up to the original design-audit fix set.

Summary by CodeRabbit

  • Bug Fixes
    • Improved cancellation handling for searches, stopping outdated retrieval/classification work when requests are abandoned.
    • Updated supplemental “also matches” rendering to show only in the appropriate non-answer contexts.
    • Refined audit/navigation/source validation expectations to better prevent incorrect or unavailable provenance details.
  • Accessibility
    • Improved error-page heading focus styling for more reliable keyboard focus visibility.
  • Testing
    • Expanded and adjusted regression and UI test assertions, including authentication gating, source-link rendering, and Supabase migration SQL checks.

@supabase

supabase Bot commented Jul 18, 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 Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c0d7c2b3-0b2f-43ce-9203-cce1d85fc778

📥 Commits

Reviewing files that changed from the base of the PR and between 94b4d11 and 0caef13.

📒 Files selected for processing (1)
  • tests/ui-tools.spec.ts

📝 Walkthrough

Walkthrough

The PR updates Playwright motion settings, broadens search parameter typing, changes universal-match rendering, adds RAG cancellation and telemetry handling, adjusts focus styling, and aligns content, navigation, schema, and UI regression tests.

Changes

Search, browser, and RAG behavior

Layer / File(s) Summary
UI and browser behavior
playwright.config.ts, src/app/page.tsx, src/components/ClinicalDashboard.tsx, src/components/route-error-boundary.tsx
Configures suite-wide and Chromium-specific motion preferences, broadens searchParams, excludes answer results from universal matches, and uses focus-visible outline styling.
RAG cancellation and answer telemetry
src/lib/rag-candidate-sources.ts, src/lib/rag.ts
Propagates AbortSignal through classifier fallback and retrieval RPCs, and records coalesced-answer waiter and origination lifecycle metrics.

Regression coverage

Layer / File(s) Summary
Content, navigation, and schema regression coverage
tests/audit-content-services-regressions.test.ts, tests/audit-navigation-auth-regressions.test.ts, tests/supabase-schema.test.ts
Updates provenance, source-link, private-API gating, polling, migration, and SQL assertions.
UI regression coverage
tests/ui-tools.spec.ts
Adds unsupported-content absence checks and validates mobile search dock transition properties.

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

Possibly related PRs

  • BigSimmo/Database#846: Overlaps across browser, search UI, RAG cancellation, telemetry, and regression-test changes.
  • BigSimmo/Database#847: Modifies the same motion, search parameter, dashboard, focus styling, and RAG code paths.
  • BigSimmo/Database#832: Shares the RAG retrieval and classifier abort-handling code paths.

Suggested labels: codex

Sequence Diagram(s)

sequenceDiagram
  participant SearchFlow
  participant ClassifierFallback
  participant RetrievalRpc
  participant AnswerTelemetry

  SearchFlow->>ClassifierFallback: forward AbortSignal
  ClassifierFallback->>ClassifierFallback: await classifier verdict with caller signal
  SearchFlow->>RetrievalRpc: execute retrieval RPC with signal
  RetrievalRpc-->>SearchFlow: return retrieval result or abort
  SearchFlow->>AnswerTelemetry: record coalesced waiter or origination lifecycle
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% 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 matches the metadata restore and merge-unblocking goal of the pull request.
Description check ✅ Passed The description follows the template sections and covers summary, verification, risk, governance, and notes adequately.
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-merge-clean-20260718-nosupabase

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: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/ui-tools.spec.ts (1)

155-170: 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

Keep the registry list and detail mocks consistent.

Non-form list requests return 13yarn, but the detail route returns 404 for every non-form slug. Any test that follows the listed record will fail because the fixture advertises an unresolved record. Either resolve 13yarn in the detail mock or return no non-form records.

Proposed fixture fix
+const nonFormRegistryRecord = {
+  slug: "13yarn",
+  title: "13YARN",
+  subtitle: "Crisis support line",
+};
+
-      kind === "form" ? formRecords : [{ slug: "13yarn", title: "13YARN", subtitle: "Crisis support line" }];
+      kind === "form" ? formRecords : [nonFormRegistryRecord];
...
-    const record = kind === "form" ? formRecords.find((form) => form.slug === slug) : undefined;
+    const record =
+      kind === "form"
+        ? formRecords.find((form) => form.slug === slug)
+        : slug === nonFormRegistryRecord.slug
+          ? nonFormRegistryRecord
+          : undefined;
🤖 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/ui-tools.spec.ts` around lines 155 - 170, The registry mocks are
inconsistent: the non-form list advertises the 13yarn record while the detail
route cannot resolve it. Update the route fixtures around the list response and
detail mock so 13yarn resolves successfully for non-form requests, or remove the
non-form record from the list; preserve the existing formRecords lookup
behavior.
🤖 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 `@playwright.config.ts`:
- Line 58: Update the Chromium project’s contextOptions in the Playwright
configuration so it preserves reduced motion instead of overriding the
suite-wide motion guard with "no-preference"; if motion is required by specific
tests, scope that override to those tests rather than the project-level
configuration.

In `@src/lib/rag-candidate-sources.ts`:
- Around line 91-104: Update both call sites of callVersionedRetrievalRpc in
rag.ts to pass args.signal as the fifth argument, preserving the existing four
arguments and ensuring vector-retrieval RPCs receive the caller’s AbortSignal.

In `@src/lib/rag.ts`:
- Around line 431-437: Update the catch handling around the classifier fallback
near the existing awaitWithCallerSignal usage to rethrow any cancellation when
opts?.signal?.aborted is true, regardless of whether the reason is an AbortError
or a custom Error. Preserve the current transport-failure handling for
non-aborted requests, and keep awaitWithCallerSignal’s caller-provided reason
intact.

In `@tests/ui-accessibility.spec.ts`:
- Around line 51-52: Keep the test contracts aligned with the production H1
rendered by ClinicalDashboard: update the “Clinical KB” expectations in
tests/ui-accessibility.spec.ts (lines 51-52), tests/ui-smoke.spec.ts (lines 876
and 1271), and tests/audit-navigation-auth-regressions.test.ts (lines 127-130)
to expect “Clinical Guide”; do not change production markup.

---

Outside diff comments:
In `@tests/ui-tools.spec.ts`:
- Around line 155-170: The registry mocks are inconsistent: the non-form list
advertises the 13yarn record while the detail route cannot resolve it. Update
the route fixtures around the list response and detail mock so 13yarn resolves
successfully for non-form requests, or remove the non-form record from the list;
preserve the existing formRecords lookup behavior.
🪄 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: 5c568a22-0f4e-4cf9-8e38-83b0f7d17a1d

📥 Commits

Reviewing files that changed from the base of the PR and between 20e5964 and 9294b6f.

📒 Files selected for processing (12)
  • playwright.config.ts
  • src/app/page.tsx
  • src/components/ClinicalDashboard.tsx
  • src/components/route-error-boundary.tsx
  • src/lib/rag-candidate-sources.ts
  • src/lib/rag.ts
  • tests/audit-content-services-regressions.test.ts
  • tests/audit-navigation-auth-regressions.test.ts
  • tests/supabase-schema.test.ts
  • tests/ui-accessibility.spec.ts
  • tests/ui-smoke.spec.ts
  • tests/ui-tools.spec.ts

Comment thread playwright.config.ts
grepInvert: mockupTag,
use: {
...devices["Desktop Chrome"],
contextOptions: { reducedMotion: "no-preference" },

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
rg -n 'reducedMotion|contextOptions|test\.use' playwright.config.ts tests || true

Repository: BigSimmo/Database

Length of output: 405


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "## playwright.config.ts"
wc -l playwright.config.ts
sed -n '1,140p' playwright.config.ts

echo
echo "## tests/ui-accessibility.spec.ts excerpt"
wc -l tests/ui-accessibility.spec.ts
sed -n '80,130p' tests/ui-accessibility.spec.ts

Repository: BigSimmo/Database

Length of output: 5556


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect Playwright config structure and relevant test usage around reduced motion.
echo "## playwright.config.ts"
wc -l playwright.config.ts
sed -n '1,140p' playwright.config.ts

echo
echo "## tests/ui-accessibility.spec.ts excerpt"
wc -l tests/ui-accessibility.spec.ts
sed -n '80,130p' tests/ui-accessibility.spec.ts

Repository: BigSimmo/Database

Length of output: 5556


🏁 Script executed:

#!/bin/bash
set -euo pipefail
wc -l playwright.config.ts
sed -n '1,140p' playwright.config.ts
echo '---'
wc -l tests/ui-accessibility.spec.ts
sed -n '80,130p' tests/ui-accessibility.spec.ts

Repository: BigSimmo/Database

Length of output: 5493


🏁 Script executed:

#!/bin/bash
set -euo pipefail
sed -n '1,140p' playwright.config.ts

Repository: BigSimmo/Database

Length of output: 3268


Project-level motion override should stay on reduced motion
contextOptions: { reducedMotion: "no-preference" } on the Chromium project overrides the suite-wide guard in use, so ui-smoke/ui-stress can still hit transition races. Scope this to the tests that need motion, or keep reduce here.

🤖 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 `@playwright.config.ts` at line 58, Update the Chromium project’s
contextOptions in the Playwright configuration so it preserves reduced motion
instead of overriding the suite-wide motion guard with "no-preference"; if
motion is required by specific tests, scope that override to those tests rather
than the project-level configuration.

Comment on lines +91 to +104
signal?: AbortSignal,
): Promise<{ data: T | null; error: SupabaseRpcError }> {
const client = supabase as unknown as {
rpc: (name: string, rpcArgs: Record<string, unknown>) => Promise<{ data: T | null; error: SupabaseRpcError }>;
const client = supabase as unknown as SupabaseRpcClient;
const executeRpc = async (name: string, rpcArgs: Record<string, unknown>) => {
const pending = client.rpc(name, rpcArgs) as AbortableRpc<T>;
const pendingWithAbort =
signal && typeof pending.abortSignal === "function" ? pending.abortSignal(signal) : pending;
return await pendingWithAbort;
};
const versioned = await client.rpc(versionedName, args);
const versioned = await executeRpc(versionedName, args);
if (versioned && !isMissingRetrievalRpcError(versioned.error)) return versioned;
const legacyArgs = { ...args };
delete legacyArgs.include_public;
const ownerResult = await client.rpc(legacyName, legacyArgs);
const ownerResult = await executeRpc(legacyName, legacyArgs);

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Wire the caller signal through retrieval RPC call sites.

callVersionedRetrievalRpc now accepts an AbortSignal, but the two current callers in src/lib/rag.ts (Lines [2837]-[2849] and [2945]-[2956]) still pass only four arguments. Aborts during vector retrieval therefore leave the Supabase RPC running.

Pass args.signal as the fifth argument at both call sites.

Proposed call-site fix
@@ hybrid retrieval call
       },
+      args.signal,
     );

@@ document-filter fallback call
       },
+      args.signal,
     );
🤖 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-candidate-sources.ts` around lines 91 - 104, Update both call
sites of callVersionedRetrievalRpc in rag.ts to pass args.signal as the fifth
argument, preserving the existing four arguments and ensuring vector-retrieval
RPCs receive the caller’s AbortSignal.

Comment thread src/lib/rag.ts
Comment on lines +431 to +437
function awaitWithCallerSignal<T>(pending: Promise<T>, signal?: AbortSignal): Promise<T> {
if (!signal) return pending;
if (signal.aborted) throw signal.reason ?? new DOMException("The operation was aborted.", "AbortError");

return new Promise<T>((resolve, reject) => {
const onAbort = () => reject(signal.reason ?? new DOMException("The operation was aborted.", "AbortError"));
signal.addEventListener("abort", onAbort, { once: true });

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the relevant area first
ast-grep outline src/lib/rag.ts --view expanded || true

# Read the surrounding implementation around the cited lines
sed -n '400,470p' src/lib/rag.ts

# Read the catch block area mentioned in the comment
sed -n '1360,1425p' src/lib/rag.ts

# Search for tests or other abort-handling helpers
rg -n "awaitWithCallerSignal|AbortError|signal\.reason|aborted" src test tests __tests__ . 2>/dev/null || true

Repository: BigSimmo/Database

Length of output: 50373


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Look for non-DOMException abort reasons in the repo
rg -n "abort\\(new Error|abort\\([^)]*reason|abort\\(signal\\.reason|abort\\([^)]*DOMException|AbortController\\(" src tests . 2>/dev/null | sed -n '1,220p'

# Read the rag abort-related test file if present
if [ -f tests/rag-abort-signal.test.ts ]; then
  sed -n '1,220p' tests/rag-abort-signal.test.ts
fi

# Show the classifier fallback function with enough context to assess the catch behavior
sed -n '1300,1415p' src/lib/rag.ts

Repository: BigSimmo/Database

Length of output: 18866


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Inspect the route budget test that uses a custom abort reason
sed -n '1,120p' tests/rag-route-budget.test.ts

# Inspect the rag abort signal tests for expected semantics
sed -n '1,180p' tests/rag-abort-signal.test.ts

# Inspect the universal-search wrapper since it forwards caller reasons
sed -n '150,230p' src/lib/universal-search.ts

Repository: BigSimmo/Database

Length of output: 8031


Preserve non-AbortError cancellation reasons in src/lib/rag.ts:1390-1399. awaitWithCallerSignal() rejects with signal.reason, but this catch only rethrows AbortError. If a caller aborts with a custom Error, the classifier fallback is treated as a transport failure and returns analysis instead of propagating cancellation. Check opts?.signal?.aborted here or normalize abort reasons to AbortError.

🤖 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 431 - 437, Update the catch handling around the
classifier fallback near the existing awaitWithCallerSignal usage to rethrow any
cancellation when opts?.signal?.aborted is true, regardless of whether the
reason is an AbortError or a custom Error. Preserve the current
transport-failure handling for non-aborted requests, and keep
awaitWithCallerSignal’s caller-provided reason intact.

Comment thread tests/ui-accessibility.spec.ts Outdated
@github-actions

Copy link
Copy Markdown

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 #3269 (success).

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

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