feat: warn user when disk space is running low#456
Conversation
Add disk space monitoring with three tiers of protection: - Pre-session check warns at <500 MB, blocks at <50 MB - Active monitoring warns at <100 MB (once per session) - Auto-stops logging at <50 MB with no user confirmation required Closes #448 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Review Summary by QodoAdd disk space monitoring with three-tier protection system
WalkthroughsDescription• Adds disk space monitoring service with three protection tiers - Pre-session check warns at <500 MB, blocks at <50 MB - Active monitoring warns at <100 MB (once per session) - Auto-stops logging at <50 MB without user confirmation • Integrates monitoring into logging lifecycle via IsLogging setter • Includes 22 comprehensive unit tests covering thresholds and edge cases • Provides injectable free-space provider for testability Diagramflowchart LR
A["User starts logging"] --> B["CheckPreLoggingSpace"]
B --> C{Space level?}
C -->|Critical| D["Block logging"]
C -->|Warning| E["Show warning"]
C -->|OK| F["Start monitoring"]
F --> G["Monitor every 15s"]
G --> H{Space drops?}
H -->|Critical| I["Auto-stop logging"]
H -->|Warning| J["Show warning once"]
H -->|OK| G
File Changes1. Daqifi.Desktop/DiskSpace/DiskSpaceLevel.cs
|
Code Review by Qodo
1. _diskSpaceMonitor never disposed
|
- Dispose monitor and unsubscribe events on window close (qodo #1) - Notify bindings on critical early-return so toggle reverts (qodo #2) - Wrap CheckPreLoggingSpace in try/catch to avoid crash on IO error (qodo #3) - Fix flaky test that depended on timer firing twice in 500ms Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Dispatcher.Invoke blocks the timer callback thread until the UI thread processes the delegate. BeginInvoke queues it asynchronously, which is safer when the UI thread may be busy showing a MahApps dialog. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Addressing remaining Qodo feedback from the summary comment: 4. Missing XML docs — Fixed in 33c8137. Added 5. Not DI-injected — Disagree. |
Verifies the try/catch returns DiskSpaceLevel.Ok when the free-space provider throws, so logging is not blocked by transient IO errors. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add suppressInitialWarning parameter to StartMonitoring so the pre-session warning and the first timer tick don't both show a warning dialog (qodo #6) - Add lock around timer state and _warningRaised to prevent races between the timer callback and UI-thread start/stop calls (qodo #7) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Addressing remaining Qodo feedback (items 6 and 7) from the summary comment: 6. Duplicate warning dialogs — Fixed in 16b80c7. Added 7. Timer state not thread-safe — Fixed in 16b80c7. Added a |
📊 Code Coverage ReportSummarySummary
CoverageDAQiFi - 19.7%
Daqifi.Desktop.Common - 33.3%
Daqifi.Desktop.IO - 100%
Coverage report generated by ReportGenerator • View full report in build artifacts |
Summary
Closes #448
Implementation
DiskSpaceMonitorservice (Daqifi.Desktop/DiskSpace/) with injectable free-space provider for testabilitySystem.Threading.TimerDaqifiViewModel.IsLoggingsetter for pre-session checks and start/stop lifecycleTest plan
🤖 Generated with Claude Code