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.

Prioritize runtime issues in dashboard actions

rcourtmana133d99f4545
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index e370e5c75c..a1b77a7a21 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -609,6 +609,11 @@ primary-action/manual-control contracts from
`frontend-modern/src/utils/aiFindingPresentation.ts` rather than rendering raw
`Pulse Patrol:` titles or generic snooze/dismiss controls that the Patrol
runtime lifecycle rejects.
+That same boundary must also consume the shared attention-queue ordering from
+`frontend-modern/src/utils/aiFindingPresentation.ts` through
+`frontend-modern/src/hooks/useDashboardActions.ts`, so Patrol-blinding runtime
+issues sort ahead of same-severity infrastructure findings in the dashboard
+action panel instead of inheriting arbitrary store order.
Feature-owned alert shells under `frontend-modern/src/features/alerts/` now
also treat shared action runtime as a first-class feature owner instead of
diff --git a/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts b/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
index becd457c3e..16aad12024 100644
--- a/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
+++ b/frontend-modern/src/hooks/__tests__/useDashboardActions.test.ts
@@ -31,6 +31,7 @@ vi.mock('@/utils/logger', () => ({
import { AIAPI } from '@/api/ai';
import { useDashboardActions } from '@/hooks/useDashboardActions';
+import { sortFindingsForAttentionQueue } from '@/utils/aiFindingPresentation';
describe('useDashboardActions', () => {
beforeEach(() => {
@@ -107,4 +108,30 @@ describe('useDashboardActions', () => {
dispose();
});
+
+ it('prioritizes Patrol runtime findings in the dashboard attention queue', () => {
+ expect(
+ sortFindingsForAttentionQueue([
+ {
+ id: 'infra-warning',
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'vm-101',
+ resourceName: 'db-01',
+ title: 'Disk nearly full',
+ detectedAt: '2026-03-01T00:00:00Z',
+ } as never,
+ {
+ id: 'runtime-warning',
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'ai-service',
+ resourceName: 'Pulse Patrol Service',
+ title: 'Pulse Patrol: Insufficient API credits',
+ lastSeenAt: '2026-03-01T00:05:00Z',
+ detectedAt: '2026-03-01T00:01:00Z',
+ } as never,
+ ]).map((finding) => finding.id),
+ ).toEqual(['runtime-warning', 'infra-warning']);
+ });
});
diff --git a/frontend-modern/src/hooks/useDashboardActions.ts b/frontend-modern/src/hooks/useDashboardActions.ts
index 4162f2885d..30f23d2f8d 100644
--- a/frontend-modern/src/hooks/useDashboardActions.ts
+++ b/frontend-modern/src/hooks/useDashboardActions.ts
@@ -4,6 +4,7 @@ import type { UnifiedFinding } from '@/stores/aiIntelligence';
import { aiIntelligenceStore } from '@/stores/aiIntelligence';
import type { ApprovalRequest } from '@/api/ai';
import { hasFeature } from '@/stores/license';
+import { sortFindingsForAttentionQueue } from '@/utils/aiFindingPresentation';
export interface DashboardActions {
pendingApprovals: Accessor<ApprovalRequest[]>;
@@ -54,7 +55,7 @@ export function useDashboardActions(alertsList: Accessor<Alert[]>): DashboardAct
const findingsNeedingAttention = createMemo(() => {
if (!hasPatrol()) return [];
- return aiIntelligenceStore.findingsNeedingAttention;
+ return sortFindingsForAttentionQueue(aiIntelligenceStore.findingsNeedingAttention);
});
const totalActionCount = createMemo(
diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.ts
index c748ea4484..f9a7c8d55c 100644
--- a/frontend-modern/src/utils/aiFindingPresentation.ts
+++ b/frontend-modern/src/utils/aiFindingPresentation.ts
@@ -433,6 +433,33 @@ export const getFindingManualControlsPresentation = (
dismiss: true,
};
+export const sortFindingsForAttentionQueue = (
+ findings: UnifiedFinding[],
+): UnifiedFinding[] =>
+ [...findings].sort((a, b) => {
+ const aOutcome =
+ a.status === 'active' && a.investigationOutcome
+ ? getInvestigationOutcomeSortOrder(a.investigationOutcome)
+ : 3;
+ const bOutcome =
+ b.status === 'active' && b.investigationOutcome
+ ? getInvestigationOutcomeSortOrder(b.investigationOutcome)
+ : 3;
+ if (aOutcome !== bOutcome) return aOutcome - bOutcome;
+
+ const aSeverity = getFindingSeveritySortOrder(a.severity);
+ const bSeverity = getFindingSeveritySortOrder(b.severity);
+ if (aSeverity !== bSeverity) return aSeverity - bSeverity;
+
+ const aRuntime = getFindingActiveRuntimeSortOrder(a);
+ const bRuntime = getFindingActiveRuntimeSortOrder(b);
+ if (aRuntime !== bRuntime) return aRuntime - bRuntime;
+
+ const aRecency = getFindingRecencyPresentation(a);
+ const bRecency = getFindingRecencyPresentation(b);
+ return new Date(bRecency.timestamp).getTime() - new Date(aRecency.timestamp).getTime();
+ });
+
export const getFindingRecencyPresentation = (
finding: Pick<UnifiedFinding, 'status' | 'detectedAt' | 'lastSeenAt'>,
): FindingRecencyPresentation => {