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 Patrol runtime issues in findings sort

rcourtman703c8bdd3f5b
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 31d00a663f..6496ce9954 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -186,6 +186,10 @@ metrics strip as well. When Patrol-owned runtime issues are active, the
supporting metrics must stop counting them under generic infrastructure
`Warnings` or `Active findings`; the strip should break out `Runtime issues`
separately and reserve infrastructure finding counts for actual estate issues.
+The findings list must respect that same trust priority. When Patrol-owned
+runtime issues share a severity tier with ordinary infrastructure findings, the
+runtime issue should sort first within that tier so Patrol blindness is not
+buried under same-severity estate warnings.
The summary recency chip must follow the same governed scope distinction. When
the latest completed activity was only a scoped run, the summary should label
that timestamp as `Last activity` instead of `Last patrol`; `Last full patrol`
diff --git a/frontend-modern/src/components/AI/FindingsPanel.tsx b/frontend-modern/src/components/AI/FindingsPanel.tsx
index 016d65de8a..f5f77a4dfb 100644
--- a/frontend-modern/src/components/AI/FindingsPanel.tsx
+++ b/frontend-modern/src/components/AI/FindingsPanel.tsx
@@ -35,6 +35,7 @@ import {
buildFindingFilterOptions,
formatFindingLifecycleType,
formatFindingLoopState,
+ getFindingActiveRuntimeSortOrder,
getFindingSeveritySortOrder,
getFindingResolutionReason,
getFindingLoopStateBadgeClasses,
@@ -193,6 +194,10 @@ export const FindingsPanel: Component<FindingsPanelProps> = (props) => {
const bPriority = getFindingSeveritySortOrder(b.severity);
if (aPriority !== bPriority) return aPriority - bPriority;
+ const aRuntimePriority = getFindingActiveRuntimeSortOrder(a);
+ const bRuntimePriority = getFindingActiveRuntimeSortOrder(b);
+ if (aRuntimePriority !== bRuntimePriority) return aRuntimePriority - bRuntimePriority;
+
// Within same severity, sort acknowledged findings below unacknowledged
const aAcked = a.acknowledgedAt ? 1 : 0;
const bAcked = b.acknowledgedAt ? 1 : 0;
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
index 6851669825..fccc87c688 100644
--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts
@@ -5,6 +5,7 @@ import {
buildFindingFilterOptions,
formatFindingLifecycleType,
formatFindingLoopState,
+ getFindingActiveRuntimeSortOrder,
getFindingEmptyStateCopy,
getFindingManualControlsPresentation,
getFindingPrimaryActionPresentation,
@@ -59,6 +60,25 @@ describe('aiFindingPresentation', () => {
expect(getFindingSeveritySortOrder('info')).toBe(3);
});
+ it('prioritizes active patrol runtime findings within the same severity tier', () => {
+ expect(
+ getFindingActiveRuntimeSortOrder({
+ status: 'active',
+ resourceId: 'ai-service',
+ resourceName: 'Pulse Patrol Service',
+ title: 'Pulse Patrol: Insufficient API credits',
+ }),
+ ).toBe(0);
+ expect(
+ getFindingActiveRuntimeSortOrder({
+ status: 'active',
+ resourceId: 'vm-101',
+ resourceName: 'db-01',
+ title: 'Disk nearly full',
+ }),
+ ).toBe(1);
+ });
+
it('returns compact severity labels', () => {
expect(getFindingSeverityCompactLabel('critical')).toBe('CRIT');
expect(getFindingSeverityCompactLabel('warning')).toBe('WARN');
@@ -338,6 +358,11 @@ describe('aiFindingPresentation', () => {
expect(findingsPanelSource).toContain('manualControls.dismiss');
});
+ it('routes same-severity ordering through the shared patrol runtime sort helper', () => {
+ expect(findingsPanelSource).toContain('getFindingActiveRuntimeSortOrder(a)');
+ expect(findingsPanelSource).toContain('getFindingActiveRuntimeSortOrder(b)');
+ });
+
it('only shows the sort control when there are multiple Patrol findings to sort', () => {
expect(findingsPanelSource).toContain('<Show when={patrolFindings().length > 1}>');
expect(findingsPanelSource).toContain('<option value="severity">By Severity</option>');
diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.ts
index 7d428e3301..fe2af78fe8 100644
--- a/frontend-modern/src/utils/aiFindingPresentation.ts
+++ b/frontend-modern/src/utils/aiFindingPresentation.ts
@@ -246,6 +246,10 @@ export const getFindingSeveritySortOrder = (
severity: UnifiedFinding['severity'] | string,
): number => FINDING_SEVERITY_SORT_ORDER[severity] ?? 4;
+export const getFindingActiveRuntimeSortOrder = (
+ finding: Pick<UnifiedFinding, 'status' | 'resourceId' | 'resourceName' | 'title'>,
+): number => (finding.status === 'active' && isPatrolRuntimeFinding(finding) ? 0 : 1);
+
export const getFindingSeverityCompactLabel = (
severity: UnifiedFinding['severity'] | string,
): string => FINDING_SEVERITY_COMPACT_LABELS[severity] || String(severity).toUpperCase();