diff --git a/src/components/settings/__tests__/coach-entry-follows-capability.test.tsx b/src/components/settings/__tests__/coach-entry-follows-capability.test.tsx index 79d0eef04..c30b49e8c 100644 --- a/src/components/settings/__tests__/coach-entry-follows-capability.test.tsx +++ b/src/components/settings/__tests__/coach-entry-follows-capability.test.tsx @@ -15,10 +15,7 @@ import { beforeEach, describe, expect, it, vi } from "vitest"; import { renderToStaticMarkup } from "react-dom/server"; -const h = vi.hoisted(() => ({ - coachAvailable: true, - active: null as Record | null, -})); +const h = vi.hoisted(() => ({ coachAvailable: true })); vi.mock("next/navigation", () => ({ usePathname: () => "/settings/ai", @@ -27,12 +24,7 @@ vi.mock("next/navigation", () => ({ vi.mock("@/hooks/use-mounted", () => ({ useMounted: () => true })); vi.mock("@/hooks/use-auth", () => ({ useAuth: () => ({ - user: { - id: "u1", - role: "USER", - modules: { coach: true }, - accountAccess: { active: h.active }, - }, + user: { id: "u1", role: "USER", modules: { coach: true } }, isAuthenticated: true, isLoading: false, refetch: vi.fn(), @@ -76,7 +68,6 @@ function render(node: React.ReactNode) { describe("the Coach entry in Settings", () => { beforeEach(() => { h.coachAvailable = true; - h.active = null; }); it("is listed while the Coach can answer, and the memory lives there", () => { @@ -95,18 +86,4 @@ describe("the Coach entry in Settings", () => { ).not.toContain('href="/settings/coach"'); expect(render()).toContain('data-slot="stored-coach-memory"'); }); - - it("stays for a managed record whose Coach cannot answer yet", () => { - // A record has no Settings, AI: the guardian reaches the record's Coach - // data scope and switch through this entry only. - h.coachAvailable = false; - h.active = { - recordKind: "managed", - level: "manage", - manageableDomains: [], - }; - expect( - render(body), - ).toContain('href="/settings/coach"'); - }); }); diff --git a/src/components/settings/settings-shell.tsx b/src/components/settings/settings-shell.tsx index 8d6924f5c..a2bcb5185 100644 --- a/src/components/settings/settings-shell.tsx +++ b/src/components/settings/settings-shell.tsx @@ -356,20 +356,6 @@ function deriveActiveSlug( return isSettingsSectionSlug(candidate) ? candidate : "account"; } -/** - * The module map the section list reads, the sidebar's. A managed record has - * no Settings, AI to list its Coach settings (its data scope, its switch), so - * there the Coach entry follows the module switch alone, not whether the - * record's Coach can answer yet. - */ -function useSectionModules() { - const { user } = useAuth(); - const navModules = useNavModules(); - return user?.accountAccess?.active?.recordKind === "managed" - ? user.modules - : navModules; -} - export function SettingsShell({ active, heading, @@ -405,7 +391,7 @@ export function SettingsShell({ // effect (which the lint rule flags as a cascading render), and no risk of // the two passes disagreeing. const hydrated = useMounted(); - const modules = useSectionModules(); + const modules = useNavModules(); const activeRecord = user?.accountAccess?.active ?? null; const allVisibleSections = SETTINGS_SECTIONS.filter( (section) =>