Skip to content

feat: "Reclaim space" container action (container clean) - #75

Merged
elementalcollision merged 1 commit into
mainfrom
feat/container-clean
Sep 27, 2026
Merged

elementalcollision merged 1 commit into
mainfrom
feat/container-clean

Conversation

@elementalcollision

Copy link
Copy Markdown
Owner

Summary

Adds a Reclaim space action that wraps Apple container 1.4's new container clean.

What clean does (traced in apple/container 1.4.1: ContainersService.clean → RuntimeService.clean): it runs an fstrim on the container's writable root filesystem and every writable block mount. That returns the space freed inside the sparse ext4 disk images to macOS. No data is removed, and the CLI only allows it on running containers.

  • Backend: runtime::clean_containers(&[id]) runs container clean <ids…> with the long timeout, exposed as the Tauri command clean_containers. An old CLI without the subcommand fails with Plugin 'container-clean' not found (exit 64); that becomes "container clean requires Apple container 1.4 or later". Other errors, such as "container is not running", pass through unchanged.
  • UI: a sparkle icon on running container rows, a button in the detail pane, and a bulk-bar button that applies to the selected running containers. There's no confirm dialog because the action is non-destructive. Success and failure are reported with toasts.
  • Also fixed: a latent missing toast import in modals.tsx. The Doctor-fix failure path already called toast() without importing it.

Verification

  • Live on container 1.4.1:
    • clean on a running container: exit 0, 0.3s.
    • On a stopped container: exit 1, "container is not running", passed through unchanged.
    • Unknown subcommand: exit 64 with "Plugin … not found", which is the shape the version-error mapping keys on.
  • cargo fmt --check, clippy -D warnings, cargo test (84 passed), npm test (58 passed), npm run build all pass.
  • New tests: argv building, version-error mapping (including a usage error that also exits 64), the row button showing only for running containers and calling the API, and the detail-pane button.

🤖 Generated with Claude Code

Wraps Apple container 1.4's `container clean`, which fstrims a running
container's writable rootfs and block mounts to hand freed space in its
sparse disk images back to macOS. Non-destructive; running containers
only. Available from the container row, the detail pane, and the bulk
action bar. Older CLIs get a clear "requires 1.4 or later" error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elementalcollision
elementalcollision merged commit b16eb56 into main Sep 27, 2026
2 checks passed
@elementalcollision
elementalcollision deleted the feat/container-clean branch September 27, 2026 15:28
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.

1 participant