Files: free space read through a seam; a 0 reading is unknown, not a full disk

Merged
TE
16d ago
+38-9

Summary

FolderViewMemoryTests.statusLineKnowsTheFreeSpace read the CI runner's real disk and failed whenever the volume reported 0 bytes free. It showed up as a head-only red on unrelated PRs (on #23203's post-merge suite runs, cmux-ci c8787bff and 470fab3f, and green on base 7e9f2fec on another runner).

  • FileInfoReader takes the volume's reported free space (for important use, and plain) as an injectable seam; the default reads Foundation as before.
  • The tests give it fixed values instead of reading the runner's disk.
  • availableCapacity treats a 0 for important use as missing and falls back to the plain figure, and treats a volume that reports 0 free as unknown (nil), so the Files status line leaves out "X available" instead of showing "Zero KB available".

Trade-off: a volume that really is completely full now shows no free-space figure rather than "Zero KB". A 0 reading on a working volume is the more common case (CI's ephemeral disks).

No capture: no view code changes; the Files status line only drops its "available" figure when the volume reports 0.

Changelog

none

Testing

Focused command: the FolderViewMemoryTests suite in Packages/macOS/CmuxNext (swift test --filter FolderViewMemoryTests, on the fleet).

  • Test commit (412db24a): aZeroForImportantUseFallsBackToThePlainFigure and aVolumeThatReportsNothingFreeIsUnknown fail (the reader returns 0).
  • Fix commit: all pass.

Observed / Not run

  • Observed: prepush-gate.py passed. CI results for each commit are linked in comments below.
  • Not run: no local Swift build or test (agents don't build on this Mac).

🤖 Generated with Claude Code

Agent session: cosmic-gray


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Fixes the free-space test in FolderViewMemoryTests, which read the CI runner's real disk and failed when the volume reported 0 bytes free, and makes a 0 reading show as unknown instead of "Zero KB available".

  • FileInfoReader now takes volume capacity as an injectable function, and the test passes fixed values.
  • A 0 figure for important use falls back to the plain figure.
  • A volume reporting 0 free reads as unknown, so the status line leaves out "X available" instead of showing "Zero KB available".
  • Trade-off: a volume that is really full no longer shows a free-space figure.