Show repository disk size in sidebar group headers#246
Conversation
82c69eb to
283b543
Compare
Multi-Model Re-Review: PR #246 — Show repository disk sizePrevious Findings Status
New Findings (5-model consensus, 3+ models required)🟡 MODERATE —
Fix: add a simple reentrance guard at the top of the method: private int _scanning;
public Task RefreshDiskSizesAsync()
{
if (Interlocked.CompareExchange(ref _scanning, 1, 0) != 0) return Task.CompletedTask;
return Task.Run(() => { try { /* existing body */ } finally { _scanning = 0; } });
}🟢 MINOR — The call 🟢 MINOR —
No Issues Found (Investigated, Clean)
Test Coverage16 new tests cover CI
Verdict |
✅ Multi-Model Re-Review (Round 2): Ready to MergeCommit: Previous Findings Status
Round 2 Re-Review (5-model consensus, 3+ required to include)No new CRITICAL or MODERATE issues found. Two pre-known MINOR items noted by 2/5 models:
Test Coverage16 tests covering: Verdict: ✅ ApproveBoth rounds of fixes applied and verified. All 1632 non-pre-existing tests pass. The implementation is solid — reentrance guard, correct TTL, proper timer lifecycle (firstRender guard + Dispose). Ready to merge. |
Add disk size calculation for each tracked repository (bare clone + worktrees) displayed in the sidebar group header tooltip and as a dim label next to the session count. Sizes are computed on a background thread, cached for 5 minutes, and refreshed periodically via a timer. - Add GetRepoDiskSize, RefreshDiskSizesAsync, GetDirectorySizeBytes, FormatSize to RepoManager with ConcurrentDictionary-based cache and 5-min TTL - Show disk size badge in sidebar repo group headers - Add CSS for .group-disk-size label - Add 16 unit tests covering FormatSize, directory scanning, cache behavior - Timer disposed in SessionSidebar.Dispose to prevent leaks Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Change DiskSizeCacheTtl from 5min to 7min so the cache entry remains valid while the periodic 5min refresh runs in the background. Prevents the disk size from disappearing every refresh cycle. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Prevent overlapping disk size scans when a scan takes longer than the 5-minute timer interval. Uses Interlocked.CompareExchange to skip the scan if one is already in progress. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
409c831 to
2ab9259
Compare
Summary
Shows disk size (bare clone + worktrees) for each tracked repository in the sidebar group headers.
Changes
GetRepoDiskSize(),RefreshDiskSizesAsync(),GetDirectorySizeBytes(), andFormatSize()with aConcurrentDictionary-based cache (5-minute TTL)Timer(every 5 min), disposed properly on cleanup..group-disk-sizestyle for the size labelFormatSize(locale-safe), directory scanning, cache behavior, and non-existent path handlingDesign
Task.Run— never blocks UIOnStateChangedafter refresh to trigger sidebar re-render