* test(#3817): audit-open counts must include the truncation remainder * fix(#3817): count the truncation remainder — display truncates, counting must not * chore(#3817): changeset fragment (pr number backfilled after PR creation) * chore(#3817): backfill changeset PR number (4034) --------- Co-authored-by: sim <sim@local>
This commit is contained in:
@@ -1337,9 +1337,17 @@ function auditOpenArtifacts(cwd: string): AuditResult {
|
||||
try { return scanDeferredItems(planDir, cwd); } catch { return { items: [{ scan_error: true, phase: '', file: '', text: '' }], acknowledged: 0 }; }
|
||||
})();
|
||||
|
||||
// Count real items (not scan_error sentinels)
|
||||
// Count real items (not scan_error sentinels). #3817: a `_remainder_count`
|
||||
// marker is not a phantom — it RECORDS real items the detail list truncated
|
||||
// away for display, so its value counts toward the total. Truncation limits
|
||||
// display, never counting; only scan_error (a read failure, not an item)
|
||||
// contributes zero.
|
||||
const countReal = (arr: Array<{ scan_error?: boolean; _remainder_count?: number }>) =>
|
||||
arr.filter(i => !i.scan_error && !i._remainder_count).length;
|
||||
arr.reduce((sum, i) => {
|
||||
if (i.scan_error) return sum;
|
||||
if (typeof i._remainder_count === 'number') return sum + i._remainder_count;
|
||||
return sum + 1;
|
||||
}, 0);
|
||||
|
||||
const counts: AuditCounts = {
|
||||
debug_sessions: countReal(debugSessions.items),
|
||||
|
||||
Reference in New Issue
Block a user