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.

Name failed digest runs and keep the Investigated tile honest

rcourtman04a49ed72a55
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index 03fbc296fa..8b4bf0b36c 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -2782,10 +2782,14 @@ short, reads "Interrupted — will retry" in the neutral tone. It stays out of
the attention queue, its collapsed row says "Will retry" rather than "Needs
review", and its run note renders as information, not as an error. Neither
counts as a failed fix. The This week card names both with the digest email's
-wording and order. The Patrol record's outcome badge uses the shared outcome
-label, and like the investigation header the record shows its run status only
-until the run has an outcome, so an interrupted run no longer shows "Failed"
-beside "will retry". Proofs:
+wording and order, along with the digest's `failed` bucket for a run that
+ended on an error with no outcome ("ended with an error"). When a week's
+investigations have no worded outcome, the Investigated tile shows the count
+alone: "No issues needed a closer look" and the watch-only sentence are kept
+for a week with no investigations. The Patrol record's outcome badge uses the
+shared outcome label, and like the investigation header the record shows its
+run status only until the run has an outcome, so an interrupted run no longer
+shows "Failed" beside "will retry". Proofs:
`frontend-modern/src/stores/__tests__/aiIntelligence.test.ts`,
`frontend-modern/src/components/patrol/__tests__/InvestigationSection.test.tsx`,
`frontend-modern/src/features/patrol/__tests__/patrolInvestigationContextModel.test.ts`
diff --git a/frontend-modern/browser-verification/196f770aad8a3198.json b/frontend-modern/browser-verification/196f770aad8a3198.json
new file mode 100644
index 0000000000..58b8f5925c
--- /dev/null
+++ b/frontend-modern/browser-verification/196f770aad8a3198.json
@@ -0,0 +1,43 @@
+{
+ "version": 1,
+ "base_sha": "5c7d2c6e677575d2894cda5147406957708767ce",
+ "verified_at": "2026-10-23T10:15:43Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx": "47d96594cd9597c299db948e9c057b55943bde65f4d714027c3446635b8aa7b0"
+ },
+ "routes": [
+ "/patrol/activity"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 1000
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Private Pulse Pro stack (enterprise binary from pulse-enterprise#139 on this tree, Vite dev server of this change, seeded Patrol findings and runs); for the scenarios other than live, Playwright fulfilled the digest request with the live response and a replaced investigations block, the shape the digest-count backend change emits",
+ "Live digest (3 unclassified, 2 interrupted): the Investigated tile reads 5 with \"3 finished without a clear conclusion,\" and \"2 interrupted by a restart.\"",
+ "failed bucket beside unclassified and interrupted runs (total 6): \"2 ended with an error,\" then \"3 finished without a clear conclusion.\"",
+ "failed after timeouts (total 3): \"2 timed out,\" then \"1 ended with an error.\"",
+ "Only an outcome the card has no wording for (total 4): the tile shows 4 with no detail line, instead of \"No issues needed a closer look.\"",
+ "Empty week (total 0): \"No issues needed a closer look.\" as before",
+ "1440 dark and light and 390 dark for every scenario; no page or console errors"
+ ],
+ "interactions": [
+ "Opened the Patrol Activity tab for each scenario and viewport and read the This week card"
+ ],
+ "browser": {
+ "client": "playwright 1.62.1",
+ "engine": "Chromium",
+ "version": "151.0.7922.34 headless"
+ },
+ "scope": "Pulse Pro binary on a mock estate with seeded Patrol state; four of the five digest scenarios are fulfilled responses, not backend output."
+}
diff --git a/frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx b/frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx
index 2bea8e8b20..d3f8b38a63 100644
--- a/frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx
+++ b/frontend-modern/src/features/patrol/PatrolWeeklyDigestCard.tsx
@@ -26,14 +26,19 @@ const usdFormatter = new Intl.NumberFormat(undefined, {
maximumFractionDigits: 2,
});
+// Besides the investigation outcomes, the digest counts a run that ended on an
+// error with no outcome as "failed", the bucket telemetry uses for that state.
+type DigestOutcomeKey = InvestigationOutcome | 'failed';
+
// Same order and wording as the digest email (PatrolDigestOutcomeOrder and
// internal/api/patrol_digest_email.go), most actionable first.
-const INVESTIGATION_OUTCOME_COPY: Array<{ key: InvestigationOutcome; label: string }> = [
+const INVESTIGATION_OUTCOME_COPY: Array<{ key: DigestOutcomeKey; label: string }> = [
{ key: 'needs_attention', label: 'need you' },
{ key: 'fix_failed', label: 'fix failed' },
{ key: 'fix_verification_failed', label: 'fix not confirmed' },
{ key: 'cannot_fix', label: 'could not fix' },
{ key: 'timed_out', label: 'timed out' },
+ { key: 'failed', label: 'ended with an error' },
{ key: 'unclassified', label: 'finished without a clear conclusion' },
{ key: 'fix_queued', label: 'fix waiting for approval' },
{ key: 'fix_executed', label: 'fix run' },
@@ -112,15 +117,17 @@ export function buildDigestTiles(digest: PatrolDigest): DigestTile[] {
}
const investigationDetails = describeDigestInvestigationOutcomes(investigations.by_outcome);
- if (investigationDetails.length === 0) {
+ if (investigationDetails.length > 0) {
+ investigationDetails[investigationDetails.length - 1] += '.';
+ if (investigationDetails.length > 1) investigationDetails[0] += ',';
+ } else if (investigations.total === 0) {
+ // Runs whose outcome has no wording here still happened, so only an empty
+ // week may say that nothing was investigated.
investigationDetails.push(
digest.mode === 'monitor'
? 'Patrol is watch only, so it reports issues without investigating them.'
: 'No issues needed a closer look.',
);
- } else {
- investigationDetails[investigationDetails.length - 1] += '.';
- if (investigationDetails.length > 1) investigationDetails[0] += ',';
}
const actionDetails: string[] = [];
diff --git a/frontend-modern/src/features/patrol/__tests__/PatrolWeeklyDigestCard.test.tsx b/frontend-modern/src/features/patrol/__tests__/PatrolWeeklyDigestCard.test.tsx
index 85925ef41a..32b67dbfaa 100644
--- a/frontend-modern/src/features/patrol/__tests__/PatrolWeeklyDigestCard.test.tsx
+++ b/frontend-modern/src/features/patrol/__tests__/PatrolWeeklyDigestCard.test.tsx
@@ -226,4 +226,31 @@ describe('PatrolWeeklyDigestCard', () => {
expect(await screen.findByText('4 finished without a clear conclusion,')).toBeInTheDocument();
expect(screen.getByText('1 interrupted by a restart.')).toBeInTheDocument();
});
+
+ it('names runs that ended with an error between timeouts and unclear runs', () => {
+ expect(
+ describeDigestInvestigationOutcomes({ unclassified: 3, failed: 2, interrupted: 1 }),
+ ).toEqual(['2 ended with an error', '3 finished without a clear conclusion']);
+ expect(describeDigestInvestigationOutcomes({ failed: 1, timed_out: 2 })).toEqual([
+ '2 timed out',
+ '1 ended with an error',
+ ]);
+ });
+
+ it('never says nothing was investigated under a non-zero count', () => {
+ const investigated = (
+ investigations: PatrolDigest['investigations'],
+ mode: PatrolDigest['mode'] = 'approval',
+ ) =>
+ buildDigestTiles(digest({ mode, investigations })).find((tile) => tile.id === 'investigated');
+ // A run whose outcome has no wording on the card still happened.
+ expect(investigated({ total: 3, by_outcome: { unknown: 3 } })).toMatchObject({
+ value: '3',
+ details: [],
+ });
+ expect(investigated({ total: 2, by_outcome: { unknown: 2 } }, 'monitor')?.details).toEqual([]);
+ expect(investigated({ total: 0, by_outcome: {} })?.details).toEqual([
+ 'No issues needed a closer look.',
+ ]);
+ });
});