Skip to content

feat(analyze): show free disk space in overview header#690

Closed
sebastianbreguel wants to merge 3 commits intotw93:mainfrom
sebastianbreguel:feat/analyze-disk-free
Closed

feat(analyze): show free disk space in overview header#690
sebastianbreguel wants to merge 3 commits intotw93:mainfrom
sebastianbreguel:feat/analyze-disk-free

Conversation

@sebastianbreguel
Copy link
Copy Markdown
Contributor

Summary

  • Display available disk space next to "Analyze Disk" title in overview mode
  • Uses syscall.Statfs with Bavail (excludes reserved blocks)
  • Degrades gracefully if syscall fails (guard: diskFree > 0)
  • Reuses existing humanizeBytes helper for formatting

Before: Analyze Disk
After: Analyze Disk (123.4 GB free)

Safety Review

  • Does this change affect cleanup, uninstall, optimize, installer, remove, analyze delete, update, or install behavior?
    • No — read-only display change. No files are modified or deleted.
  • Does this change affect path validation, protected directories, symlink handling, sudo boundaries, or release/install integrity?
    • No.
  • New boundary or risk change:
    • None. Single Statfs syscall at startup, display-only output.

Tests

  • 163 existing Go tests pass (go test ./cmd/analyze/)
  • 572 BATS tests pass
  • No new tests needed — display-only change

Display available disk space next to "Analyze Disk" title so users
immediately see how much room they have before exploring locations.

Uses syscall.Statfs with Bavail (excludes reserved blocks) and
degrades gracefully if the call fails.
@sebastianbreguel sebastianbreguel requested a review from tw93 as a code owner April 6, 2026 15:33
Statfs now checks the actual volume being analyzed, so free space
is accurate when scanning external drives or non-root volumes.
Copy link
Copy Markdown
Owner

@tw93 tw93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. One missing piece before merge: add a focused regression test in cmd/analyze that verifies the overview header shows the free-space suffix when diskFree > 0 and omits it when unavailable. This PR changes View() output, so that rendering path should have direct coverage.

@sebastianbreguel
Copy link
Copy Markdown
Contributor Author

@tw93 thanks for the comments, ready!

@tw93
Copy link
Copy Markdown
Owner

tw93 commented Apr 7, 2026

@sebastianbreguel thanks for the follow-up here. This is already on now, so there is nothing left to merge from this branch. Closing this PR out.

@tw93 tw93 closed this Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants