Skip to main content

Module disk_preflight

Module disk_preflight 

Source
Expand description

Pre-drain disk-footprint check (ticket mission-build-footprint).

A mission builds a full target/debug in its integration worktree, the validation snapshot copies a warmed subset on top of that, and the merge gate may build again in a scratch worktree. On a disk with less free space than that ladder needs, the run dies mid-command with os error 28 (ENOSPC) — burning feature respawn budgets on Partial runs (observed on m-a5a8fd and m-eee81f). This module refuses to START a mission when the free space under the repo is below the estimated footprint, naming the number, instead of dying mid-feature. It is deliberately a drain-time refusal, not an in-mission guard: the honest failure is up front.

Enums§

DiskPreflight
The decision a pre-drain disk check reaches.

Functions§

available_bytes
Free bytes available to unprivileged users on the volume containing path (statvfs f_bavail × f_frsize). None when the call fails — the check then degrades to “proceed” rather than inventing a number.
check
The pre-drain check: compare free space under repo_root against the estimated build footprint.
estimate_build_footprint_bytes
Estimated bytes a mission’s build ladder needs: the primary checkout’s current target/ size × [FOOTPRINT_MULTIPLIER], floored so a target-less repo still gets a sane bound. The walk is capped at cap bytes — once the running total passes it the estimate is already “too big”, so a multi-GiB tree is not priced to the last file.
gib
Render a byte count as N.N GiB for the refusal reason.