persistence: SubstrateStore enable_persistence(dir)
Same pattern as carriers: per-substrate binary record (.sub) with atomic .tmp+rename, replay on enable, delete on remove. Records current state across all three E90 axes (location / processing / ID-status), plus substid / carrierid / slot / free-form location label. History is deliberately NOT journaled — it's an in-memory ring buffer and rebuilding from replayed state would mislead. Five new tests cover full-axis replay, every terminal processing state, remove-deletes-journal, corrupt-record drop, and the history-is-transient invariant. Closes #2 in the test-gap backlog. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -127,6 +127,15 @@ class SubstrateStateMachine {
|
||||
bool on_processing_event(SubstrateProcessingEvent e);
|
||||
bool on_id_event(SubstrateIDEvent e);
|
||||
|
||||
// Direct state-restore (persistence replay only). Bypasses the
|
||||
// transition tables and does NOT fire change handlers.
|
||||
void restore_state(SubstrateState loc, SubstrateProcessingState proc,
|
||||
SubstrateIDStatus id) {
|
||||
loc_ = loc;
|
||||
proc_ = proc;
|
||||
id_ = id;
|
||||
}
|
||||
|
||||
private:
|
||||
SubstrateTable loc_table_;
|
||||
SubstrateProcessingTable proc_table_;
|
||||
|
||||
Reference in New Issue
Block a user