Expand description
A checkpoint: what the engine writes after every node so a run can resume (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.3).
Module B of the engine, with state.rs. The types and the limits are
fixed here; encode, decode, diff and apply are the module’s
job. Its acceptance tests are state_acceptance_tests.rs.
A checkpoint is stored as a diff from the one before it (§3.3, the
retention paragraph); step 0 has nothing before it and is stored whole. The
ceiling is MAX_STEPS checkpoints per run.
The taint bits are part of the state, and a restore never clears one:
decoding then re-encoding gives back the same bits, and a value whose bits
are missing in the bytes is an error (see value::Tv).
Structs§
- Checkpoint
- Checkpoint
Diff - What changed from one checkpoint to the next. Fields that did not change
are absent. Variables removed are listed in
removed_vars. - Fork
- Where a replaying run came from: the run and the step it started at, and whether its blocks that have effects run for real. Never changes inside a run.
- Frontier
- The nodes of the graph by where they stand.
- Graph
Ref - The graph version a run started on: its number and the hash of its
graph (
versions::graph_hash). A run keeps this however the drone is edited. - Position
- Where the scheduler stands inside the graph, besides the frontier: which edges are decided, which blocks are done this pass of their loop, what each block has spent. Small, so a diff carries it whole when it changed.
Enums§
Constants§
- MAX_
STEPS - A run has at most this many checkpoints (§3.3).
- SCHEMA_
VERSION - The format of an encoded checkpoint. A reader refuses a version it does not
know (
CheckpointError::UnsupportedVersion), so an upgrade never resumes a run from bytes it would misread.
Functions§
- apply
prevwithdapplied: equal to thenextthe diff was made from.- changed_
counters 🔒 - The loop counters that changed. A counter for a loop guard never disappears while the run lasts (its graph is pinned), so an entry can only be added or raised, and the changed entries alone are enough to restore the map.
- changed_
map 🔒 - The entries of
nextthat are new or different fromprev’s. - changed_
state 🔒 - The variables and reducers that are new or different in
next. - decode
- The checkpoint in
bytes. A newerschema_versionisCheckpointError::UnsupportedVersion(checked before the rest is read); anything else wrong isCheckpointError::Unreadable. A restored value has exactly the bits it was saved with. - diff
- What changed from
prevtonext(next.step == prev.step + 1, same run). - encode
- A checkpoint as bytes (UTF-8 JSON, so a person can read one in a bug report).
Refuses
step >= MAX_STEPSwithCheckpointError::TooManySteps.