Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Remove Patrol empty-state timing duplication

rcourtman173ab14a979c
diff --git a/docs/release-control/v6/internal/subsystems/api-contracts.md b/docs/release-control/v6/internal/subsystems/api-contracts.md
index 47d29d0255..5a4ee7fd16 100644
--- a/docs/release-control/v6/internal/subsystems/api-contracts.md
+++ b/docs/release-control/v6/internal/subsystems/api-contracts.md
@@ -175,6 +175,7 @@ Own canonical runtime payload shapes between backend and frontend.
9. Treat active Patrol runtime transport as compatible with factual activity surfaces: when the runtime is currently running, frontend consumers may surface in-progress activity context, but they must not replace the activity strip with a second assessment verdict derived from runtime state alone
10. Treat Patrol recency as a singular transport-driven fact: once header metadata, verification copy, or the findings footer already present the governed Patrol timing context, frontend summary consumers must not derive an extra timing pill from the same payloads inside the primary summary card
11. Treat Patrol findings counts as a singular supporting surface as well: when the summary shell already exposes count cards for active findings, warnings, criticals, and fixes, the primary assessment card must not repeat those same payload-derived counts as secondary badges
+12. Treat Patrol schedule and recency as header-owned metadata on the main Patrol page: findings empty-state consumers should not receive or restate `next_patrol_at`, `last_patrol_at`, or interval timing once those transport fields are already presented by the primary header and verification shell
## Current State
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 9c38217b3a..2d4ff2a7a9 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -204,6 +204,10 @@ The same ownership split applies to supporting counts: if the Patrol summary
surface renders the metric strip for active findings, warnings, criticals, and
fixes, the primary summary card should not repeat those same counts in badge
form beside the assessment and verification copy.
+That same ownership rule applies to empty-state timing metadata. When the
+Patrol page header already carries schedule and recency context, the findings
+empty state should not add its own footer for `Last activity`, `Next run`, or
+run interval text.
Those supporting cards must also keep their content factual and count-based:
active findings, critical findings, warnings, and fixes are valid secondary
readouts, while labels such as `Issues detected` or `Partial verification`
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 1eababecb4..7c6b7e6ccc 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -180,17 +180,12 @@ plain-text renders: the latest-run segment must keep an explicit textual
separator between run kind and result, so degraded entries read as
`Scoped run · error` rather than collapsing into concatenated strings like
`Scoped runerror`.
-That same Patrol-owned timing contract also applies to the findings empty
-state footer. `frontend-modern/src/components/AI/FindingsPanel.tsx` must use
-the canonical Patrol countdown semantics for `next_patrol_at` instead of
-formatting future schedule timestamps through generic relative-time helpers;
-otherwise the findings footer can contradict the header by rendering the same
-next scheduled patrol as `just now` while the main Patrol shell correctly
-shows a multi-hour countdown.
-That footer must also use the canonical Patrol recency label rather than a
-generic `Last:` prefix, so scoped-only recent activity is rendered as
-`Last activity` and does not silently revert to patrol/full-verification
-language in the findings surface.
+The findings empty state must also stay subordinate to the Patrol header and
+assessment shell rather than mirroring their timing metadata. In the primary
+Patrol page, `frontend-modern/src/components/AI/FindingsPanel.tsx` should
+explain the absence of active findings without repeating `Last activity`,
+`Next run`, or interval schedule details that already belong to the header and
+verification hierarchy above.
When Patrol is currently running, that strip should still stay factual rather
than switching to another verdict label: the runtime may add an explicit
in-progress indicator, but the primary activity label remains recent activity
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 7ab018bdfd..d561140856 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -16,7 +16,7 @@ import { Card } from '@/components/shared/Card';
import { aiIntelligenceStore, type UnifiedFinding } from '@/stores/aiIntelligence';
import { notificationStore } from '@/stores/notifications';
import { aiChatStore } from '@/stores/aiChat';
-import { InvestigationSection, ApprovalSection, CountdownTimer } from '@/components/patrol';
+import { InvestigationSection, ApprovalSection } from '@/components/patrol';
import { AIAPI, type RemediationPlan } from '@/api/ai';
import type { PatrolRuntimeState } from '@/api/patrol';
import { getApprovalRiskPresentation } from '@/utils/approvalRiskPresentation';
@@ -59,10 +59,6 @@ interface FindingsPanelProps {
filterOverride?: 'all' | 'active' | 'resolved' | 'approvals' | 'attention';
filterFindingIds?: string[];
showControls?: boolean;
- nextPatrolAt?: string;
- lastPatrolAt?: string;
- lastPatrolLabel?: string;
- patrolIntervalMs?: number;
scopeResourceIds?: string[];
scopeResourceTypes?: string[];
showScopeWarnings?: boolean;
@@ -381,18 +377,6 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const formatTime = (isoString: string) => formatRelativeTime(isoString, { compact: true });
- const formatInterval = (ms: number) => {
- const hours = Math.floor(ms / 3600000);
- const minutes = Math.floor((ms % 3600000) / 60000);
- if (hours >= 24) {
- const days = Math.floor(hours / 24);
- return days === 1 ? '1 day' : `${days} days`;
- }
- if (hours > 0 && minutes > 0) return `${hours}h ${minutes}m`;
- if (hours > 0) return hours === 1 ? '1 hour' : `${hours} hours`;
- return minutes === 1 ? '1 minute' : `${minutes} minutes`;
- };
-
// Get meaningful resolution reason based on finding type
const getResolutionReason = (finding: UnifiedFinding): string => {
const resolvedTime = finding.resolvedAt ? formatTime(finding.resolvedAt) : '';
@@ -1144,70 +1128,6 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
<p class="text-xs mt-1">{emptyStateCopy().body}</p>
</Show>
</div>
- <Show when={props.nextPatrolAt || props.lastPatrolAt || props.patrolIntervalMs}>
- <div class="mt-2 pt-3 border-t border-border w-full max-w-xs">
- <div class="flex items-center justify-center gap-4 text-xs">
- <Show when={props.lastPatrolAt}>
- <div class="flex items-center gap-1.5">
- <svg
- class="w-3.5 h-3.5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"
- />
- </svg>
- <span>{props.lastPatrolLabel ?? 'Last'}: {formatTime(props.lastPatrolAt!)}</span>
- </div>
- </Show>
- <Show when={props.nextPatrolAt}>
- <div class="flex items-center gap-1.5 text-blue-600 dark:text-blue-400">
- <svg
- class="w-3.5 h-3.5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M13 10V3L4 14h7v7l9-11h-7z"
- />
- </svg>
- <CountdownTimer targetDate={props.nextPatrolAt!} prefix="Next: " />
- </div>
- </Show>
- <Show
- when={
- !props.nextPatrolAt && !props.lastPatrolAt && props.patrolIntervalMs
- }
- >
- <div class="flex items-center gap-1.5 text-muted">
- <svg
- class="w-3.5 h-3.5"
- fill="none"
- stroke="currentColor"
- viewBox="0 0 24 24"
- >
- <path
- stroke-linecap="round"
- stroke-linejoin="round"
- stroke-width="2"
- d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"
- />
- </svg>
- <span>Runs every {formatInterval(props.patrolIntervalMs!)}</span>
- </div>
- </Show>
- </div>
- </div>
- </Show>
</div>
</Show>
<Show when={filter() === 'attention'}>{emptyStateCopy().title}</Show>
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index a5a932e219..d1c3750b40 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -158,15 +158,12 @@ describe('aiFindingPresentation', () => {
});
});
- describe('patrol schedule presentation', () => {
- it('keeps the next patrol footer on the canonical countdown timer', () => {
- expect(findingsPanelSource).toContain('<CountdownTimer targetDate={props.nextPatrolAt!} prefix="Next: " />');
- expect(findingsPanelSource).not.toContain('Next: {formatTime(props.nextPatrolAt!)}');
- });
-
- it('uses the supplied canonical patrol recency label in the footer', () => {
- expect(findingsPanelSource).toContain("{props.lastPatrolLabel ?? 'Last'}: {formatTime(props.lastPatrolAt!)}");
- expect(findingsPanelSource).not.toContain('<span>Last: {formatTime(props.lastPatrolAt!)}</span>');
+ describe('patrol empty-state presentation', () => {
+ it('does not duplicate patrol timing metadata in the findings empty state', () => {
+ expect(findingsPanelSource).not.toContain('CountdownTimer');
+ expect(findingsPanelSource).not.toContain('lastPatrolLabel');
+ expect(findingsPanelSource).not.toContain('Runs every');
+ expect(findingsPanelSource).not.toContain('Next: ');
});
});
diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
index 2563772430..eb63c13abd 100644
--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx
@@ -4,16 +4,10 @@ import { ApprovalBanner, PatrolStatusBar, RunHistoryPanel } from '@/components/p
import { getFindingSeverityToneClasses } from '@/utils/aiFindingPresentation';
import { formatRelativeTime } from '@/utils/format';
import { formatTriggerReason } from '@/utils/patrolFormat';
-import { getPatrolRecencyPresentation } from '@/utils/patrolSummaryPresentation';
import type { PatrolIntelligenceState } from './usePatrolIntelligenceState';
export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceState }) {
const state = props.state;
- const recency = () =>
- getPatrolRecencyPresentation({
- runs: state.patrolRunHistory() ?? [],
- lastPatrolAt: state.patrolStatus()?.last_patrol_at,
- });
return (
<>
@@ -100,10 +94,6 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt
</Show>
<FindingsPanel
- nextPatrolAt={state.patrolStatus()?.next_patrol_at}
- lastPatrolAt={state.patrolStatus()?.last_patrol_at}
- lastPatrolLabel={recency().label}
- patrolIntervalMs={state.patrolStatus()?.interval_ms}
filterOverride={state.selectedRun() ? 'all' : state.findingsFilterOverride()}
filterFindingIds={state.selectedRunFindingIds()}
scopeResourceIds={state.selectedRunScopeResourceIds()}
diff --git a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
index 44ca4897d5..d56df78f3b 100644
--- a/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
+++ b/frontend-modern/src/pages/__tests__/AIIntelligence.test.tsx
@@ -12,6 +12,10 @@ const { findingsPanelState, runHistoryState, intelligenceState } = vi.hoisted(()
scopeResourceIds?: string[];
scopeResourceTypes?: string[];
showScopeWarnings?: boolean;
+ nextPatrolAt?: string;
+ lastPatrolAt?: string;
+ lastPatrolLabel?: string;
+ patrolIntervalMs?: number;
} | null,
},
runHistoryState: {
@@ -192,6 +196,12 @@ vi.mock('@/components/AI/FindingsPanel', () => ({
: undefined,
showScopeWarnings:
typeof props.showScopeWarnings === 'boolean' ? props.showScopeWarnings : undefined,
+ nextPatrolAt: typeof props.nextPatrolAt === 'string' ? props.nextPatrolAt : undefined,
+ lastPatrolAt: typeof props.lastPatrolAt === 'string' ? props.lastPatrolAt : undefined,
+ lastPatrolLabel:
+ typeof props.lastPatrolLabel === 'string' ? props.lastPatrolLabel : undefined,
+ patrolIntervalMs:
+ typeof props.patrolIntervalMs === 'number' ? props.patrolIntervalMs : undefined,
};
return <div data-testid="findings-panel" />;
},
@@ -821,6 +831,7 @@ describe('AIIntelligence entitlement gating', () => {
expect(screen.getAllByText('Active findings')).toHaveLength(1);
expect(screen.getAllByText('Warnings')).toHaveLength(1);
expect(screen.getAllByText('Critical')).toHaveLength(1);
+ expect(findingsPanelState.latestProps).not.toBeNull();
});
expect(screen.queryByText('No issues found')).not.toBeInTheDocument();
@@ -832,6 +843,10 @@ describe('AIIntelligence entitlement gating', () => {
'Patrol coverage is incomplete: recent activity was limited to scoped runs and ended with errors, so overall health is not fully verified.',
),
).toHaveLength(1);
+ expect(findingsPanelState.latestProps?.nextPatrolAt).toBeUndefined();
+ expect(findingsPanelState.latestProps?.lastPatrolAt).toBeUndefined();
+ expect(findingsPanelState.latestProps?.lastPatrolLabel).toBeUndefined();
+ expect(findingsPanelState.latestProps?.patrolIntervalMs).toBeUndefined();
});
it('describes both findings and incomplete coverage when active issues exist', async () => {