Expand description
Graph versions: saving a drone makes a numbered version, a job pins one, and a running run keeps the one it started on (docs/specs/SPEC_DRONE_GENERAL_AUTOMATION_2026_11_11.md §3.3 “Graph versions”).
Module C of the engine. The types, graph_hash and the store trait
are fixed here; the table and the store methods are the module’s job. Its
acceptance tests are versions_acceptance_tests.rs.
§Storage
Versions live beside the definitions, in the shared store
(state.id_store), in a table db_drone_versions:
(drone_id, version, graph, hash, saved_at, saved_by), primary key
(drone_id, version). No foreign key to db_drone_definitions (see
migrations/m0038_drop_drone_runs_definition_fk.rs: the stores of one drone
are not always in one file). Deleting a drone deletes its versions
(deletedrone), the way it deletes its runs.
The migration is m0049_drone_versions (the next number on main when
this was written; take the next free one if it is taken). It is not
registered by the interfaces PR, so that a release between the two PRs
cannot record it as applied while empty.
Structs§
- Graph
Version - One saved version of a drone’s graph.
Enums§
- Pin
- Which version a job runs: the newest at the time it fires, or one number.
Constants§
- SELECT 🔒
- The columns every read below selects, in
version_from_row’s order.
Traits§
Functions§
- graph_
hash - The SHA-256 of a graph, as lowercase hex, of its canonical JSON: object keys sorted, no whitespace. Two graphs with the same content have the same hash however their JSON was ordered.
- insert_
version 🔒 - The next version of
drone_idand its insert, onconn(a transaction the caller owns). A deferred transaction would let two connections read the same maximum; both callers take the write lock first. - version_
from_ 🔒row - One row as the table stores it. The graph text can be from a newer build, so a parse failure is a store error, never a panic.
- write_
canonical 🔒