Expand description
Run state: the named values a graph writes, and how writes combine (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.2).
Module B of the engine, with checkpoint.rs. The types and the cap are
fixed here; RunState::write and the rest are the module’s job. Its
acceptance tests are state_acceptance_tests.rs.
§Reducers
A variable declares how its writes combine. A name with no declaration is
replace. The reducer decides the value, and merged_bits decides the
taint bits of the result (the same rule for every reducer: none clears a bit).
| Reducer | First write | Next write w onto current c | Type error when |
|---|---|---|---|
replace | w | w | never |
append | [w] | c with w pushed as one element (a list w is one element) | c is not a list |
merge | w | shallow merge, w’s keys win | c or w is not an object |
add | w | c + w; integers stay integers (1 + 2 is 3) | c or w is not a number |
Structs§
- RunState
- State
Snapshot - What a checkpoint stores of the state: every value with its bits, and the reducer each name declared.
Enums§
Constants§
- STATE_
CAP_ BYTES - The state of a run is at most this many bytes of JSON (§3.2).
Functions§
- add_
numbers 🔒 - The sum of two JSON numbers, keeping integers integers where it can.
- add_
value 🔒 add: numbers only; two integers stay an integer, any float makes a float.- append_
value 🔒 append: the first write makes[w]; after thatwis one more element.- check_
name 🔒 - Refuse a name that cannot be a variable: empty, with a dot, or with whitespace.
- integer_
of 🔒 - The integer a JSON number holds, signed or unsigned, as an
i128. - kind 🔒
- What a value is, for the
gothalf of aStateError::Type. - merge_
value 🔒 merge: a shallow object merge,w’s keys winning. A merge channel holds objects, so the first write must be one too.- merged_
bits - The bits a write leaves on a variable: no reducer clears a bit (spec
4.1 “a reducer cannot clear taint”, 4.2 “tainted if any contributing write
is tainted”). With nothing there yet they are the write’s; after that they
are
joinof the current value and the write,replaceincluded: a clean write over a tainted value leaves it tainted, because a person cannot tell from the variable which text is still in it. - snapshot_
len 🔒 - The JSON length of a snapshot, the measure
STATE_CAP_BYTESbounds. - type_
error 🔒