Skip to content

feat(reset): report reclaimable and reclaimed disk space - #1247

Merged
edenreich merged 2 commits into
mainfrom
fix/issue-1243
Sep 18, 2026
Merged

edenreich merged 2 commits into
mainfrom
fix/issue-1243

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Resolves #1243

Summary

infer reset now ends its preview with a Total reclaimable space: <size> line and infer reset confirm ends its result with Total reclaimed space: <size>, the number a docker system prune run ends with. Sizes are measured before removal so the confirm total counts only targets that were actually deleted, and byte counts are formatted with the new formatting.FormatBytes (decimal units, 4 significant digits, matching docker).

Changes

  • cmd/reset/wipe.go:
    • new size() helper: best-effort filepath.WalkDir over a target; regular-file bytes are summed, unreadable entries are skipped and never fail the reset (the total is a report, not an audit).
    • new sqlitePaths() helper replaces the inline 4-path list in wipe so the database, -wal, -shm and -journal sidecars are handled and counted in one place.
    • preview ends with Total reclaimable space: summed over the resolved targets plus SQLite sidecars.
    • wipe measures each target before os.RemoveAll and only adds the bytes of targets that were actually removed, so a partially-blocked wipe reports what it really freed; per-target error reporting is unchanged.
  • internal/platform/formatting: new FormatBytes, matching docker system prune output style (0B, 4.096kB, 1.653GB).
  • Tests: TestWipeReportsSpaceTotals seeds files of known size (dir tree + db + wal sidecars) and asserts both totals (5.696kB); TestWipeReclaimedSpaceExcludesFailures verifies a blocked target is excluded from the total; TestFormatBytes pins the formatter.

Verification

  • go test -tags purego ./cmd/reset ./internal/platform/formatting - pass
  • task precommit:run (mod tidy, fmt, imports check, golangci-lint, markdownlint) - 0 issues

infer reset ends the preview with Total reclaimable space, and infer reset confirm ends with Total reclaimed space summed over the targets it actually removed. Sizes are measured before os.RemoveAll, walk whole directory trees plus the SQLite database and its WAL sidecars, skip unreadable entries, and format like docker system prune (decimal units, 4 significant digits) via the new formatting.FormatBytes.
Comment thread cmd/reset/wipe_test.go Resolved
@edenreich
edenreich merged commit 10d04fe into main Sep 18, 2026
1 check passed
@edenreich
edenreich deleted the fix/issue-1243 branch September 18, 2026 20:13
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.204.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Report reclaimed disk space from infer reset

1 participant