You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(capsule): prune by age only, drop size-based eviction (#10408)
## Problem
The capsule auto-prune (`bit capsule prune --size-target 10`) was wiping
scope-aspects capsules across **all** repos sharing the global cache.
With ~10 bit checkouts, every aspect capsule got evicted daily, making
rebuilds slow.
Root cause is in `applySizeTarget`: it measured the **whole** cache
total but could only evict scope-aspect children. When the un-evictable
remainder (workspace/scope caps, ~11 GB of legacy unmarked dirs, each
aspect-root's own `node_modules`) already exceeded the target, the loop
evicted 100% of aspect capsules across every repo and still never
reached the target. Evidence from logs: 569 removals tagged
`size-target-10gb` vs only 14 for `older-than-30d`, and the cache stayed
at 18 GB after "pruning" to a 10 GB target.
Size accounting also forced an expensive recursive `lstat` walk of the
entire cache on every auto-prune.
## Change
Drop size-based eviction entirely; prune by **age + orphan** only.
- Auto-prune spawns `bit capsule prune --older-than <N>` (no
`--size-target`); no size walk → O(1) rename-to-trash deletes.
- Removed `applySizeTarget`, the `--size-target` flag, and
`CFG_CAPSULES_MAX_SIZE_GB`.
- `--with-sizes` stays as an opt-in for byte totals in the report.
The cache now self-bounds to "workspaces touched within `--older-than`
(default 30d)"; throwaway/temp scopes are still caught by the orphan
check.
|`--size-target <gb>`|| after standard pruning, LRU-evict aspect-versions until total drops below this size (forces --with-sizes) |
317
316
|`--dry-run`|| preview what would be removed without deleting |
318
317
|`--with-sizes`|| compute byte sizes for the report (walks the full cache; slow on large caches). default: off — sizes shown as 0 but the prune itself is instant. |
0 commit comments