3.2 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec |
|---|---|---|---|---|---|---|
| 03-disk-capacity-progress | Add disk capacity and progress card | done | 2 | plan.md | ../../specs/system-page/requirements/storage-overview-parallel-scan.md |
Task 03: Add disk capacity and progress card
Acceptance
GET /api/v1/system/storage/diskmeasures the filesystem containing Kandev's storage root and returns total, used, available, percentage, path, and availability/error fields.- The disk request is independent from the cached overview and remains responsive while the overview scan is held or cold.
- The Storage page shows localized used percentage, used/available/total sizes, and an accessible progress bar with warning styling at 80% and critical styling at 90%.
- A capacity failure renders an unavailable card and does not block policy, history, quarantine, or overview sections.
- Desktop and mobile layouts remain usable without horizontal overflow.
Verification
cd apps/backend && go test -race ./internal/system/metrics ./internal/system/storage ./internal/backendapp
cd apps/web && pnpm run typecheck
cd apps/web && pnpm test -- --run components/settings/system/storage/storage-disk-capacity-card.test.tsx
The implementation must reuse or factor the existing cross-platform disk-free-space semantics in
apps/backend/internal/system/metrics; do not add a Unix-only storage API.
Files likely touched
apps/backend/internal/system/metrics/disk_unix.goapps/backend/internal/system/metrics/disk_windows.goapps/backend/internal/system/metrics/*_test.goapps/backend/internal/system/storage/handler.goapps/backend/internal/system/storage/types.goapps/backend/internal/backendapp/storage_maintenance.goapps/backend/internal/system/storage/handler_test.goapps/web/lib/api/domains/system-api.tsapps/web/lib/types/system.tsapps/web/hooks/domains/system/use-storage-maintenance.tsapps/web/components/settings/system/storage/storage-disk-capacity-card.tsx- Storage API/component fixtures and tests
- localized system translation resources
Dependencies
None. The card is intentionally independent of Task 01's overview fan-out.
Inputs
- Spec: filesystem capacity indicator, API surface, and failure scenarios
- Existing
apps/backend/internal/system/metrics/disk_unix.goanddisk_windows.go - Existing progressive-loading request orchestration in
use-storage-maintenance.ts - Existing
formatGigabytesand localized Storage card patterns
Output contract
Return a compact handoff capsule with API/test results, desktop/mobile evidence, exact percentage semantics, and any platform-specific capacity limitations.
Result
Added the cross-platform GET /api/v1/system/storage/disk endpoint and an independently loaded
capacity card. Unix statfs and Windows GetDiskFreeSpaceEx expose total, service-available, used,
and clamped percentage values. The UI renders the exact percentage and byte-derived sizes, with
accessible progress semantics plus 80%/90% warning styling; unavailable reads remain non-blocking.
Backend metrics/storage tests, web typecheck/lint, focused component tests, and the desktop/mobile
managed Storage E2E flows pass.