feat(resources): bind prune to fingerprinted itemized plans (#1611)

* feat(resources): bind prune to fingerprinted itemized plans

* fix(resources): repair prune plan volume usage and preview list

Source volume RefCount from docker df, keep preview rows from flex-shrinking, tighten managed image attribution and becomesFree, and stop audit summaries from claiming success on rejected prunes.
This commit is contained in:
Anso
2026-07-11 00:11:37 -04:00
committed by GitHub
parent 4834e2e51d
commit 213d3d5d3a
13 changed files with 1713 additions and 155 deletions
+13 -1
View File
@@ -35,6 +35,7 @@ export const AUDIT_ROUTE_SUMMARIES: Record<string, string> = {
// System operations
'POST /system/prune': 'Pruned system resources',
'POST /system/prune/orphans': 'Pruned orphan containers',
'POST /system/prune/plan': 'Built prune plan',
'POST /system/prune/system': 'Pruned system resources',
'POST /system/images/delete': 'Deleted images',
'POST /system/volumes/delete': 'Deleted volumes',
@@ -158,8 +159,19 @@ const SORTED_PATTERNS = Object.entries(AUDIT_ROUTE_SUMMARIES)
* falls back to prefix matching. Returns a generic method+path string
* if no pattern matches.
*/
export function getAuditSummary(method: string, apiPath: string): string {
export function getAuditSummary(method: string, apiPath: string, statusCode?: number): string {
const normalized = apiPath.replace(/^\//, '');
// Do not claim a successful prune when the request was rejected or blocked.
if (typeof statusCode === 'number' && statusCode >= 400) {
if (method === 'POST' && normalized.startsWith('system/prune/system')) {
if (statusCode === 409) return 'Prune blocked: plan stale';
if (statusCode === 400) return 'Prune request rejected';
return `Prune failed (${statusCode})`;
}
if (method === 'POST' && normalized.startsWith('system/prune/plan')) {
return `Prune plan failed (${statusCode})`;
}
}
const normalizedSegments = normalized.split('/');
for (const [pattern, summary] of SORTED_PATTERNS) {