Blacksite/docs/workflow/build-storage-policy.md

33 lines
2.1 KiB
Markdown

# Build Storage Policy
Blacksite uses one persistent ordinary-development lane and creates exceptional candidate,
hot-reload, full-debug, cross-target, or package lanes only when their distinct signature is needed.
Lane identity includes the canonical workspace, toolchain, target, profile, features, linker and
compiler flags.
On the current checkout, intermediates live in a canonical-workspace partition beneath
`<workspace-parent>/.blacksite-build-cache`; this keeps the cache on the workspace volume because
Cargo home does not satisfy the configured free-space floor. Set `BLACKSITE_BUILD_CACHE_ROOT` to an
approved cache volume when the checkout moves. Final ordinary artifacts retain predictable paths
under repository `target/`, while exceptional final artifacts live under `target/lanes/<lane>`.
Use `scripts/codex/build_storage.py` for measurement, dry-run pruning, and policy enforcement. Under
budget or free-space pressure, pre/post enforcement may automatically remove only expired disposable
lanes after printing and flushing their complete byte-counted safety plan. A managed lane must carry
a sentinel identifying its workspace and signature before it is eligible for
deletion. Never run an unscoped `cargo clean` as a troubleshooting reflex, and never delete individual
files from Cargo's `deps`, `.fingerprint`, `build`, or `incremental` layouts by age. Pruning removes
only a complete verified disposable lane.
Before a heavy gate, enforce the configured total budget and free-space floor; remaining hard-limit
or free-space violations block the gate. Afterward, record lane size and last use. Every automatic or
explicit prune/reset prints and flushes its complete byte-counted, checked plan before deletion starts.
Before removing a candidate lane, copy the nominated binaries or
packages and evidence outside the lane, then run:
`python scripts/codex/build_storage.py mark-candidate-preserved --evidence <manifest> --artifact <binary-or-package>`
The generation-bound marker becomes stale if that candidate lane is used again. The persistent
development lane is reset only at a safe slice boundary when signature drift or the hard budget makes
that necessary.