mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-10-03 12:42:43 +00:00
Fail closed on zero-coverage Patrol scoped runs
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user