The plain version
Before a pilot takes off, there is a checklist. Before the plane actually leaves the ground, the pilot checks again that nothing changed since the checklist. And the checklist is not a list the passenger wrote.
A write request in Sawbones gets the same treatment. It is checked against what we know (preflight), sorted into a hazard class (classify), and checked again at the instant it would run (confirm), using a ticket that works once.
What merged
- #183: the policy engine, with a pure function
classify. - #189: value limits as facts, and identifiers that outside text cannot spell.
- #217: a signal's register width comes from its write-map entry, never from the value.
- #218: fact scope, invalidation and the write preflight.
Classify
classify takes an effect request (what a plugin asked for, as typed data), the write map and the bus facts. A plugin never exposes tools of its own, and a write to a raw register address cannot be written down: a request names a signal on a unit on a port.
The rules, in order: passive listening transmits nothing and is class 0. A bus write needs a write-map entry whose own trust tier is measured or operator-attested, or it is refused as class 4. Its class is the highest of the entry's class, the minimum class for its kind of setting (battery protection limits have one), class 2 if it is energy-relevant, and class 2 because a write transmits at all. Anything that transmits needs an actionable fact saying the bench is the only master on that bus. A value outside the entry's range, or of the wrong width, is refused. The class can only go up as context is added; there is no method that lowers it.
The answer is a class and what that class needs: nothing, armed rail A, a rail B lease bound to one action, or a refusal. A refusal is always reported as class 4.
Facts, and why they go stale
A fact such as "register 0x0010 on this inverter is the low-voltage cutoff" was earned on one device, with one firmware, over one interface, under some conditions, by some method. FactScope records all of that. A firmware, serial or model change, a lost device, a rewired port, a foreign bus master, a reflashed instrument, a condition that ends, an open contradiction or a break in the clock invalidates the facts it touches. An invalidation is sticky: the fact must be recorded again, even if the cause goes away.
preflight works out the facts a request relies on itself. It never takes a list from the agent. It refuses with a named reason, naming the first fact that is missing, stale, contradicted or out of scope.
Confirm
If every fact holds, preflight returns a PreflightToken bound to the request, the action digest, the fact versions, the ledger generation and the store's chain head. confirm consumes the token at the moment of action. It refuses unless the token was made by this ledger for this exact request, it has not expired, the chain head is the same, the ledger has not changed at all, and running the preflight again gives the same decision on the same fact versions. Consuming it means it cannot be reused.
The supervisor wires these into one path: preflight, then a taint check, then invoke, which takes both results by value. See the brain and the taint latch note.
Tests
tests/preflight.rs and properties.rs cover the facts. Red-team tests in sawbones-redteam attack the preflight directly.
Not built yet
The knowledge store that will hold the facts is not built. Known-answer checks against a real voltage reference need real modules. Ledger events are reported by the host and nothing signs them yet.
Links
- Crate: sawbones-policy
- PRs: #183, #189, #217, #218