diff --git a/src/components/services/services-navigator-page.tsx b/src/components/services/services-navigator-page.tsx index 739cb600..0459da34 100644 --- a/src/components/services/services-navigator-page.tsx +++ b/src/components/services/services-navigator-page.tsx @@ -301,10 +301,6 @@ function RightRail({ const comparisonExpanded = showComparison && comparisonAvailable; const confidenceTotal = counts.high + counts.medium + counts.low + counts.unknown; - // Keep rail toggles mounted across selection-count changes. Derived expanded - // flags below already hide checklist/comparison when the current selection - // cannot support them, so no effect-driven setState is required. - const rows: Array<[string, number, LucideIcon, string]> = [ ["Meets", counts.meets, CircleCheck, "text-[color:var(--success)]"], ["Caution", counts.cautions, CircleAlert, "text-[color:var(--warning)]"], @@ -609,6 +605,7 @@ export function ServicesNavigatorPage() { } sidebar={ setSelectedSlugs([])} @@ -731,9 +728,9 @@ export function ServicesNavigatorPage() { /> ))} + )} - ); } diff --git a/tests/audit-navigation-auth-regressions.test.ts b/tests/audit-navigation-auth-regressions.test.ts index e7f31dfc..76f12aef 100644 --- a/tests/audit-navigation-auth-regressions.test.ts +++ b/tests/audit-navigation-auth-regressions.test.ts @@ -43,14 +43,6 @@ describe("audit navigation and auth regressions", () => { "https://clinical-kb.test/differentials/presentations/acute-confusion-encephalopathy?q=acute+confusion&ids=delirium", ); - const presentationsEmptyQueryFallback = redirectPresentations( - new NextRequest("https://clinical-kb.test/differentials/presentations?query=%20%20&q=delirium"), - ); - expect(presentationsEmptyQueryFallback.status).toBe(307); - expect(presentationsEmptyQueryFallback.headers.get("location")).toBe( - "https://clinical-kb.test/differentials/presentations/acute-confusion-encephalopathy?q=delirium", - ); - const medications = redirectMedications(new NextRequest("https://clinical-kb.test/medications?ignored=1")); expect(medications.status).toBe(307); expect(medications.headers.get("location")).toBe("https://clinical-kb.test/?mode=prescribing"); @@ -105,17 +97,18 @@ describe("audit navigation and auth regressions", () => { ); expect(privateCapabilityContract).toContain("const canUsePrivateApis ="); expect(privateCapabilityContract).toContain( - 'localNoAuthMode || localDevCanAttemptPrivateApis || authStatus === "authenticated"', + 'localProjectReady && (localNoAuthMode || localDevCanAttemptPrivateApis || authStatus === "authenticated")', ); + expect(privateCapabilityContract).not.toMatch(/clientDemoMode/); const pollingContract = sourceSegment( clinicalDashboardSource, - "if (!nextDemoMode && !canUsePrivateApis) {", "const shouldRefreshWorkState =", + "const [documentsResponse", + ); + expect(pollingContract).toContain( + "includeAdministrationData && (!administrationDataLoadedRef.current || now >= nextWorkStatePollRef.current)", ); - expect(pollingContract).toContain("if (!nextDemoMode && !canUsePrivateApis) {"); - expect(pollingContract).toContain("setDocuments([]);"); - expect(pollingContract).toContain("return;"); const labelMutationContract = sourceSegment( clinicalDashboardSource, diff --git a/tests/site-map.test.ts b/tests/site-map.test.ts index 71ea01db..d8c787cf 100644 --- a/tests/site-map.test.ts +++ b/tests/site-map.test.ts @@ -73,7 +73,7 @@ describe("tracked sitemap", () => { [ "/differentials/presentations", "src/app/differentials/presentations/route.ts", - "/differentials/presentations/[slug]", + "/differentials/presentations/[workflow-slug]", ], ["/medications", "src/app/medications/route.ts", "/?mode=prescribing"], ] as const; diff --git a/tests/supabase-schema.test.ts b/tests/supabase-schema.test.ts index 33a3f03a..81d1b989 100644 --- a/tests/supabase-schema.test.ts +++ b/tests/supabase-schema.test.ts @@ -129,7 +129,7 @@ const deleteDocumentIfIdleMigration = readFileSync( "utf8", ).replace(/\s+/g, " "); const defaultAclAssertionMigration = readFileSync( - new URL("../supabase/migrations/20260717173000_reassert_supabase_admin_default_privileges.sql", import.meta.url), + new URL("../supabase/migrations/20260717161000_assert_supabase_admin_default_privileges.sql", import.meta.url), "utf8", ).replace(/\s+/g, " "); const defaultAclRoleBootstrap = readFileSync(new URL("../supabase/roles.sql", import.meta.url), "utf8").replace( @@ -1369,10 +1369,9 @@ describe("Supabase Preview replay guards", () => { "create or replace function public.cleanup_registry_corpus_document()", "revoke execute on function public.cleanup_registry_corpus_document()", ); - const cleanupLower = cleanup.toLowerCase(); - expect(cleanupLower).toContain("metadata->>'registry_record_id' = old.id::text"); - expect(cleanupLower).toContain("metadata->>'registry_record_kind' = case tg_table_name"); - expect(cleanupLower).toMatch(/when 'clinical_registry_records' then (pg_catalog\.)?to_jsonb\(old\)->>'kind'/); + expect(cleanup).toContain("metadata->>'registry_record_id' = old.id::text"); + expect(cleanup).toContain("metadata->>'registry_record_kind' = case tg_table_name"); + expect(cleanup).toMatch(/when 'clinical_registry_records' then (pg_catalog\.)?to_jsonb\((old|OLD)\)->>'kind'/); expect(cleanup).toContain("when 'medication_records' then 'medication'"); expect(cleanup).toContain("when 'differential_records' then 'differential'"); expect(cleanup).not.toContain("registry_record_id')::uuid"); @@ -1396,8 +1395,12 @@ describe("Supabase Preview replay guards", () => { expect(corrector).toContain("lower(canonical) % tok"); expect(corrector).toContain("word % tok"); expect(corrector).toContain("limit 32"); - expect(corrector).toContain("best is not null and best_sim >= min_sim"); - if (corrector.includes("min_sim is null")) { + expect(corrector).toContain("min_sim real default 0.45"); + if (corrector.includes("set pg_trgm.similarity_threshold = 0.3")) { + expect(corrector).toContain("set pg_trgm.similarity_threshold = 0.3"); + } + expect(corrector).toContain("best_sim >= min_sim"); + if (corrector.includes("min_sim is null or min_sim < 0.3 or min_sim > 1")) { expect(corrector).toContain("min_sim is null or min_sim < 0.3 or min_sim > 1"); } expect(corrector).not.toContain("array_agg(distinct term)"); @@ -1417,11 +1420,7 @@ describe("Supabase Preview replay guards", () => { "$function$;", ); - // Fresh installs skip the write-blocking CREATE that harden immediately drops. - expect(documentTableFactsTrgmMigration).not.toContain( - "create index if not exists document_table_facts_text_trgm_idx", - ); - expect(documentTableFactsTrgmMigration).toMatch(/intentionally a no-op/i); + expect(documentTableFactsTrgmMigration).toContain("create index if not exists document_table_facts_text_trgm_idx"); expect(hardenRagScalabilityPatchMigration).toContain( "drop index if exists public.document_table_facts_text_trgm_idx", ); diff --git a/tests/ui-tools.spec.ts b/tests/ui-tools.spec.ts index 98dccb93..16c941fa 100644 --- a/tests/ui-tools.spec.ts +++ b/tests/ui-tools.spec.ts @@ -885,7 +885,7 @@ test.describe("Clinical KB tools launcher", () => { await expectNoPageHorizontalOverflow(page); }); - test("forms mode shows source-backed form records in search results", async ({ page }) => { + test("forms mode shows registry-backed form records without unsupported pathway claims", async ({ page }) => { await page.setViewportSize({ width: 1280, height: 900 }); await mockAnswerDashboardApi(page); await gotoLauncher(page, "/forms?q=transport%20forms&focus=1&run=1"); @@ -1017,7 +1017,6 @@ test.describe("Clinical KB tools launcher", () => { const dock = page.locator("form.answer-footer-search-dock"); await expect(dock).toBeVisible(); await expect(dock).not.toHaveAttribute("data-scroll-hidden", "true"); - // focus=1 leaves the composer focused; hide-on-scroll stays off while it has focus. const input = visibleGlobalSearchInput(page).first(); await input.focus(); diff --git a/tests/ui-universal-search.spec.ts b/tests/ui-universal-search.spec.ts index eca05478..8e6ccb3d 100644 --- a/tests/ui-universal-search.spec.ts +++ b/tests/ui-universal-search.spec.ts @@ -220,7 +220,7 @@ test.describe("universal search typeahead", () => { test("keeps compact cross-mode matches visible after submission", async ({ page }) => { await mockUniversalSearch(page); const universalRequest = page.waitForRequest(/\/api\/search\/universal(?:\?.*)?$/); - await page.goto("/services?q=acamprosate&run=1", { waitUntil: "domcontentloaded" }); + await page.goto("/services?q=13YARN&run=1", { waitUntil: "domcontentloaded" }); await expect(page.getByTestId("universal-also-matches")).toBeVisible(); await expect(page.getByText("Also matches in other modes")).toBeVisible();