Run the plan-execute loop inside the daemon #15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/ram-44-plan-execute"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes RAM-44.
The coordinator could execute a plan and the daemon could plan one, but nothing joined them, so the journal was always empty and the end-to-end path was never demonstrable.
What landed
breadram_core::execution— the join, in one place.requests_for_planturns a plan into action requests (resolving the value to apply from the configured budget, and refusing what the configuration no longer allows with a named reason), andexecute_planruns them through the coordinator. It is the only code that decides whether a proposed action may be written: the mode is checked there, so no caller can bypass it, and a refusal is recorded rather than dropped.Restart recovery —
breadram_core::coordinator::persistholds a versioned state file of the values breadram owns;ActionJournal::from_owned_valuesrebuilds a journal that owns them;Coordinator::recoverrestores a value only while it still equals what breadram last wrote. A value something else changed is left alone, a gone target is skipped, and a state file this build does not understand is reported and ignored. The daemon writes it beside the runtime socket's state directory and reports what a startup restore did.Daemon wiring — the monitor pass now builds the adapter registry from the configured providers (a provider names the workload scope it owns; an endpoint with no scope, or a kind this build has no adapter for, is reported as contributing nothing), hands the real systemd
ControlExecutorto the execute step, publishes what it wrote, and marksjournal.executinghonestly. Onlyautomaticmode writes; the plan is still built and explained in monitor mode, labelleddry_run.Verification
Live on this host, with a transient user scope holding 200 MiB and a 4 MiB budget, in
automaticmode: breadram setMemoryHighthrough systemd (MemoryCurrent66.8 MiB → 4.2 MiB), andbreadram actionsshowedconfirmedwith the reason, the target, the timestamp,requested: -62599168,observed: -9408512, and the owned value with its original. Subsequent passes reportedskipped_duplicate, so the same action is not applied twice. After a restart the setting went back to its recorded original and the journal showedrolled_back | restored systemd:breadram-live-probe.scope:MemoryHigh to its original value. Inmonitormode the same configuration wrote nothing, left the state file byte for byte unchanged, and still reported the plan asdry_runwith a monitor note.Tests: 336 pass.
cargo fmt --all -- --checkandcargo clippy --workspace --all-targets -- -D warningsare clean.Two defects were caught by running it rather than by reading it: a recovered ownership record made
has_confirmedtrue, which would have suppressed the action forever after a restart even though the restart had just undone it; and the startup restore note was being cleared by the first tick.Not done here, named rather than implied
Transportinbreadram_core::adapter, so only host controls run. Configured providers are attached and their activity evidence reaches policy, which is what makes an idle-model release plannable; executing it needs the transport from RAM-13/RAM-14/RAM-45.monitorstops new writes but does not restore values already applied; the switch is reported, and the next automatic run restores them.