Cuts redundant metadata probes during view disk-limit enforcement by caching sizes of immutable v2 generation artifacts between passes, while keeping mutable SQLite files and markers freshly measured.
Immutable manifest-*, trigram-*, and derived-* sizes are reused across passes; SQLite files, pins, and markers are still measured each pass.
The cache invalidates on directory identity change (device, inode, mode, timestamps) plus a six-hour full reconciliation.
Project membership admission now skips metadata probes of excluded paths and non-regular files but keeps identical walker results, verified by old/new parity and lstat-count tests.
View-size caches live on the registry and drop with its last handle; new tests cover byte parity through changes and reconcile, eviction decisions, and cache lifetime.
Confidence Score: 5/5
The PR appears safe to merge, with a non-blocking test isolation issue.
This PR reduces repeated file metadata checks during disk-limit enforcement and project walks.
View disk checks reuse sizes for unchanged generation files.
Project walks skip metadata checks they do not need.
Both earlier, unnumbered threads were manually resolved without explanation. The current code addresses their original concerns: caches follow the registry's lifetime, and checkout-wide measurements no longer make exact assertions.
Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Measure family"] --> B["Take registry-owned caches"]
B --> C{"Directory changed or refresh due?"}
C -->|Yes| D["Clear cached sizes"]
C -->|No| E["Walk view directory"]
D --> E
E --> F["Reuse published artifact sizes"]
E --> G["Measure mutable and uncached files"]
F --> H["Check directory again"]
G --> H
H --> I["Keep only complete, stable cache entries"]
I --> J["Return caches to registry"]
J --> K["Apply disk budget"]