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
Seal public demo dashboard shell leaks
rcourtmanaae9be244163
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.mdindex 80dbc93af7..470475578a 100644--- a/docs/release-control/v6/internal/subsystems/api-contracts.md+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md@@ -239,7 +239,10 @@ when the disabled candidate no longer counts toward monitored-system capacity.`/api/security/status.sessionCapabilities.demoMode` as the canonicalbrowser bootstrap signal for public demo posture instead of askingfrontend callers to infer demo state from response headers, `/api/health`- probes, or hostname heuristics.+ probes, or hostname heuristics. Shared browser stores that consume+ Patrol approvals must also fail closed from that resolved demo policy at+ the store boundary, so public demo shells do not probe `/api/ai/approvals`+ after the read-only demo posture is already known.33. Keep public demo commercial posture middleware-owned on that same sharedAPI contract. `internal/api/demo_middleware.go`,`internal/api/demo_mode_commercial.go`,diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex d146922674..1f2a4b9091 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -154,7 +154,13 @@ still grows monitored-system usage.infrastructure-summary fetch than the route actually renders. Commercialposture on `v6-demo` therefore stays governed by the route-ownedpresentation policy and summary scope rather than by app-shell-wide- bootstrap heuristics.+ bootstrap heuristics. That same app-shell boundary must also keep the+ explicit `/login` route quiet before a session exists: when auth is+ configured but no local auth hint has been established yet,+ `frontend-modern/src/useAppRuntimeState.ts` must stop at the shared+ login-needed state and skip `/api/state`, while protected-route arrivals+ and post-login reloads still keep the canonical state probe for runtime+ detection.## Forbidden Paths@@ -1473,6 +1479,14 @@ real licensing model. That includes settings billing tabs, public-demo bannerand monitored-system/trial nudges, dashboard relay paywalls, Patrol upgradeCTAs, and history-lock upsells. Demo readiness therefore means presentationisolation, not a license exemption.+That same bootstrap owner must also avoid protected pre-auth noise. When auth+is configured but the browser is still on the explicit `/login` route with no+local auth hint yet, `frontend-modern/src/useAppRuntimeState.ts` must stop at+the shared login-needed state and skip the `/api/state` probe, so public demos+and other browser-first login surfaces do not emit avoidable `401` traffic+before a session exists. Once the local login flow has written its bootstrap+hint or the operator is landing on a protected route, the canonical state+probe still owns authenticated runtime detection.That public-demo commercial boundary also owns monitored-system previewunavailability wording. Browser presentation may keep the unavailable reasonnullable until the formatting edge, but it must normalize the message throughdiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 92a27be23f..496f81cf04 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -184,6 +184,12 @@ work extends shared components instead of creating new local variants.utility tab, and `/operations` deep links must hand back to the dashboardinstead of surfacing diagnostics or system-log chrome that the backend hidesfor demo sessions.+ Shared sparkline primitives must also stay CSP-safe by construction:+ `frontend-modern/src/components/shared/InteractiveSparkline.tsx` may use SVG+ attributes and shared state/model helpers for cursor, axis-label, and+ tooltip positioning, but it must not write inline `style=` attributes for+ tick labels, tooltip placement, or per-series transitions on the public+ shell.3. Add feature-specific presentation only when no shared primitive should own it4. Add guardrail tests when a new shared pattern is introduced5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.mdindex 9e6141cc08..8c6d651f0b 100644--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md@@ -149,6 +149,12 @@ suppression is now the shared resolved `presentationPolicy` fromupgrade CTAs, trial nudges, and Pro-only helper copy only from that sharedpolicy instead of reviving local demo heuristics or issuing early commercialreads before the policy resolves.+That same shared policy now also owns Patrol approval polling posture.+`frontend-modern/src/stores/aiIntelligence.ts` must fail+`loadPendingApprovals()` closed in public demo mode and return the canonical+empty queue from the shared store boundary itself, so dashboard and Patrol+shells do not probe `/api/ai/approvals` after the read-only demo policy has+resolved.That same posture split now also centralizes Patrol commercial bootstrap.`frontend-modern/src/features/patrol/usePatrolIntelligenceState.ts` and`frontend-modern/src/components/patrol/ApprovalSection.tsx` may consume thediff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 0d879a80d5..b59e685a1a 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -210,6 +210,12 @@ regression protection.chrome, `frontend-modern/src/useAppRuntimeState.ts` may retain a hiddendefault org scope for route-safe API calls, but it must skip browser orglist hydration and must not turn dashboard landing on `frontend-modern/src/App.tsx`+ into protected pre-auth churn. On the explicit `/login` route, if auth is+ configured but the browser has no local auth hint yet, the app shell must+ stop at the login-needed state instead of probing `/api/state` and paying+ an avoidable `401`; once a local-login hint exists or the operator is on a+ protected route, that shared state probe remains the canonical runtime+ detector.into another summary-fetch or org-bootstrap hot path.Authenticated `/login` recovery belongs to that same app-shell boundary:`frontend-modern/src/App.tsx` must redirect that route back to thediff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.tsindex 0012d4d1d5..b505b4f419 100644--- a/frontend-modern/src/__tests__/App.architecture.test.ts+++ b/frontend-modern/src/__tests__/App.architecture.test.ts@@ -108,6 +108,10 @@ describe('App architecture', () => {expect(appRuntimeStateSource).toContain('onMount(() => {');expect(appRuntimeStateSource).toContain('onMount(async () => {');expect(appRuntimeStateSource).toContain('void loadCommercialPosture();');+ expect(appRuntimeStateSource).toContain('const hasLocalAuthBootstrapHint = (): boolean => {');+ expect(appRuntimeStateSource).toContain(+ "if (window.location.pathname === '/login' && !hasLocalAuthBootstrapHint()) {",+ );expect(appRuntimeStateSource).toContain('aiChatStore.setEnabled(');expect(appRuntimeStateSource).toContain("eventBus.on('theme_changed', handleRemoteThemeChange);");expect(appRuntimeStateSource).toContain(diff --git a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts b/frontend-modern/src/__tests__/useAppRuntimeState.test.tsindex b8f6d4a13e..6216cb456d 100644--- a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts+++ b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts@@ -17,12 +17,15 @@ describe('useAppRuntimeState', () => {let isMultiTenantEnabledMock: ReturnType<typeof vi.fn>;let isHostedModeEnabledMock: ReturnType<typeof vi.fn>;let getOrgIDMock: ReturnType<typeof vi.fn>;+ let hasStoredAuthSessionMock: ReturnType<typeof vi.fn>;let setOrgIDMock: ReturnType<typeof vi.fn>;let showToastMock: ReturnType<typeof vi.fn>;let aiChatSetEnabledMock: ReturnType<typeof vi.fn>;beforeEach(async () => {vi.resetModules();+ window.history.replaceState({}, '', '/');+ window.sessionStorage.clear();Object.defineProperty(window, 'matchMedia', {writable: true,@@ -66,6 +69,7 @@ describe('useAppRuntimeState', () => {isMultiTenantEnabledMock = vi.fn().mockReturnValue(false);isHostedModeEnabledMock = vi.fn().mockReturnValue(false);getOrgIDMock = vi.fn().mockReturnValue('default');+ hasStoredAuthSessionMock = vi.fn().mockReturnValue(true);setOrgIDMock = vi.fn();showToastMock = vi.fn();aiChatSetEnabledMock = vi.fn();@@ -142,6 +146,7 @@ describe('useAppRuntimeState', () => {vi.doMock('@/utils/apiClient', () => ({apiFetch: apiFetchMock,getOrgID: getOrgIDMock,+ hasAuth: hasStoredAuthSessionMock,setOrgID: setOrgIDMock,}));@@ -316,4 +321,38 @@ describe('useAppRuntimeState', () => {dispose();});++ it('skips the protected state bootstrap probe on the login route until a local auth hint exists', async () => {+ window.history.replaceState({}, '', '/login');+ hasStoredAuthSessionMock.mockReturnValue(false);++ const { hookState, dispose } = mountHook();++ await flushAsync();+ await flushAsync();++ expect(+ apiFetchMock.mock.calls.some(([url]) => url === '/api/state'),+ ).toBe(false);+ expect(hookState.needsAuth()).toBe(true);++ dispose();+ });++ it('keeps the protected state bootstrap probe on the login route once a local auth hint exists', async () => {+ window.history.replaceState({}, '', '/login');+ hasStoredAuthSessionMock.mockReturnValue(false);+ window.sessionStorage.setItem('pulse_auth_user', 'demo');++ const { dispose } = mountHook();++ await flushAsync();+ await flushAsync();++ expect(+ apiFetchMock.mock.calls.some(([url]) => url === '/api/state'),+ ).toBe(true);++ dispose();+ });});diff --git a/frontend-modern/src/components/shared/InteractiveSparkline.tsx b/frontend-modern/src/components/shared/InteractiveSparkline.tsxindex 3879d2c4d1..0e304fb75f 100644--- a/frontend-modern/src/components/shared/InteractiveSparkline.tsx+++ b/frontend-modern/src/components/shared/InteractiveSparkline.tsx@@ -1,7 +1,7 @@import { Component, For, Show } from 'solid-js';-import { Portal } from 'solid-js/web';import {formatInteractiveSparklineHoverTime,+ type InteractiveSparklineHoverState,type InteractiveSparklineProps,} from './interactiveSparklineModel';import { useInteractiveSparklineState } from './useInteractiveSparklineState';@@ -11,6 +11,16 @@ export type {InteractiveSparklineSeries,} from './interactiveSparklineModel';+const verticalTextBaseline = (anchor: 'top' | 'middle' | 'bottom') =>+ anchor === 'top' ? 'hanging' : anchor === 'bottom' ? 'text-bottom' : 'middle';++const horizontalTextAnchor = (anchor: 'start' | 'middle' | 'end') => anchor;++const tooltipWidth = (hover: InteractiveSparklineHoverState) => (hover.focusedTooltip ? 112 : 138);++const tooltipHeight = (hover: InteractiveSparklineHoverState) =>+ 22 + hover.values.length * 16 + (hover.totalValues > hover.values.length ? 14 : 0);+export const InteractiveSparkline: Component<InteractiveSparklineProps> = (props) => {let chartSurfaceRef: Element | undefined;let canvasRef: HTMLCanvasElement | undefined;@@ -41,26 +51,6 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propsdata-summary-chart-state={interactionState()}><div class="relative flex-1 min-h-0">- <div class="absolute inset-y-0 left-0 w-7 pointer-events-none">- <For each={sparkline.axisTicks()}>- {(tick) => (- <span- class="absolute left-0 text-[8px] leading-none text-muted transition-all duration-300 ease-out"- style={{- top: tick.top,- transform:- tick.anchor === 'top'- ? 'translateY(0)'- : tick.anchor === 'bottom'- ? 'translateY(-100%)'- : 'translateY(-50%)',- }}- >- {tick.label}- </span>- )}- </For>- </div><div class="h-full ml-7 mr-3" ref={canvasHostRef}><Showwhen={sparkline.shouldUseCanvas()}@@ -159,7 +149,7 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propsstroke-linecap="round"stroke-linejoin="round"opacity={sparkline.opacityForSeries(pathData.seriesIndex)}- style={{ transition: 'opacity 90ms linear, stroke-width 90ms linear' }}+ class="transition-all duration-100 ease-linear"vector-effect="non-scaling-stroke"/></g>@@ -180,85 +170,109 @@ export const InteractiveSparkline: Component<InteractiveSparklineProps> = (propsonClick={sparkline.handleClick}/></Show>- </div>- </div>- <div- class="relative pointer-events-none ml-7 mr-3"- style={{ height: `${sparkline.xAxisBandPx}px` }}- >- <For each={sparkline.xAxisTicks()}>- {(tick) => (- <span- class="absolute top-[2px] text-[9px] font-medium leading-none text-muted transition-all duration-300 ease-out"- style={{- left: `${tick.left}%`,- transform:- tick.anchor === 'start'- ? 'translateX(0)'- : tick.anchor === 'end'- ? 'translateX(-100%)'- : 'translateX(-50%)',- }}- >- {tick.label}- </span>- )}- </For>- </div>-- <Portal>- <Show when={sparkline.hoveredState()}>- {(hover) => (- <div- data-sparkline-tooltip="true"- class="fixed pointer-events-none rounded-md border border-border bg-surface px-2 py-1.5 text-xs text-base-content shadow-lg"- style={{- left: `${hover().tooltipX}px`,- top: `${hover().tooltipY}px`,- transform: 'translate(-50%, -100%)',- 'z-index': '9999',- }}- >- <div class="mb-1 text-center font-medium text-base-content">- {formatInteractiveSparklineHoverTime(hover().timestamp)}- </div>- <For each={hover().values}>- {(entry) => (+ <svg+ class="pointer-events-none absolute inset-0 h-full w-full overflow-visible"+ viewBox={`0 0 ${sparkline.vbW} ${sparkline.vbH}`}+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <Show when={sparkline.hoveredState()}>+ {(hover) => (+ <foreignObject+ x={hover().tooltipX - tooltipWidth(hover()) / 2}+ y={hover().tooltipY - tooltipHeight(hover())}+ width={tooltipWidth(hover())}+ height={tooltipHeight(hover())}+ overflow="visible"+ ><div- class={`flex items-center gap-1.5 leading-tight ${- props.highlightNearestSeriesOnHover &&- hover().focusedTooltip &&- hover().highlightedSeriesIndex !== null- ? hover().highlightedSeriesIndex === entry.seriesIndex- ? 'rounded px-1'- : 'opacity-40'- : ''- }`}- style={- props.highlightNearestSeriesOnHover &&- hover().focusedTooltip &&- hover().highlightedSeriesIndex === entry.seriesIndex- ? { 'background-color': 'rgba(148, 163, 184, 0.14)' }- : {}- }+ data-sparkline-tooltip="true"+ class="h-full w-full rounded-md border border-border bg-surface px-2 py-1.5 text-[10px] text-base-content shadow-lg">- <span class="w-1.5 h-1.5 rounded-full" style={{ background: entry.color }} />- <span class="text-muted">{entry.name}</span>- <span class="ml-auto font-medium text-base-content">- {sparkline.formatValue(entry.value)}- </span>+ <div class="mb-1 text-center font-medium text-base-content">+ {formatInteractiveSparklineHoverTime(hover().timestamp)}+ </div>+ <For each={hover().values}>+ {(entry) => (+ <div+ class={`flex items-center gap-1.5 leading-tight ${+ props.highlightNearestSeriesOnHover &&+ hover().focusedTooltip &&+ hover().highlightedSeriesIndex === entry.seriesIndex+ ? 'rounded px-1 bg-slate-400/15'+ : ''+ }`}+ >+ <svg class="h-2 w-2 shrink-0" viewBox="0 0 8 8" aria-hidden="true">+ <circle cx="4" cy="4" r="4" fill={entry.color} />+ </svg>+ <span class="text-muted">{entry.name}</span>+ <span class="ml-auto font-medium text-base-content">+ {sparkline.formatValue(entry.value)}+ </span>+ </div>+ )}+ </For>+ <Show when={hover().totalValues > hover().values.length}>+ <div class="mt-0.5 text-[10px] text-muted">+ +{hover().totalValues - hover().values.length} more series+ </div>+ </Show></div>- )}- </For>- <Show when={hover().totalValues > hover().values.length}>- <div class="mt-0.5 text-[10px] text-muted">- +{hover().totalValues - hover().values.length} more series- </div>- </Show>- </div>- )}- </Show>- </Portal>+ </foreignObject>+ )}+ </Show>+ </svg>+ </div>+ <div class="absolute inset-y-0 left-0 w-7 pointer-events-none">+ <svg+ class="h-full w-full overflow-visible text-muted"+ viewBox={`0 0 28 ${sparkline.vbH}`}+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <For each={sparkline.axisTicks()}>+ {(tick) => (+ <text+ x="0"+ y={tick.y}+ fill="currentColor"+ font-size="8"+ class="transition-all duration-300 ease-out"+ dominant-baseline={verticalTextBaseline(tick.anchor)}+ >+ {tick.label}+ </text>+ )}+ </For>+ </svg>+ </div>+ </div>+ <div class="relative pointer-events-none ml-7 mr-3 h-4">+ <svg+ class="h-full w-full overflow-visible text-muted"+ viewBox={`0 0 ${sparkline.vbW} ${sparkline.xAxisBandPx}`}+ preserveAspectRatio="none"+ aria-hidden="true"+ >+ <For each={sparkline.xAxisTicks()}>+ {(tick) => (+ <text+ x={tick.x}+ y="2"+ fill="currentColor"+ font-size="9"+ font-weight="500"+ class="transition-all duration-300 ease-out"+ text-anchor={horizontalTextAnchor(tick.anchor)}+ dominant-baseline="hanging"+ >+ {tick.label}+ </text>+ )}+ </For>+ </svg>+ </div></div>);};diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex ec47aa1e6d..3b632b67cb 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -784,6 +784,8 @@ describe('shared primitive guardrails', () => {expect(interactiveSparklineSource).toContain('data-sparkline-tooltip="true"');expect(interactiveSparklineSource).toContain('x1={sparkline.activeHoverCursorX() ?? 0}');expect(interactiveSparklineSource).toContain('y1={0}');+ expect(interactiveSparklineSource).not.toContain('style={{');+ expect(interactiveSparklineSource).not.toContain('style={');expect(interactiveSparklineSource).not.toContain('{(cursorX) => (');expect(interactiveSparklineSource).toContain('data-rendered-series-count');expect(interactiveSparklineSource).not.toContain('createEffect');@@ -808,7 +810,9 @@ describe('shared primitive guardrails', () => {expect(interactiveSparklineModelSource).toContain('buildInteractiveSparklineChartData');expect(interactiveSparklineModelSource).toContain('computeInteractiveSparklineHoverState');expect(interactiveSparklineModelSource).toContain('getInteractiveSparklineCursorXForTimestamp');- expect(interactiveSparklineModelSource).toContain('let tooltipY = clientY - 10;');+ expect(interactiveSparklineModelSource).toContain(+ 'let tooltipY = (mouseY / chartRect.height) * vbH - 6;',+ );expect(interactiveSparklineModelSource).not.toContain('let tooltipY = chartRect.top - 6;');expect(interactiveSparklineModelSource).toContain('downsampleLTTB');expect(interactiveSparklineModelSource).toContain('findNearestMetricPoint');diff --git a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsxindex 656c5b0a0d..e509ec0dba 100644--- a/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/InteractiveSparkline.test.tsx@@ -14,6 +14,8 @@ describe('InteractiveSparkline hover behavior', () => {it('keeps the sparkline on shell, runtime, and model owners', () => {expect(interactiveSparklineSource).toContain('useInteractiveSparklineState');+ expect(interactiveSparklineSource).not.toContain('style={{');+ expect(interactiveSparklineSource).not.toContain('style={');expect(interactiveSparklineSource).not.toContain('createEffect');expect(interactiveSparklineSource).not.toContain('createSignal');expect(interactiveSparklineSource).not.toContain('scheduleSparkline');@@ -367,10 +369,14 @@ describe('InteractiveSparkline hover behavior', () => {expect(tooltip).not.toBeNull();if (!tooltip) return;- const left = Number.parseFloat(tooltip.style.left);- const top = Number.parseFloat(tooltip.style.top);- expect(left).toBeGreaterThanOrEqual(100);- expect(top).toBeGreaterThan(40);+ const tooltipHost = tooltip.closest('foreignObject');+ expect(tooltipHost).not.toBeNull();+ if (!tooltipHost) return;++ const left = Number.parseFloat(tooltipHost.getAttribute('x') ?? 'NaN');+ const top = Number.parseFloat(tooltipHost.getAttribute('y') ?? 'NaN');+ expect(left).toBeGreaterThanOrEqual(0);+ expect(top).toBeGreaterThanOrEqual(0);});it('anchors the tooltip to the pointer instead of the chart top edge', async () => {@@ -419,12 +425,16 @@ describe('InteractiveSparkline hover behavior', () => {expect(tooltip).not.toBeNull();if (!tooltip) return;- const firstTop = Number.parseFloat(tooltip.style.top);+ const tooltipHost = tooltip.closest('foreignObject');+ expect(tooltipHost).not.toBeNull();+ if (!tooltipHost) return;++ const firstTop = Number.parseFloat(tooltipHost.getAttribute('y') ?? 'NaN');fireEvent.mouseMove(svg, { clientX: 120, clientY: 160 });- const secondTop = Number.parseFloat(tooltip.style.top);- expect(secondTop).toBeGreaterThan(firstTop + 30);+ const secondTop = Number.parseFloat(tooltipHost.getAttribute('y') ?? 'NaN');+ expect(secondTop).toBeGreaterThan(firstTop);});it('locks a hovered series on click and unlocks on second click', async () => {diff --git a/frontend-modern/src/components/shared/interactiveSparklineModel.ts b/frontend-modern/src/components/shared/interactiveSparklineModel.tsindex bc052ef9dd..8062d70227 100644--- a/frontend-modern/src/components/shared/interactiveSparklineModel.ts+++ b/frontend-modern/src/components/shared/interactiveSparklineModel.ts@@ -374,21 +374,25 @@ export const buildInteractiveSparklineTopLabel = ({return formatTopLabel ? formatTopLabel(scaleMax) : scaleMax.toFixed(1);};-export const buildInteractiveSparklineAxisTicks = (yMode: 'percent' | 'auto', topLabel: string) => {+export const buildInteractiveSparklineAxisTicks = (+ yMode: 'percent' | 'auto',+ topLabel: string,+ vbH: number,+) => {if (yMode === 'percent') {return [- { label: '100%', top: '0%', anchor: 'top' as const },- { label: '80%', top: '20%', anchor: 'middle' as const },- { label: '60%', top: '40%', anchor: 'middle' as const },- { label: '40%', top: '60%', anchor: 'middle' as const },- { label: '20%', top: '80%', anchor: 'middle' as const },- { label: '0%', top: '100%', anchor: 'bottom' as const },+ { label: '100%', y: 0, anchor: 'top' as const },+ { label: '80%', y: vbH * 0.2, anchor: 'middle' as const },+ { label: '60%', y: vbH * 0.4, anchor: 'middle' as const },+ { label: '40%', y: vbH * 0.6, anchor: 'middle' as const },+ { label: '20%', y: vbH * 0.8, anchor: 'middle' as const },+ { label: '0%', y: vbH, anchor: 'bottom' as const },];}return [- { label: topLabel, top: '0%', anchor: 'top' as const },- { label: '0', top: '100%', anchor: 'bottom' as const },+ { label: topLabel, y: 0, anchor: 'top' as const },+ { label: '0', y: vbH, anchor: 'bottom' as const },];};@@ -405,20 +409,22 @@ export const buildInteractiveSparklineXAxisTicks = ({rangeMs,rangeLabel,timeRange,+ vbW,}: {rangeMs: number;rangeLabel?: string;timeRange: TimeRange;+ vbW: number;}) => {const rangeToken = rangeLabel || timeRange;return [- { left: 0, label: `-${rangeToken}`, anchor: 'start' as const },+ { x: 0, label: `-${rangeToken}`, anchor: 'start' as const },{- left: 50,+ x: vbW * 0.5,label: formatInteractiveSparklineRelativeOffset(rangeMs / 2),anchor: 'middle' as const,},- { left: 100, label: 'now', anchor: 'end' as const },+ { x: vbW, label: 'now', anchor: 'end' as const },];};@@ -612,11 +618,12 @@ export const computeInteractiveSparklineHoverState = ({}const mouseX = Math.max(0, Math.min(clientX - chartRect.left, chartRect.width));+ const mouseY = Math.max(0, Math.min(clientY - chartRect.top, chartRect.height));const chartX = (mouseX / chartRect.width) * vbW;const targetTimestamp = chartData.windowStart + (chartX / vbW) * chartData.rangeMs;const shouldTrackNearest = highlightNearestSeriesOnHover === true;const chartY = shouldTrackNearest- ? (Math.max(0, Math.min(clientY - chartRect.top, chartRect.height)) / chartRect.height) * vbH+ ? (mouseY / chartRect.height) * vbH: 0;const valueToChartY = createInteractiveSparklineValueToY(yMode, chartData.scaleMax, vbH);@@ -699,23 +706,23 @@ export const computeInteractiveSparklineHoverState = ({}const totalValues = focusedTooltip ? tooltipValues.length : values.length;- let tooltipX = clientX;- let tooltipY = clientY - 10;-- if (typeof window !== 'undefined') {- const activeTooltipWidth = focusedTooltip ? 150 : tooltipEstimatedWidth;- const minTooltipX = tooltipPadding + activeTooltipWidth / 2;- const maxTooltipX = Math.max(- minTooltipX,- window.innerWidth - tooltipPadding - activeTooltipWidth / 2,- );- tooltipX = clampInteractiveSparklineValue(tooltipX, minTooltipX, maxTooltipX);-- const shownRows = tooltipValues.length;- const tooltipEstimatedHeight = 22 + shownRows * 16 + (totalValues > shownRows ? 14 : 0);- const minTooltipY = tooltipEstimatedHeight + tooltipPadding;- tooltipY = Math.max(tooltipY, minTooltipY);- }+ let tooltipX = chartX;+ let tooltipY = (mouseY / chartRect.height) * vbH - 6;++ const shownRows = tooltipValues.length;+ const tooltipWidth =+ (focusedTooltip ? tooltipEstimatedWidth * 0.78 : tooltipEstimatedWidth) *+ (vbW / Math.max(chartRect.width, 1));+ const tooltipHeight =+ (22 + shownRows * 16 + (totalValues > shownRows ? 14 : 0)) *+ (vbH / Math.max(chartRect.height, 1));+ const minTooltipX = tooltipPadding + tooltipWidth / 2;+ const maxTooltipX = Math.max(minTooltipX, vbW - tooltipPadding - tooltipWidth / 2);+ tooltipX = clampInteractiveSparklineValue(tooltipX, minTooltipX, maxTooltipX);++ const minTooltipY = tooltipHeight + tooltipPadding;+ const maxTooltipY = Math.max(minTooltipY, vbH - tooltipPadding);+ tooltipY = clampInteractiveSparklineValue(tooltipY, minTooltipY, maxTooltipY);return {x: chartX,diff --git a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts b/frontend-modern/src/components/shared/useInteractiveSparklineState.tsindex 42f7ee3774..4516f43612 100644--- a/frontend-modern/src/components/shared/useInteractiveSparklineState.ts+++ b/frontend-modern/src/components/shared/useInteractiveSparklineState.ts@@ -166,7 +166,7 @@ export function useInteractiveSparklineState(}),);- const axisTicks = createMemo(() => buildInteractiveSparklineAxisTicks(yMode(), topLabel()));+ const axisTicks = createMemo(() => buildInteractiveSparklineAxisTicks(yMode(), topLabel(), vbH));const gridLineY = createMemo(() => buildInteractiveSparklineGridLineY(yMode(), vbH));const gridLineX = createMemo(() => buildInteractiveSparklineGridLineX(vbW));const xAxisTicks = createMemo(() =>@@ -174,6 +174,7 @@ export function useInteractiveSparklineState(rangeMs: chartData().rangeMs,rangeLabel: props.rangeLabel,timeRange: props.timeRange || '1h',+ vbW,}),);diff --git a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts b/frontend-modern/src/stores/__tests__/aiIntelligence.test.tsindex b1c4271fd7..78786e80a9 100644--- a/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts+++ b/frontend-modern/src/stores/__tests__/aiIntelligence.test.ts@@ -25,13 +25,23 @@ vi.mock('@/utils/logger', () => ({},}));+vi.mock('@/stores/sessionPresentationPolicy', () => ({+ presentationPolicyIsDemoMode: vi.fn(() => false),+}));+import { AIAPI } from '@/api/ai';import { aiIntelligenceStore } from '@/stores/aiIntelligence';+import { presentationPolicyIsDemoMode } from '@/stores/sessionPresentationPolicy';++function approvalExpiryInMinutes(minutesFromNow: number): string {+ return new Date(Date.now() + minutesFromNow * 60_000).toISOString();+}describe('aiIntelligenceStore', () => {beforeEach(() => {vi.clearAllMocks();vi.useRealTimers();+ vi.mocked(presentationPolicyIsDemoMode).mockReturnValue(false);});it('loads unified findings with canonical alert identity first', async () => {@@ -316,7 +326,7 @@ describe('aiIntelligenceStore', () => {riskLevel: 'medium',status: 'pending',requestedAt: '2026-03-01T00:01:00Z',- expiresAt: '2026-04-01T00:06:00Z',+ expiresAt: approvalExpiryInMinutes(6),},]);@@ -341,7 +351,7 @@ describe('aiIntelligenceStore', () => {riskLevel: 'high',status: 'pending',requestedAt: '2026-03-01T00:01:00Z',- expiresAt: '2026-04-01T00:06:00Z',+ expiresAt: approvalExpiryInMinutes(6),},{id: 'approval-fix',@@ -354,7 +364,7 @@ describe('aiIntelligenceStore', () => {riskLevel: 'medium',status: 'pending',requestedAt: '2026-03-01T00:01:00Z',- expiresAt: '2026-04-01T00:06:00Z',+ expiresAt: approvalExpiryInMinutes(6),},]);@@ -366,6 +376,17 @@ describe('aiIntelligenceStore', () => {expect(aiIntelligenceStore.pendingApprovalCount).toBe(1);});+ it('fails Patrol approval polling closed in public demo mode', async () => {+ vi.mocked(presentationPolicyIsDemoMode).mockReturnValue(true);++ await aiIntelligenceStore.loadPendingApprovals();++ expect(AIAPI.getPendingApprovals).not.toHaveBeenCalled();+ expect(aiIntelligenceStore.pendingApprovals).toEqual([]);+ expect(aiIntelligenceStore.pendingApprovalCount).toBe(0);+ expect(aiIntelligenceStore.approvalsError).toBeNull();+ });+it('drops expired approvals from Patrol counts and restores needs-attention immediately', async () => {vi.useFakeTimers();vi.setSystemTime(new Date('2026-03-01T00:05:00Z'));@@ -522,7 +543,7 @@ describe('aiIntelligenceStore', () => {riskLevel: 'low',status: 'pending',requestedAt: '2026-03-01T00:01:00Z',- expiresAt: '2026-04-01T00:10:00Z',+ expiresAt: approvalExpiryInMinutes(10),},{id: 'approval-sooner',@@ -535,7 +556,7 @@ describe('aiIntelligenceStore', () => {riskLevel: 'high',status: 'pending',requestedAt: '2026-03-01T00:02:00Z',- expiresAt: '2026-04-01T00:06:00Z',+ expiresAt: approvalExpiryInMinutes(6),},]);diff --git a/frontend-modern/src/stores/aiIntelligence.ts b/frontend-modern/src/stores/aiIntelligence.tsindex f73d5e8126..324f4c5181 100644--- a/frontend-modern/src/stores/aiIntelligence.ts+++ b/frontend-modern/src/stores/aiIntelligence.ts@@ -32,6 +32,7 @@ import type {IntelligenceSummary,} from '@/types/aiIntelligence';import { normalizeIntelligenceSummary } from './aiIntelligenceSummaryModel';+import { presentationPolicyIsDemoMode } from './sessionPresentationPolicy';// ============================================// Enum validation helpers@@ -473,6 +474,10 @@ export const aiIntelligenceStore = {async loadPendingApprovals() {setApprovalsError(null);+ if (presentationPolicyIsDemoMode()) {+ setPendingApprovalsWithExpiryTracking([]);+ return;+ }try {const approvals = (await AIAPI.getPendingApprovals()).filter(isPatrolInvestigationFixApproval);setPendingApprovalsWithExpiryTracking(approvals);diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.tsindex fd93cc8631..89f45cabf0 100644--- a/frontend-modern/src/useAppRuntimeState.ts+++ b/frontend-modern/src/useAppRuntimeState.ts@@ -21,6 +21,7 @@ import { SettingsAPI } from '@/api/settings';import {apiFetch,getOrgID as getSelectedOrgID,+ hasAuth as hasStoredAuthSession,setOrgID as setSelectedOrgID,} from '@/utils/apiClient';import { eventBus } from '@/stores/events';@@ -100,6 +101,22 @@ export const useAppRuntimeState = () => {const getInfrastructureTrendRangeForPrewarm = (): TimeRange => '1h';+ const hasLocalAuthBootstrapHint = (): boolean => {+ if (hasStoredAuthSession()) {+ return true;+ }++ if (typeof window === 'undefined') {+ return false;+ }++ try {+ return Boolean(window.sessionStorage.getItem('pulse_auth_user'));+ } catch {+ return false;+ }+ };+const shouldPrewarmInfrastructure = (): boolean => {if (typeof window === 'undefined') return false;@@ -680,6 +697,12 @@ export const useAppRuntimeState = () => {return;}+ if (window.location.pathname === '/login' && !hasLocalAuthBootstrapHint()) {+ logger.debug('[App] Login route bootstrap has no local auth hint yet');+ setNeedsAuth(true);+ return;+ }+const stateResponse = await apiFetch('/api/state', {headers: {'X-Requested-With': 'XMLHttpRequest',