Expand description
keel sim <plan> — fault/latency/crash-restart simulation over a
declarative plan (docs/sim-format.md; architecture-spec §8: v1 scope is
ADAPTER-LEVEL fault injection, not full hermetic/wasmtime determinism).
This module owns the parts that are genuinely CLI-shaped:
- dispatch the plan’s
target/argsexactly likekeel run(viarun::plan), withKEEL_SIM_PLAN(read by the language front ends’SimBackend) andKEEL_EVENTS=1(force the Tier 1 event sink on, so assertions always have something to read) layered onto the child; - detect a child that died to a signal (a
"crash"directive fired) and re-invoke the same plan against the same script, up tomax_restartstimes — the fault-plan front end persists its own per-target cursor across the restart (docs/sim-format.md“Crash-restart”), so this loop only needs to know “did it die, and how many times has that happened”; - after the loop settles, aggregate every event file the run(s) produced
under
.keel/events/(diffed against what existed before the sim started) and check the plan’sassertblock against them, plus the newest flow row in.keel/journal.dbwhenassert.flow_statusis set.
What actually injects a fault into an attempt lives entirely in the front
ends (python/keel/src/keel/_sim.py, node/keel/src/sim.mjs) — this
module never parses the plan’s faults block, only target/args/
max_restarts/assert (the fields it needs to drive and grade the run).
Functions§
- run
keel sim <plan>forproject: dispatch, crash-restart-drive, then grade.- run_
with - Like [
run], but lets the caller layer extra configuration onto every spawnedCommandbefore it runs (an integration test’sPYTHONPATH, a hermeticKEEL_BACKEND, …) — mirrorscrate::run::exec_with’sconfigurehook.runis exactlyrun_with(project, plan_path, &|_| {}).