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.

Keep Patrol findings from showing all-clear copy

rcourtman450e7516f048
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index c2328f5fef..937501c95f 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -81,6 +81,11 @@ Patrol-specific presentation helpers.
selected-run findings panel, badges, and active-finding summaries must not
infer current Patrol evidence by filtering the unified threshold/AI feed.
2. Keep Patrol-specific copy and badge logic inside the governed Patrol presentation helpers instead of page-local branches
+ Patrol assessment copy must not present an all-clear health prediction while
+ active Patrol findings or Patrol runtime issues are still present. The
+ canonical summary helper owns that conflict resolution so the visible
+ assessment title, description, metrics, and recommended next step all speak
+ from the same current findings state.
3. Update this contract whenever a new Patrol-specific page, store, helper, or presentation component becomes canonical runtime surface area
4. Keep retired hosted-model and trial-like Patrol acquisition copy out of the
normal self-hosted GA app. Patrol may parse legacy transport fields, but
diff --git a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
index 8d571dfe3b..a8eea75638 100644
--- a/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolSummaryPresentation.test.ts
@@ -82,6 +82,68 @@ describe('getPatrolSummaryPresentation', () => {
});
});
+ it('does not reuse an all-clear health prediction while active infrastructure findings exist', () => {
+ expect(
+ getPatrolAssessmentPresentation({
+ overallHealth: {
+ score: 95,
+ grade: 'A',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Infrastructure is healthy with no significant issues detected.',
+ },
+ warningFindings: 1,
+ activeFindings: [
+ {
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'vm-100',
+ resourceName: 'web-1',
+ title: 'Backup age drift',
+ },
+ ] as never,
+ }),
+ ).toEqual({
+ title: 'Issues detected',
+ description:
+ 'Patrol surfaced 1 active warning finding in your infrastructure. Review the active findings for more detail.',
+ eyebrow: 'Patrol assessment',
+ compactLabel: 'Issues detected',
+ tone: 'warning',
+ });
+ });
+
+ it('does not reuse an all-clear health prediction while a Patrol runtime issue is active', () => {
+ expect(
+ getPatrolAssessmentPresentation({
+ overallHealth: {
+ score: 95,
+ grade: 'A',
+ trend: 'stable',
+ factors: [],
+ prediction: 'Infrastructure is healthy with no significant issues detected.',
+ },
+ warningFindings: 1,
+ activeFindings: [
+ {
+ status: 'active',
+ severity: 'warning',
+ resourceId: 'ai-service',
+ resourceName: 'Pulse Patrol Service',
+ title: 'Pulse Patrol: Provider billing or quota issue',
+ },
+ ] as never,
+ }),
+ ).toEqual({
+ title: 'Patrol runtime issue',
+ description:
+ 'Patrol has an active runtime issue: Provider billing or quota issue. Review the Patrol runtime issue for more detail.',
+ eyebrow: 'Patrol assessment',
+ compactLabel: 'Patrol runtime issue',
+ tone: 'warning',
+ });
+ });
+
it('combines active findings with the coverage caveat when both are present', () => {
expect(
getPatrolAssessmentPresentation({
diff --git a/frontend-modern/src/utils/patrolSummaryPresentation.ts b/frontend-modern/src/utils/patrolSummaryPresentation.ts
index 00e15c53ba..2f531728b2 100644
--- a/frontend-modern/src/utils/patrolSummaryPresentation.ts
+++ b/frontend-modern/src/utils/patrolSummaryPresentation.ts
@@ -422,6 +422,21 @@ function joinAssessmentParts(parts: string[]): string {
return `${parts.slice(0, -1).join(', ')}, and ${parts.at(-1)}`;
}
+function predictionReadsAsAllClear(prediction: string | undefined): boolean {
+ const normalized = String(prediction || '')
+ .trim()
+ .toLowerCase();
+ if (!normalized) return false;
+
+ return (
+ normalized.includes('healthy with no significant issue') ||
+ normalized.includes('no significant issues detected') ||
+ normalized.includes('no active issues') ||
+ normalized.includes('no issues detected') ||
+ normalized.includes('all clear')
+ );
+}
+
function getFindingAssessmentDescription(args: {
criticalFindings?: number;
warningFindings?: number;
@@ -450,10 +465,12 @@ function getFindingAssessmentDescription(args: {
return `${runtimeSummary} Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.`;
}
- return (
- args.overallHealth?.prediction?.trim() ||
- `${runtimeSummary} Review the Patrol runtime issue for more detail.`
- );
+ const prediction = args.overallHealth?.prediction?.trim();
+ if (prediction && !predictionReadsAsAllClear(prediction)) {
+ return prediction;
+ }
+
+ return `${runtimeSummary} Review the Patrol runtime issue for more detail.`;
}
const findingSummaryParts: string[] = [];
@@ -490,10 +507,12 @@ function getFindingAssessmentDescription(args: {
return `${findingSummary} Recent coverage is also incomplete, so the rest of your infrastructure is not fully verified.`;
}
- return (
- args.overallHealth?.prediction?.trim() ||
- `${findingSummary} Review the active findings for more detail.`
- );
+ const prediction = args.overallHealth?.prediction?.trim();
+ if (prediction && !predictionReadsAsAllClear(prediction)) {
+ return prediction;
+ }
+
+ return `${findingSummary} Review the active findings for more detail.`;
}
function normalizeRunType(type: string | undefined): string {