Expand description
The disk janitor: finished runs get their worktrees folded and the shared
build cache is pruned to its cap. A run whose state magi cannot read is
left alone here — see fold_due — and is only ever removed by an
explicit operator action (magi fold, or the equivalent phone route).
Everything policy-shaped — which statuses are foldable, how long a finished run is left alone, whether the cache is over its limit — is a pure function injected with numbers, so nothing here has to ask the operating system to be testable. The only I/O is the removal itself.
Structs§
- Housekeeping
- What one janitor pass did, for the caller’s log line.
Functions§
- cache_
report - The cache’s path, size and cap, for
magi cache showand the health view.Nonewhen the config declares noCARGO_TARGET_DIRto aggregate. - cache_
size - Size in bytes of the shared build cache.
- due
- Is
updatedold enough, measured againstnow, that the run may fold? - fold_
due - Fold every run that is finished, older than the grace period, and not being worked on; count them.
- fold_
unreadable - Remove a run that cannot be read: its state directory under
runsand its worktree directory underworktrees_root. - housekeep
- Run the janitor: fold due runs, then prune the cache if it is over its cap.
- prune_
cache - Delete files from the shared build cache until it fits its cap.