Expand description
The VM harness’s in-VM half. nix/tests/gym-vm.nix boots a NixOS VM with
the gym fixtures and a Planarian built with gym-hooks, then drives one
catalog entry through these commands:
planarian-gym vm plan –id ID how each step runs: vm, host, armed or unsupported planarian-gym vm begin –id ID wait for a healthy baseline, record it, start sampling planarian-gym vm step –id ID –index N planarian-gym vm request –json REQ (run as the step’s actor, via runuser) planarian-gym vm sample the status sampler (a transient unit) planarian-gym vm judge –id ID wait the window, gather evidence, judge
Host steps (reboot, suspend, hot-unplug, the upstream machine) are done by
the test driver. Steps timed to a journal state are armed: a planariad kill
becomes a crash point (/run/planarian-gym/crash) on the request before
it, as in the fake harness; other timed steps run from a watcher.
Structs§
Constants§
- HOOKS_
DIR 🔒 - ON_
A_ 🔒TERMINAL - Run argv[1] as the leader of a new session on a new pty, print what it writes, and exit with its status.
- RUN
- Where a run keeps its state (survives a reboot of the VM).
- SAVED 🔒
- Journal entries saved before a forced compaction discarded them.
Functions§
- begin 🔒
- Wait for a healthy baseline: the daemon answers, every expected unit is up with no incident left over from boot, and this generation is the known-good one.
- build_
roots 🔒 - call
- compact_
and_ 🔒save - Force a compaction and save what it discarded, from the daemon’s own
answer (
Response::Compacted: the segment, read in the same core call as the compaction). Reading the segment here first left a gap the daemon’s tick could journal into, so the saved history fell short of what the checkpoint holds (gate 41604917858,replay_equivalent). - config 🔒
- console 🔒
- die 🔒
- effects 🔒
- Backend mutations, from the journal’s calls: an activation runs as the
transient unit
planarian-op-<txn>-<epoch>-<seq>and lasts as long as systemd says it ran; any other call is an instant at its OpBegin. Calls the backend fenced, and calls never acknowledged that left no unit, are not effects. - evidence 🔒
- Gather what the run left behind.
- hooks_
set 🔒 - is_
request 🔒 - journal_
copy 🔒 - journal_
reached 🔒 - judge 🔒
- Wait the window (ending early once the entry passes, if nothing in it could still turn), then judge.
- ledger 🔒
- The journal as the daemon left it: a copy, replayed.
- main
- needs_
full_ 🔒window - Keys whose truth can change late in the window: judge them only at its end.
- pause_
call 🔒 - Run one step inside the VM.
The backend call the daemon pauses before when a step is timed to this
journal state (gym hooks
pause). Staging and the build happen before the transaction is prepared, soStagedis never journaled: the build is where the source is staged. Publishing followsCheckingat once. - plan
- How each step runs in a VM.
- posture_
seen 🔒 - The posture’s record of the run: the samples, and the posture units’ and planariad’s journal since the start.
- posture_
snapshot 🔒 - The failure classes in force (nix/posture.nix’s /run/planarian/failed-*) and the responses observable right now (§12d).
- probe_
defs 🔒 - The probe definitions of the running generation, per unit.
- probe_
ports 🔒 - The TCP ports a unit’s network probes connect to.
- read_
json 🔒 - real 🔒
- record_
posture 🔒 - One posture sample, appended to the run’s record when a class is raised.
- request 🔒
- request_
as 🔒 - Send a request as the step’s actor and record the answer.
- request_
at 🔒 - Send a request as
actorfrom a process that has a controlling terminal (scriptallocates one) or that has none (setsid, a new session): the daemon reads which from the process (§11, B-3). - run_dir 🔒
- run_
step 🔒 - s 🔒
- sample 🔒
- The status sampler: every 2 s, what the daemon shows.
- segment 🔒
- The entries since the journal’s last checkpoint.
- sh 🔒
- sh_out 🔒
- stalls 🔒
- #9: a stalled activation fails the entry, whatever else it judges (a 15-minute startup stall once passed a 20-minute window unnoticed): an activation unit that ran into its start timeout, or one still activating at the end for longer than the entry’s own slow_backend delay plus 300 s.
- status_
name 🔒 - statuses 🔒
- step 🔒
- steps 🔒
- unit_
cmd 🔒 - user_
for 🔒 - The VM’s users, by catalog actor.
- write_
json 🔒