Raft leader election and log replication in nib: three nodes, each a fibre on
the simulated network, checked against a safety monitor by nib-tla.
| file | what it is |
|---|---|
raft.nib | the program; wires Main (Raft as stated), Mutant, Careless and Forgetful (each a known-wrong variant) |
RaftTrace.tla | the monitor: ElectionSafety, LogMatching, LeaderCompleteness, StateMachineSafety, Durability |
tla.json, worlds/ | what nib-tla verify areas/examples/raft-nib checks, in CI (repo:quint) |
explore.sh | runs a wire under many seeded worlds and keeps every refused run with the world file that reproduces it |
site/ | the public explainer at https://raft.app.jahfer.link (deploy name raft), served by nib-site's static server (package.nix) |
gen/ | build.py writes site/index.html from real runs: the two drawn runs, every refused sweep seed re-run, the verify table, code cut from the sources; check_site.py is the package's check |
The site is authoring-time output, committed. After a change to the program or
the monitor, rebuild it (needs nibc and nib-tla built, the grammar's
node_modules, and a checker as nib-tla finds one):
python3 areas/examples/raft-nib/gen/build.py # runs verify itself (~2 min)
python3 areas/examples/raft-nib/gen/build.py --verify-log verify.log
build.py refuses to write a page whose runs do not say what the page says:
the drawn correct run must be admitted, the drawn forgetful run refused at the
save the page explains, and every refused sweep seed refused again at the
entry verify reported.
Why it exists, what it showed, and what is still open: specs/nib-raft/INTENT.md.
1# raft-nib 2 3Raft leader election and log replication in nib: three nodes, each a fibre on 4the simulated network, checked against a safety monitor by `nib-tla`. 5 6| file | what it is | 7|---|---| 8| `raft.nib` | the program; wires `Main` (Raft as stated), `Mutant`, `Careless` and `Forgetful` (each a known-wrong variant) | 9| `RaftTrace.tla` | the monitor: ElectionSafety, LogMatching, LeaderCompleteness, StateMachineSafety, Durability | 10| `tla.json`, `worlds/` | what `nib-tla verify areas/examples/raft-nib` checks, in CI (`repo:quint`) | 11| `explore.sh` | runs a wire under many seeded worlds and keeps every refused run with the world file that reproduces it | 12| `site/` | the public explainer at **https://raft.app.jahfer.link** (deploy name `raft`), served by nib-site's static server (`package.nix`) | 13| `gen/` | `build.py` writes `site/index.html` from real runs: the two drawn runs, every refused sweep seed re-run, the `verify` table, code cut from the sources; `check_site.py` is the package's check | 14 15The site is authoring-time output, committed. After a change to the program or 16the monitor, rebuild it (needs `nibc` and `nib-tla` built, the grammar's 17`node_modules`, and a checker as `nib-tla` finds one): 18 19```sh 20python3 areas/examples/raft-nib/gen/build.py # runs verify itself (~2 min) 21python3 areas/examples/raft-nib/gen/build.py --verify-log verify.log 22``` 23 24`build.py` refuses to write a page whose runs do not say what the page says: 25the drawn correct run must be admitted, the drawn forgetful run refused at the 26save the page explains, and every refused sweep seed refused again at the 27entry `verify` reported. 28 29Why it exists, what it showed, and what is still open: `specs/nib-raft/INTENT.md`.