Skip to main content

run_wrapper

Function run_wrapper 

Source
pub async fn run_wrapper<E, R>(
    config: &WrapperConfig,
    env: &E,
    cache: &Arc<dyn StorageBackend>,
    runner: &R,
) -> Result<WrapperReceipt, WrapperError>
Expand description

Run the wrapper: consult the cache accelerator and either materialize a full hit or fall through to a real docker build.

§The fall-through safety contract (D6)

The cache is an accelerator, never a gate. For every cache-side failure mode — a Dockerfile the scoped graph hasher rejects, a cache backend I/O error, a partial cache hit, a missing node-cache daemon — the wrapper degrades to a plain real docker build of the entire Dockerfile and never returns a broken or partially-spliced result. The degrade is recorded in WrapperReceipt::fell_through_reason so it is observable, never silent. A partial hit is likewise never spliced — it is a full real build (with fell_through_reason == None, since the cache was consulted successfully, it simply wasn’t a full hit).

§Errors

Returns WrapperError::Command only if the docker subprocess could not be spawned at all (e.g. the binary is missing) — a genuine environment failure, not a cache concern. Graph-computation and cache-backend errors are not propagated: they degrade to a real build. A failing docker build subprocess is not a WrapperError either — it is the typed WrapperOutcome::BuildFailed inside an Ok receipt.