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.

Fail closed on unknown Patrol findings snapshots

rcourtman2f2c650409d4
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 43475b3014..69a6b145b9 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -268,6 +268,10 @@ That same fail-closed snapshot rule applies to inline run-history findings as
well. Expanded run cards may render inline findings only when the run carries
an explicit `finding_ids` snapshot; legacy runs without snapshot ids must stay
unknown rather than being coerced into an empty findings snapshot.
+That same rule applies to the primary findings workspace when a run is
+selected. A selected run without `finding_ids` must not borrow global Patrol
+findings, filter buckets, or queue counts; the findings surface should enter an
+explicit snapshot-unavailable state instead.
That same findings surface should keep its section chrome functional rather
than promotional. Inside the Patrol findings tab, the selected tab already
names the surface, so the findings card should not add another in-card product
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 02d9f7e775..e4bb8b9267 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -145,7 +145,14 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
});
// Filter and sort findings
+ const hasUnknownRunSnapshot = createMemo(
+ () => props.runSnapshot !== undefined && props.filterFindingIds === undefined,
+ );
const filteredFindings = createMemo(() => {
+ if (hasUnknownRunSnapshot()) {
+ return [];
+ }
+
let findings = [...aiIntelligenceStore.findings];
// Filter by resource if specified
@@ -224,6 +231,9 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
),
);
const runSnapshotScopedPatrolFindings = createMemo(() => {
+ if (hasUnknownRunSnapshot()) {
+ return [];
+ }
if (props.filterFindingIds === undefined) {
return allPatrolFindings();
}
@@ -231,7 +241,7 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
return allPatrolFindings().filter((finding) => snapshotFindingIds.has(finding.id));
});
const useRunSnapshotScopedControls = createMemo(
- () => props.runSnapshot !== undefined && props.filterFindingIds !== undefined,
+ () => props.runSnapshot !== undefined,
);
const scopedNeedsAttentionCount = createMemo(() => {
const attentionIds = new Set(aiIntelligenceStore.findingsNeedingAttention.map((f) => f.id));
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 6d8bb1ef08..c51f9b7da5 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -462,6 +462,7 @@ describe('aiFindingPresentation', () => {
it('hides the filter bar when there are no Patrol findings or special buckets to navigate', () => {
expect(findingsPanelSource).toContain('const showFilterControls = createMemo(');
+ expect(findingsPanelSource).toContain('const hasUnknownRunSnapshot = createMemo(');
expect(findingsPanelSource).toContain('const useRunSnapshotScopedControls = createMemo(');
expect(findingsPanelSource).toContain('const runSnapshotScopedPatrolFindings = createMemo(');
expect(findingsPanelSource).toContain('const filterCounts = createMemo(() => ({');
@@ -481,6 +482,14 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('buildFindingFilterOptions(filterCounts())');
});
+ it('fails closed on legacy run snapshots instead of showing global findings in a selected run view', () => {
+ expect(findingsPanelSource).toContain('if (hasUnknownRunSnapshot()) {');
+ expect(findingsPanelSource).toContain('return [];');
+ expect(findingsPanelSource).toContain(
+ "() => props.runSnapshot !== undefined && props.filterFindingIds === undefined",
+ );
+ });
+
it('uses explicit textual separators in finding metadata instead of relying on visual spacing', () => {
expect(findingsPanelSource).toContain("{' · '}acknowledged");
expect(findingsPanelSource).toContain("{' · '}last investigated");
diff --git a/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
index 1dbbfae010..31ba5dbe2e 100644
--- a/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolEmptyStatePresentation.test.ts
@@ -144,4 +144,24 @@ describe('patrolEmptyStatePresentation', () => {
tone: 'warning',
});
});
+
+ it('fails closed when a selected run has no findings snapshot ids', () => {
+ expect(
+ getPatrolFindingsEmptyState({
+ filter: 'all',
+ runSnapshot: {
+ resources_checked: 1,
+ scope_resource_ids: ['seed-resource'],
+ effective_scope_resource_ids: ['expanded-a'],
+ finding_ids: undefined,
+ status: 'issues_found',
+ error_count: 0,
+ },
+ }),
+ ).toEqual({
+ title: 'Findings snapshot unavailable for this run',
+ body: 'This Patrol run predates findings snapshots, so run-specific findings cannot be verified.',
+ tone: 'warning',
+ });
+ });
});
diff --git a/frontend-modern/src/utils/patrolEmptyStatePresentation.ts b/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
index a953b10515..7921b8aa62 100644
--- a/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
+++ b/frontend-modern/src/utils/patrolEmptyStatePresentation.ts
@@ -122,6 +122,14 @@ function getPatrolRunSnapshotEmptyState(
};
}
+function getPatrolRunSnapshotUnavailableEmptyState(): PatrolFindingsEmptyStateCopy {
+ return {
+ title: 'Findings snapshot unavailable for this run',
+ body: 'This Patrol run predates findings snapshots, so run-specific findings cannot be verified.',
+ tone: 'warning',
+ };
+}
+
export function getPatrolFindingsEmptyState(args: {
filter: FindingsFilter;
overallHealth?: IntelligenceHealthScore;
@@ -138,6 +146,14 @@ export function getPatrolFindingsEmptyState(args: {
return getPatrolRunSnapshotEmptyState(args.runSnapshot);
}
+ if (
+ args.filter === 'all' &&
+ args.runSnapshot &&
+ args.runSnapshot.finding_ids === undefined
+ ) {
+ return getPatrolRunSnapshotUnavailableEmptyState();
+ }
+
if (args.filter !== 'active') {
return {
...getFindingEmptyStateCopy(args.filter),