Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/dwarves

.nornir/auto-materialize-design.md

cache-hit auto-materialize — design

Class: design · Function axis: f0 the auto-restore seam (the whole) · f1 the materialize primitive · f2 the IncrementalOptions::materialize_dir knob · f3 the reuse-branch wiring · f4 observability (materialized / state_json) Strict: this file states only what auto-materialize IS — its parts and why they are shaped this way. Sibling how-to: auto-materialize-guide.md; zero-knowledge walkthrough: auto-materialize-for-idiots.md. Builds on the byte half: holger-artifact-store-design.md.

Auto-materialize is the inverse of the artifact-store push. When a step is skipped as a cache HIT or change-proven UNCHANGED, its artifact_id is fed forward to satisfy downstream deps — but its bytes are never re-produced this run. On a fresh workspace or a second machine, a downstream real step that consumes the upstream output finds nothing on disk. Auto-materialize closes that gap: on reuse, it materializes the reused artifact's bytes back onto disk in a workspace dir, so the downstream step finds the upstream output even though the upstream step was skipped.

The system as one — the function map (f0)

part lives in what it is
f1 materialize primitive crates/dwarves/src/artifact_store.rs materialize(store, artifact_id, dir, single_name) → Vec<(name, path)>: fetch by id, restore to disk — a manifest id restores every member under its name; a single-object id restores under the caller's basename; an unresolvable id (a runner label / miss) restores nothing without erroring
f2 materialize_dir knob crates/dwarves/src/incremental.rs IncrementalOptions::materialize_dir + with_materialize_dir; the workspace dir reused bytes land in. None (default) ⇒ id-only reuse, no disk write
f3 reuse-branch wiring crates/dwarves/src/incremental.rs auto_materialize() called in BOTH the CacheHit and Unchanged branches of run_pipeline_cached; best-effort, never fails the run
f4 observability crates/dwarves/src/incremental.rs CachedRunReport::materialized (step → restored names), materialized_files(), and state_json.materialized_files / .materialized

Why it is shaped this way

Place in the nordisk constellation

This completes the cache round-trip: put_artifacts (produce → seal into holger) on a RAN step, materialize (resolve → restore to disk) on a reused step. Together they make the action cache a true cross-machine cache: a hit on machine B not only carries the id forward but puts the real bytes where B's next step needs them. Wired into the real forge via DWARVES_MATERIALIZE_DIR (opt-in, a no-op without a store).

Deferred