Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Open the Patrol mode selector when a link lands on its anchor
rcourtmanb2eed76e36b9
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex ddf92e11b7..2cd48d68c9 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -3458,7 +3458,12 @@ a new API state machine, queue contract, or verification-accounting field.while `/patrol#operations-loop` remains inbound compatibility only, ratherthan becoming an API payload field, Assistant prompt body, or backendcompletion state machine. The canonical anchor must resolve to the visible- Patrol mode selector, not to the assessment workspace; that anchor may+ Patrol mode selector, not to the assessment workspace: arriving on+ `#patrol-control`, with or without the starter query, or on the+ `#operations-loop` compatibility anchor opens the Patrol header's collapsed+ `Mode and automation` disclosure and scrolls it into view, a plain `/patrol`+ visit leaves it collapsed, and plan-locked installs, which have no selector,+ land on the header's inline `Patrol mode` line; that anchor mayroute a new Pro user to Patrol mode from a generic Patrol run state, but issue-backedprogress through Assistant, governed decision, verification, and MCP paritymust still derive from real Patrol finding, investigation, approval, action,diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 94e0682010..a676a32fff 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -653,6 +653,19 @@ fragments do not throw or move focus. The renderer and fragment helper arecovered by `frontend-modern/src/features/docs/__tests__/docMarkdown.test.ts`,with direct-link, reload and keyboard navigation verified in the live viewer.+### Patrol mode route anchor opens its disclosure++Patrol mode entry points in Settings and the licence panel link to+`/patrol#patrol-control`, while the Patrol header keeps the Patrol mode+selector in a collapsed `Mode and automation` disclosure. Arriving on that+anchor, with or without the starter query, or on the `#operations-loop`+compatibility anchor opens the disclosure and scrolls it into view. The header+acts again only when the hash or the disclosure element changes, so a+disclosure the user collapses stays collapsed and a plain `/patrol` visit+leaves it collapsed. Plan-locked installs render no disclosure.+`frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.render.test.tsx`+pins this on a rendered header.+### Disk mount scrollingDisksCard keeps every supplied mount in its parent's scrolling flow. It must notdiff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 8689baf269..58c0f32444 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -825,7 +825,12 @@ attention`, `approval needed`, `outcome verified`, `no active work`) insteadsection, which holds the Patrol on/off toggle and the `Mode and automation`disclosure with the Patrol mode selector (or, for plan-locked installs, theinline `Patrol mode` line), rather than on a separate onboarding banner or- generic Patrol container. The Patrol surface must preserve the+ generic Patrol container. Arriving on either anchor, with or without the+ starter query, opens that disclosure and scrolls the selector into view, so+ the entry points land on a visible Patrol mode selector; a plain `/patrol`+ visit leaves the disclosure collapsed, and a disclosure the operator+ collapses after arriving stays collapsed until the route hash changes. The+ Patrol surface must preserve theissue-evidence rule: Patrol mode can start from a generic Patrol runstate, but investigation, approval, verification, and external-agent parityrequire a real finding, investigation, or governed outcome signal. The nativediff --git a/frontend-modern/browser-verification/2e0b287721322a62.json b/frontend-modern/browser-verification/2e0b287721322a62.jsonnew file mode 100644index 0000000000..5a80c5c075--- /dev/null+++ b/frontend-modern/browser-verification/2e0b287721322a62.json@@ -0,0 +1,43 @@+{+ "version": 1,+ "base_sha": "e885b8acede825e5845a6ee509e97224892cf783",+ "verified_at": "2026-10-10T08:24:26Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx"+ ],+ "content_sha256": {+ "frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx": "ac12471d0bf34cf3b17ef68ba006c418ee06cfc4f805f31a3c65b5d31d8cd818"+ },+ "routes": [+ "/patrol",+ "/patrol#patrol-control",+ "/patrol#operations-loop",+ "/patrol?patrolControlStarter=patrol_control#patrol-control",+ "/settings/pulse-intelligence/assistant (External agents: header and Step 1 'Choose Patrol mode' links)"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "Two Vite dev servers on private ports, each proxying the managed hot-dev backend on :7655 for reads only: 'before' served frontend-modern from origin/main f4e4f52480 and 'after' served the same tree plus this change, whose header sha256 matches content_sha256. The ten PRs that landed between f4e4f52480 and this commit's parent touch none of the Patrol feature, routing, the Settings panel, licence presentation or the button group. Patrol was switched off on that backend, so GET /api/settings/ai was rewritten client-side to patrol_enabled true; nothing was written to the backend.",+ "Patrol mode available (runtime-capabilities rewritten to grant ai_autofix), after build at both widths: plain /patrol keeps 'Mode and automation' collapsed with the selector hidden; #patrol-control, #operations-loop and the starter URL open it with the four choices (Watch only, Ask first, Safe auto-fix, Autopilot) enabled, visible and inside the viewport, above the phone bottom nav (app shell scrollTop 0).",+ "Runtime-locked (ai_autofix blocked as paid_runtime_required), after build at 1440: #patrol-control, #operations-loop and the Settings Step 1 link open the disclosure with Watch only enabled and Ask first, Safe auto-fix and Autopilot disabled; a plain visit stays collapsed.",+ "Plan-locked (ai_autofix neither granted nor blocked), after build at both widths: no disclosure renders on any route; the anchor lands on the header section with the inline 'Patrol mode' watch-only line. At 390 px arriving from Settings leaves the app shell scrolled to where Settings was (about 413 px), as it did before this change; plan-locked behaviour is unchanged by this commit.",+ "Before build at both widths, Patrol mode available: every anchor route and both Settings links land with the disclosure collapsed and the selector not visible, reproducing the reported defect.",+ "No page errors on either build; the only console errors are websocket upgrade 403s from the non-default dev origin, identical on both builds; REST reads succeed."+ ],+ "interactions": [+ "Sign in with the stack's dev-default login, then load each route directly and wait for the Patrol header to settle.",+ "From /settings/pulse-intelligence/assistant scrolled down (about 519 px at 1440, 413 px at 390), click the External agents header 'Choose Patrol mode' link; again after 'Show connector setup', click the Step 1 'Choose Patrol mode' link; both reach /patrol#patrol-control with the selector visible and in view on the after build and hidden on the before build.",+ "After arriving on #patrol-control, click the 'Mode and automation' summary to collapse it and wait 3 s: it stays collapsed.",+ "Same script in 1440x900 and 390x844 contexts for available and plan-locked states, 1440x900 for runtime-locked, and both widths against the before build; screenshots of the Settings Step 1 arrival at 1440 (before and after) and 390 (after) inspected."+ ]+}diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsxindex 6158fbf26f..ea5c797a5c 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceHeader.tsx@@ -1,5 +1,5 @@-import { createMemo, Show } from 'solid-js';-import { A } from '@solidjs/router';+import { createEffect, createMemo, createSignal, Show } from 'solid-js';+import { A, useLocation } from '@solidjs/router';import PlayIcon from 'lucide-solid/icons/play';import SettingsIcon from 'lucide-solid/icons/settings';import DownloadIcon from 'lucide-solid/icons/download';@@ -34,6 +34,11 @@ import { PatrolAutopilotAcknowledgementDialog } from './PatrolAutopilotAcknowledexport { PATROL_AUTONOMY_POLICY_PRESENTATION } from './patrolControlPresentation';+const PATROL_MODE_ANCHOR_HASHES = new Set([+ `#${PATROL_CONTROL_ANCHOR}`,+ `#${PATROL_OPERATIONS_LOOP_ANCHOR}`,+]);+export function getPatrolAutopilotExpiry(expiresAt?: string | null): Date | null {if (!expiresAt?.trim()) return null;const expiry = new Date(expiresAt);@@ -275,6 +280,18 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState</>);+ // Patrol mode entry points link to these anchors, so arriving on one opens the+ // collapsed disclosure and brings the selector into view. This re-runs only+ // when the hash or the disclosure element changes, so a manual collapse holds.+ const location = useLocation();+ const [modeDisclosure, setModeDisclosure] = createSignal<HTMLDetailsElement>();+ createEffect(() => {+ const disclosure = modeDisclosure();+ if (!disclosure || !PATROL_MODE_ANCHOR_HASHES.has(location.hash)) return;+ disclosure.open = true;+ requestAnimationFrame(() => disclosure.scrollIntoView({ block: 'center' }));+ });+return (<div class="space-y-4"><PatrolAutopilotAcknowledgementDialog state={state} />@@ -373,7 +390,7 @@ export function PatrolIntelligenceHeader(props: { state: PatrolIntelligenceState<span id={PATROL_OPERATIONS_LOOP_ANCHOR} class="sr-only" aria-hidden="true" /><Show when={shouldShowAutonomyActionColumn()}>- <details class="border-t border-border-subtle px-1 py-1 sm:px-2">+ <details ref={setModeDisclosure} class="border-t border-border-subtle px-1 py-1 sm:px-2"><summary class="min-h-11 cursor-pointer text-xs font-medium text-muted focus:outline-hidden focus-visible:ring-2 focus-visible:ring-blue-500 sm:min-h-0">Mode and automation</summary>diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.render.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.render.test.tsxindex cc9377c369..55e183641d 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.render.test.tsx+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.render.test.tsx@@ -1,8 +1,15 @@import { Route, Router } from '@solidjs/router';import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { createSignal } from 'solid-js';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { PatrolAutonomyLevel } from '@/api/patrol';+import {+ PATROL_CONTROL_ANCHOR,+ PATROL_CONTROL_PATH,+ PATROL_CONTROL_PATH_WITH_STARTER,+ PATROL_OPERATIONS_LOOP_ANCHOR,+} from '@/routing/resourceLinks';import { PatrolIntelligenceHeader } from '../PatrolIntelligenceHeader';import type { PatrolIntelligenceState } from '../usePatrolIntelligenceState';@@ -11,7 +18,7 @@ const WATCH_ONLY_DETAIL =interface HeaderStateOptions {autonomyLevel?: PatrolAutonomyLevel;- autoFixLocked?: boolean;+ autoFixLocked?: boolean | (() => boolean);setupOnly?: boolean;autopilotDialogOpen?: boolean;}@@ -23,7 +30,10 @@ const createState = (options: HeaderStateOptions = {}) => {autopilotStatus: () => null,autonomyLevel: () => autonomyLevel,requestedAutonomyLevel: () => autonomyLevel,- autoFixLocked: () => options.autoFixLocked ?? false,+ autoFixLocked: () => {+ const locked = options.autoFixLocked ?? false;+ return typeof locked === 'function' ? locked() : locked;+ },autoFixCapabilityBlock: () => undefined,licenseRuntimeIdentity: () => undefined,patrolRunHistory: { value: () => [] },@@ -129,3 +139,98 @@ describe('PatrolIntelligenceHeader Patrol mode placement', () => {expect(dialogs[0]).toHaveAccessibleName('Activate Autopilot');});});++const renderHeaderAt = (url: string, state: PatrolIntelligenceState) => {+ window.history.replaceState(null, '', url);+ return renderHeader(state);+};++const navigateTo = (url: string) => {+ window.history.pushState(null, '', url);+ window.dispatchEvent(new PopStateEvent('popstate'));+};++const nextFrame = () => new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));++// Settings and licence Patrol mode actions link to #patrol-control, and the+// api-contracts "Patrol control route target" clause requires that anchor to+// land on a visible Patrol mode selector, not on its collapsed disclosure.+describe('PatrolIntelligenceHeader Patrol mode anchors', () => {+ let scrolled: Element[];++ beforeEach(() => {+ scrolled = [];+ HTMLElement.prototype.scrollIntoView = vi.fn(function (this: HTMLElement) {+ scrolled.push(this);+ });+ });++ afterEach(() => {+ cleanup();+ window.history.replaceState(null, '', '/');+ });++ it.each([+ ['the Patrol mode entry points', PATROL_CONTROL_PATH],+ ['the licence starter handoff', PATROL_CONTROL_PATH_WITH_STARTER],+ ['the operations-loop compatibility anchor', `/patrol#${PATROL_OPERATIONS_LOOP_ANCHOR}`],+ ])('opens the Patrol mode selector and scrolls to it for %s', async (_entry, url) => {+ renderHeaderAt(url, createState().state);++ const details = modeDisclosure();+ expect(details.open).toBe(true);+ expect(details.contains(screen.getByRole('group', { name: 'Patrol mode' }))).toBe(true);+ await vi.waitFor(() => expect(scrolled).toEqual([details]));+ expect(HTMLElement.prototype.scrollIntoView).toHaveBeenCalledWith({ block: 'center' });+ });++ it('keeps the disclosure collapsed on a plain Patrol visit', async () => {+ renderHeaderAt('/patrol', createState().state);++ expect(modeDisclosure().open).toBe(false);+ await nextFrame();+ expect(scrolled).toEqual([]);+ });++ it('opens the disclosure when the selector mounts after the licence loads', async () => {+ const [locked, setLocked] = createSignal(true);+ renderHeaderAt(PATROL_CONTROL_PATH, createState({ autoFixLocked: locked }).state);+ expect(screen.queryByText('Mode and automation')).toBeNull();++ setLocked(false);++ await vi.waitFor(() => expect(modeDisclosure().open).toBe(true));+ await vi.waitFor(() => expect(scrolled).toEqual([modeDisclosure()]));+ });++ it('opens the disclosure when navigation moves onto the anchor', async () => {+ renderHeaderAt('/patrol', createState().state);+ expect(modeDisclosure().open).toBe(false);++ navigateTo(PATROL_CONTROL_PATH);++ await vi.waitFor(() => expect(modeDisclosure().open).toBe(true));+ });++ it('leaves a disclosure the user collapsed alone while the anchor stays', async () => {+ renderHeaderAt(PATROL_CONTROL_PATH, createState().state);+ const details = modeDisclosure();+ await vi.waitFor(() => expect(scrolled).toHaveLength(1));++ details.open = false;+ navigateTo(`/patrol?attention=finding-1#${PATROL_CONTROL_ANCHOR}`);+ await nextFrame();++ expect(details.open).toBe(false);+ expect(scrolled).toHaveLength(1);+ });++ it('needs no disclosure for plan-locked installs', async () => {+ renderHeaderAt(PATROL_CONTROL_PATH, createState({ autoFixLocked: true }).state);++ expect(document.querySelector('details')).toBeNull();+ expect(screen.getByText('Patrol mode').closest('#patrol-control')).not.toBeNull();+ await nextFrame();+ expect(scrolled).toEqual([]);+ });+});diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.tsindex f6a97156a9..fed7946a98 100644--- a/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts+++ b/frontend-modern/src/features/patrol/__tests__/PatrolIntelligenceHeader.test.ts@@ -58,6 +58,15 @@ describe('PatrolIntelligenceHeader', () => {expect(headerSource).toContain('Check now');});+ it('opens the collapsed Patrol mode disclosure only for its route anchors', () => {+ // Rendered behaviour lives in PatrolIntelligenceHeader.render.test.tsx.+ expect(headerSource).toContain('`#${PATROL_CONTROL_ANCHOR}`');+ expect(headerSource).toContain('`#${PATROL_OPERATIONS_LOOP_ANCHOR}`');+ expect(headerSource).toContain('<details ref={setModeDisclosure}');+ expect(headerSource).toContain('PATROL_MODE_ANCHOR_HASHES.has(location.hash)');+ expect(headerSource).not.toMatch(/<details[^>]*\sopen[\s=>]/);+ });+it('turns provider-blocked manual run controls into setup actions', () => {expect(headerSource).toContain('runBlockedByProviderSetup');expect(headerSource).toContain("state.patrolReadiness()?.status === 'not_ready'");