← Back to Pull requests

libimage: report the size a removal actually frees #1105

Closed
unknown closed this pull request without merging on Nov 05, 2026 16:45 UTC
View on GitHub
unknown unknown commented on Aug 20, 2026 19:46 UTC
Author

Fixes: https://github.com/podman-container-tools/podman/issues/27592

report.Size is the image's full size — i.Size() is store.ImageSize(), which counts every layer including the shared ones. podman sums those reports, so a layer shared by N pruned images is counted N times. Users saw "reclaimed 346GB" on a 128GB disk.

This adds RemoveImageReport.FreedSize, the number of bytes the removal released. Size keeps its current meaning, so existing callers are unaffected.

c/storage already walks the layer chain and stops at the first layer another image still references, so DeleteImageWithSize reuses that walk and sums the layers it is about to remove, under the same lock that removes them. No second walk, no dry run, and no window in which a concurrent removal could skew the number. A layer shared by several removed images is released when the last of them goes, so it is accounted exactly once and summing FreedSize over a removal gives the space it released.

Layers are measured uncompressed, the same metric DiskUsage uses, so the number stays comparable with what podman system df reports.

Tests: two images sharing a top layer are removed together; the summed FreedSize equals the disk usage measured before the removal, and sum(Size) is strictly greater. Reverting the accounting reports 11692362 against an actual 5848394.

Podman needs a vendor bump and a switch from r.Size to r.FreedSize in pkg/domain/infra/abi/images.go; PR to follow, with the bump as its own commit.

Diff: 189 lines (+141 / -48) across 2 files Reviewer: ROKUMATE Review duration: 110699m
All Vouch review confidence checks passed
Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 189 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
60%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.314
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #1105"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.9% (MEDIUM) · Higher = larger blast radius
35.9%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 60.5% · Lower = rushed or shallow review
60.5%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 14.2% · Safe to merge
14.2%