Eviction, budget, and the in-flight-reference primitive (D2, D3, D3a)
Goal
After builds exceed a set budget, opportunistic-then-blocking collection brings total cache-root size within the composed bound and a concurrent linker never hits enoent on a reclaimed entry.
Implementation Sketch
Derived from compiler_repo/docs/ori_lang/proposals/approved/cache-lifecycle-proposal.md. Implement the work items below in order; each maps to a design bullet in the approved proposal.
Spec References
- Approved proposal:
compiler_repo/docs/ori_lang/proposals/approved/cache-lifecycle-proposal.md - Umbrella invariant T4:
compiler_repo/docs/ori_lang/proposals/approved/toolchain-philosophy-proposal.md
Work Items
- Activate the shipped
CacheConfig.max_sizebudget; persistori cache budgetper-user and honorORI_CACHE_BUDGET;unlimited(0) is expressible - Recency floor with budget-authoritative interaction: narrow the recency window and stop admitting new entries when the protected set alone exceeds the budget
- Tool-owned use-stamping in a per-entry sidecar OUTSIDE the verified manifest; best-effort,
atimenever consulted - Guaranteed-progress: after
Nconsecutive over-budget skips the next build blocks on the collection lock; admission-stop emits a diagnostic naming budget/size/ori cache gc - Collector root spans versions (
…/ori/build/, not…/<version>); prior-version roots evicted first - Orphan-generation sweep: reclaim any generation file reachable from no manifest and holding no in-flight reference, regardless of age
- D3a in-flight-reference primitive: acquire-then-verify ordering, crash recovery requiring owner-gone AND expiry-passed (PID plus start time), descendant inheritance for nested invocations
- Enforce and report the composed bound
max(budget, OVERSIZED + LEASED)as the single cache-root invariant