Atomic promotion & the library
An accepted run is swapped into the library in one atomic rename — crash-safe at every step between working and done.
maps to as-built §8
When a run is accepted, its work moves from a private working copy to the library, the durable, global home for finished runs. The move is built so that it is impossible to end up half-promoted.
First a guard: promotion refuses unless the gate's signed marker validates,
so nothing reaches the library without passing the gate. Then the working
directory is moved into a hidden staging directory
(.<run>.promoting/), where the manifest.json
is written. Finally, a single atomic rename moves staging to its final home
at library/<scope>/<run>/.
Because each step is a rename, a crash at any point is recoverable. On the next attempt, deadreckon detects the half-finished state and finishes it: if only staging exists, complete the rename; if both exist, clean up staging; if the manifest is missing, write it. A run that was already promoted is left untouched.
After promotion, the library copy is canonical. The
working directory is gone, and state.working_dir now points at
the library: the artifact you review, apply, or export.