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 zero-coverage Patrol scoped runs

rcourtman43f4e6308726
diff --git a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
index d2756f78d0..1cc1ebd5b5 100644
--- a/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
+++ b/docs/release-control/v6/internal/subsystems/patrol-intelligence.md
@@ -424,6 +424,8 @@ owner, so the Patrol hook composes one canonical payload-to-summary derivation
instead of rebuilding recent-change, correlation, and governed-resource count
copy inline.
That same normalization applies to supporting effort strips inside the expanded
+Zero-coverage scoped runs must also fail closed as `Checked 0 of N scoped
+resources` rather than drifting back to a scope-only headline.
run card. Once the run presenter is already carrying canonical coverage copy,
secondary chips must not reintroduce a raw `Scoped to N resources` variant that
re-opens the same ambiguity.
diff --git a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
index 5ff7a579c7..a4ae315557 100644
--- a/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/patrolRunPresentation.test.ts
@@ -91,6 +91,16 @@ describe('patrolRunPresentation', () => {
it('uses checked-resource language for non-scoped coverage summaries', () => {
expect(getPatrolRunCoverageSummary(fullCoverageRun)).toBe('Checked 58 resources');
expect(getPatrolRunResourcesHeading(fullCoverageRun)).toBe('Resources checked (58)');
+
+ it('fails closed on zero-coverage scoped runs', () => {
+ expect(
+ getPatrolRunCoverageSummary({
+ resources_checked: 0,
+ scope_resource_ids: ['seed-resource'],
+ effective_scope_resource_ids: ['expanded-a', 'expanded-b'],
+ }),
+ ).toBe('Checked 0 of 2 scoped resources');
+ });
});
it('returns canonical patrol run loading and unavailable copy', () => {
diff --git a/frontend-modern/src/utils/patrolRunPresentation.ts b/frontend-modern/src/utils/patrolRunPresentation.ts
index ed60a52d39..487009325c 100644
--- a/frontend-modern/src/utils/patrolRunPresentation.ts
+++ b/frontend-modern/src/utils/patrolRunPresentation.ts
@@ -95,13 +95,12 @@ export function getPatrolRunCoverageSummary(run: Pick<PatrolRunRecord, 'resource
const scopedResourceCount = getCanonicalScopeResourceIds(run)?.length ?? 0;
if (scopedResourceCount > 0) {
- if (resourcesChecked > 0 && resourcesChecked < scopedResourceCount) {
+ if (resourcesChecked < scopedResourceCount) {
return `Checked ${resourcesChecked} of ${scopedResourceCount} scoped resources`;
}
if (resourcesChecked > 0) {
return `Checked ${formatResourceCount(resourcesChecked, 'scoped')}`;
}
- return `Scoped to ${formatResourceCount(scopedResourceCount)}`;
}
if (resourcesChecked > 0) {