19 Commits
Author SHA1 Message Date
jochen 0714f7a509 Pin R92 to today's genesis: main with every genesis fix, and the same without #91 (hq issue 92)
mesh/merge-gate head 0714f7a50933 merged into trunk 6ba65a12f218 — pass: the change touches no module of the mesh's graph
mesh/repo-check head 0714f7a50933 merged into trunk 6ba65a12f218 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
At the fix's merge no genesis got past step 6 (issue 146), so neither side of the replay reached the
push it replays. Fix is mesh-host main 0d11b4fc; Before is that main with #91 reverted, on the
unmerged branch replay/r92-before; the controller and catalogue at their mains on both sides.
2026-10-13 02:59:45 +02:00
jochen d03f87b00d Register R92 as a bed: genesis on a runtime that trusts no registry (hq issue 92)
The lab's base image trusts the documentation ranges as plain-HTTP registries, so no genesis bed could
see the push to an untrusted registry that issue 92 is about (reviews 73 and 76 on mesh-host #91). The
bed takes that trust off the anchor before the installer runs and asks the runtime it trusts loopback
only, then runs genesis with --registry 192.0.2.10:5000 and holds that the control plane reaches the
registry, trusted by the mesh's name too.

The prover gains a bed kind: it builds the node-engine and its installer at each commit, the carried
builder from the pinned controller, and raises the bed; a bed that never reached the step it replays
skips, and a skip is an error, never the fault reproduced.

Not proved yet: genesis stops at step 6 on both sides, because the temporary controller has no
MESH_BUS_NATS and the bus template is refused by the installer (issue 146).
2026-10-13 02:57:21 +02:00
mesh-admin 51fa3a73ab Merge pull request 'Name the build agent where genesis needs the module that builds (issue 596)' (#93) from fix/596-genesis-names-the-build-agent into main 2026-10-13 00:57:03 +00:00
mesh-admin 383176a7ea Merge pull request 'Register R279 and R412: a folder could not follow its module's account; a seat named no paths (hq issues 279, 412)' (#90) from fix/279-412-replays into main 2026-10-13 00:45:30 +00:00
jochen 671d56a08a Register R279 and R412: a folder could not follow its module's account; a seat named no paths (hq issues 279, 412)
mesh/merge-gate head 671d56a08a47 merged into trunk b7f46559f053 — pass: the change touches no module of the mesh's graph
mesh/repo-check head 671d56a08a47 merged into trunk b7f46559f053 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
mesh/delivery-group group fix/279-412-replays merged: every member is merged
Both proved with cmd/prove: each fails on the commit before its fix (mesh-controller #260, #267) and passes on it.
The replays' files are in mesh-controller fix/279-412-replays (3bdab29).
2026-10-13 02:40:08 +02:00
mesh-admin b7f46559f0 Merge pull request 'Register R166: a requirement could not be optional (hq issue 166)' (#92) from fix/166-replay into main 2026-10-13 00:38:10 +00:00
jochen abc022eece Name the build agent where genesis needs the module that builds (hq issue 596)
mesh/merge-gate head abc022eece61 merged into trunk 383176a7eab3 — pass: the change touches no module of the mesh's graph
mesh/repo-check head abc022eece61 merged into trunk 383176a7eab3 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
The beds checked the catalogue for builder/module.json before running genesis and the mesh beds held
'builder' among a raised mesh's modules; the catalogue retired builder for build-agent on 2026-10-03
(ADR 0190), so every genesis bed stopped before the installer ran.
2026-10-13 02:29:19 +02:00
jochen 87eca0c9a9 Register R166: a requirement could not be optional (hq issue 166)
mesh/merge-gate head 87eca0c9a9e8 merged into trunk e5ccf484684d — pass: the change touches no module of the mesh's graph
mesh/repo-check head 87eca0c9a9e8 merged into trunk e5ccf484684d — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
Issue 166 resolves with its replay. TestReplay166 in the controller (mesh-controller #287) uses only
what the catalogue had before #281, so the prover lays it over the commit before: it fails there and
passes on the fix.
2026-10-13 02:28:18 +02:00
mesh-admin e5ccf48468 Merge pull request 'Raise genesis past its broker step and hold that the bus is kept (issue 590, hq ADR 0333 §5)' (#91) from fix/590-genesis-keeps-its-bus into main 2026-10-13 00:22:07 +00:00
jochen c7c7268db0 Raise genesis past its broker step and hold that the bus is kept (hq issue 590, ADR 0333 §5)
mesh/merge-gate head c7c7268db08c merged into trunk d3ef6fa44caf — pass: the change touches no module of the mesh's graph (run 2)
mesh/repo-check head c7c7268db08c merged into trunk d3ef6fa44caf — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
The bed runs the installer from bare twice: first with a catalogue missing the nats module, so it stops
at the broker step by name and the bed reads the bus there; then with the whole catalogue, through the
step. It passes only when exactly one bus container runs, it is mesh-broker-nats on the module's image,
every stream that held something before the step is still the same stream, and the mesh still hears
from the first node. A first run that never reaches the step skips with the reason; a second run that
stops at the step fails.

The judgement is a pure function, test/integration/bus-kept.ts, held by unit tests without a lab.
2026-10-13 02:13:35 +02:00
mesh-admin d3ef6fa44c Merge pull request 'Name the one genesis bundle in every bed and the README (issue 146, ADR 0331)' (#89) from fix/146-one-genesis-bundle into main 2026-10-12 21:12:13 +00:00
jochen 1af6efb356 Name the one genesis bundle in every bed and the README (hq issue 146, ADR 0331)
mesh/merge-gate head 1af6efb35677 merged into trunk 782aa9f73791 — pass: the change touches no module of the mesh's graph
mesh/repo-check head 1af6efb35677 merged into trunk 782aa9f73791 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
mesh-host now carries one genesis bundle, foundation-first-node.lock, on the bus the
mesh runs on; the NATS one it replaces is deleted. Beds that still named it would point
at a file that is gone, and the harness's rewrite for the previous broker's image
rewrote nothing.
2026-10-12 22:50:50 +02:00
mesh-admin 782aa9f737 Merge pull request 'Register R201: a plan sent the control node a controller older than the one running there (hq issue 201)' (#88) from fix/201-replay into main 2026-10-12 20:22:43 +00:00
jochen a96226f228 Register R201: a plan sent the control node a controller older than the one running there (hq issue 201)
mesh/merge-gate head a96226f22819 merged into trunk 5c1c6f56c9d9 — pass: the change touches no module of the mesh's graph
mesh/repo-check head a96226f22819 merged into trunk 5c1c6f56c9d9 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
Proved: fails on mesh-controller 84deb53^1, passes on 84deb53 (the fix, #273).
The replay is mesh-controller #275's TestReplay201ThePlansSend, since the
fix's own TestReplay201 reads what the fix added.
2026-10-12 21:18:59 +02:00
mesh-admin 5c1c6f56c9 Merge pull request 'Register R401 and R561: an outside secret nobody gave was made; a plan's id was pasted into SQL (hq issues 401, 561)' (#87) from fix/401-replay into main 2026-10-12 18:22:12 +00:00
jochen 3c655d83e1 Register R561: a plan's id was pasted into the SQL that reads it (hq issue 561)
mesh/merge-gate head 3c655d83e11e merged into trunk 24b833d19dad — pass: the change touches no module of the mesh's graph
mesh/repo-check head 3c655d83e11e merged into trunk 24b833d19dad — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery delivered
mesh/delivery-group group fix/401-replay merged: every member is merged
Proved: fails on mesh-controller f8daec0^1, passes on f8daec0 (the fix, #268).
2026-10-12 19:01:18 +02:00
jochen e63459dd70 Register R401: the send made a value for an own secret issued outside the mesh that nobody gave (hq issue 401)
mesh/delivery-group group fix/401-replay checking: 0 of 2 member(s) ready
mesh/merge-gate head e63459dd702a merged into trunk 24b833d19dad — pass: the change touches no module of the mesh's graph
mesh/repo-check head e63459dd702a merged into trunk 24b833d19dad — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript)…
mesh/delivery superseded: a newer head of the same pull request
Proved: fails on mesh-controller 1e28342^1, passes on 1e28342 (the fix, #262). The replay is mesh-controller #274's TestReplay401, since the fix's own test reads what the fix added.
2026-10-12 18:37:30 +02:00
mesh-admin 24b833d19d Merge pull request 'Register R341: a check judged the head alone and let a merge that does not compile through (hq issue 341)' (#86) from feat/341-a-merge-check-judges-the-merge into main 2026-10-12 16:11:30 +00:00
jschoubben 79108a72a0 Register R341: a check judged the head alone and let a merge that does not compile through
mesh/merge-gate pass: the change touches no module of the mesh's graph
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (typescript), replays/merge-check.sh (go), asks/merge-check.sh …
mesh/delivery delivered
mesh/delivery-group group feat/341-a-merge-check-judges-the-merge merged: every member is merged
Proved with replays/cmd/prove: TestReplay341 fails on the controller's main
and passes on its fix (novox/hq ADR 0323, issue 341).
2026-10-12 17:29:59 +02:00
44 changed files with 1097 additions and 53 deletions
+4 -4
View File
@@ -148,10 +148,10 @@ is written down here rather than reconstructed a third time.
# built for \"\", which is not a system it knows" — which reads like a broken bundle and is not
# (novox/hq 04-ISSUES/146).
export MESH_LAB_HOST_BINARY=<mesh-host>/mesh-host
# The bundle that raises the bus the mesh runs on. The other one in that directory raises the
# predecessor's broker and a control plane that crash-loops on a missing MESH_BUS_NATS — which
# looks like a broken lab and is a bundle nobody moved (novox/hq 04-ISSUES/146).
export MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node-nats.lock
# The one genesis bundle, on the bus the mesh runs on (novox/hq ADR 0331). The bundle that raised the
# predecessor's broker, and a control plane that crash-looped on a missing MESH_BUS_NATS, is gone
# (novox/hq issue 146).
export MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node.lock
export MESH_LAB_MODULES=<mesh-controller>/examples/modules
export MESH_LAB_BUILDER=<mesh-controller>/build/mesh-builder # build/, which is git-ignored
+143 -2
View File
@@ -7,7 +7,9 @@
// The clones are the core repositories, side by side as the lab expects them. A replay in its repository
// is laid over a worktree of each commit and run with go test; the bus replay runs against a server of
// the release the catalogue pinned at each commit, raised for it; the resolver replay with the catalogue's
// resolver at each commit. MESH_TEST_POSTGRES is passed through to the controller's.
// resolver at each commit; a bed of the lab is raised on its hypervisor with the node-engine and its
// installer built at each commit (a workstation where `mesh-lab check` passes). MESH_TEST_POSTGRES is passed
// through to the controller's.
package main
import (
@@ -20,6 +22,8 @@ import (
"os"
"os/exec"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"
@@ -63,7 +67,12 @@ func main() {
// run is the replay at one commit: passes, fails, or absent (the check it replays did not exist).
func run(r replays.Replay, repos, at string, fixed bool) (string, string) {
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Minute)
limit := 15 * time.Minute
if r.Kind == replays.Bed {
// Two machines raised, a foundation pulled and a control plane built inside one of them.
limit = 90 * time.Minute
}
ctx, cancel := context.WithTimeout(context.Background(), limit)
defer cancel()
repo := filepath.Join(repos, r.Repository)
tree, err := os.MkdirTemp("", "prove-"+r.ID+"-")
@@ -77,6 +86,8 @@ func run(r replays.Replay, repos, at string, fixed bool) (string, string) {
defer exec.Command("git", "-C", repo, "worktree", "remove", "--force", tree).Run()
switch r.Kind {
case replays.Bed:
return aBed(ctx, r, repos, tree, fixed)
case replays.InRepository, replays.Gate, replays.Liveness:
home := filepath.Join(repos, r.Repository)
if r.Home != "" {
@@ -155,6 +166,136 @@ func run(r replays.Replay, repos, at string, fixed bool) (string, string) {
return "error", "no such kind"
}
// aBed raises the lab's bed at one commit of the fixed repository (novox/hq issue 92): the node-engine and its
// installer built from it, the installer carrying a builder built from the controller the replay pins, and
// the bed run with them, the pinned controller to build from and the pinned catalogue to read.
func aBed(ctx context.Context, r replays.Replay, repos, tree string, fixed bool) (string, string) {
beside := map[string]string{}
for _, also := range r.With {
ref := also.Fix
if !fixed {
ref = also.Fix + "^1"
if also.Before != "" {
ref = also.Before
}
}
other, err := os.MkdirTemp("", "prove-"+r.ID+"-"+also.Repository+"-")
if err != nil {
return "error", err.Error()
}
defer os.RemoveAll(other)
clone := filepath.Join(repos, also.Repository)
if out, err := exec.CommandContext(ctx, "git", "-C", clone, "worktree", "add", "--quiet", "--detach", other,
ref).CombinedOutput(); err != nil {
return "error", string(out)
}
defer exec.Command("git", "-C", clone, "worktree", "remove", "--force", other).Run()
beside[also.Repository] = other
}
controller, catalogue := beside["mesh-controller"], beside["mesh-catalog"]
if controller == "" || catalogue == "" {
return "error", "a bed is raised with the controller and the catalogue it pins, and this one pins " +
"not both"
}
builder, err := builderImage(ctx, controller)
if err != nil {
return "error", err.Error()
}
host, installer := filepath.Join(tree, "mesh-host"), filepath.Join(tree, "mesh-bootstrap")
for _, step := range [][]string{
{"make", "build", "SYSTEM=arch"},
{"make", "bootstrap", "IMAGE=" + builder, "BOOTSTRAP_OUT=" + installer},
} {
cmd := exec.CommandContext(ctx, step[0], step[1:]...)
cmd.Dir = tree
if out, err := cmd.CombinedOutput(); err != nil {
return "error", fmt.Sprintf("%s: %v %s", strings.Join(step, " "), err, lastLines(string(out), 6))
}
}
lab, err := filepath.Abs("..")
if err != nil {
return "error", err.Error()
}
cmd := exec.CommandContext(ctx, "node", "--test", "--test-reporter=tap", "--experimental-strip-types", r.Test)
cmd.Dir = lab
cmd.Env = append(os.Environ(),
"MESH_LAB_HOST_BINARY="+host,
"MESH_LAB_BOOTSTRAP_BINARY="+installer,
// The template the installer knows how to make safe: it rotates the store's and the broker's
// well-known credentials, and refuses a template naming neither (the bus one names no broker).
"MESH_LAB_BUNDLE="+filepath.Join(tree, "examples", "foundation-first-node.lock"),
"MESH_LAB_CATALOG="+filepath.Join(catalogue, "modules"),
"MESH_REPLAY_CONTROLLER="+controller)
out, err := cmd.CombinedOutput()
return bedVerdict(string(out), err)
}
// builderImage is the builder the installer carries, built from the controller at the commit the replay
// pins, on the Go release its go.mod asks for; built once and kept under a tag naming the commit.
func builderImage(ctx context.Context, controller string) (string, error) {
head, err := exec.CommandContext(ctx, "git", "-C", controller, "rev-parse", "--short=12", "HEAD").Output()
if err != nil {
return "", err
}
tag := "mesh-builder:prove-" + strings.TrimSpace(string(head))
if exec.CommandContext(ctx, "docker", "image", "inspect", tag).Run() == nil {
return tag, nil
}
mod, err := os.ReadFile(filepath.Join(controller, "go.mod"))
if err != nil {
return "", err
}
release := ""
for _, line := range strings.Split(string(mod), "\n") {
if v, ok := strings.CutPrefix(line, "go "); ok {
parts := strings.Split(strings.TrimSpace(v), ".")
if len(parts) >= 2 {
release = parts[0] + "." + parts[1]
}
}
}
if release == "" {
return "", errors.New("the controller's go.mod names no Go release to build its builder on")
}
cmd := exec.CommandContext(ctx, "docker", "build", "-q", "--build-arg", "GO_BASE=golang:"+release+"-alpine",
"-f", "cmd/mesh-builder/Dockerfile", "-t", tag, ".")
cmd.Dir = controller
if out, err := cmd.CombinedOutput(); err != nil {
return "", fmt.Errorf("the builder could not be built from %s: %v %s", controller, err, lastLines(string(out), 6))
}
return tag, nil
}
// bedVerdict reads node's test runner: a skipped bed is an error — it never reached what it replays, or was
// not given what it raises — and never the fault reproduced.
func bedVerdict(out string, err error) (string, string) {
count := func(what string) int {
m := regexp.MustCompile(`(?m)^# ` + what + ` (\d+)$`).FindStringSubmatch(out)
if m == nil {
return -1
}
n, _ := strconv.Atoi(m[1])
return n
}
pass, fail, skipped := count("pass"), count("fail"), count("skipped")
switch {
case skipped > 0:
said := regexp.MustCompile(`(?m)# SKIP (.*)$`).FindStringSubmatch(out)
if said != nil {
return "error", "the bed skipped: " + said[1]
}
return "error", "the bed skipped: " + lastLines(out, 6)
case fail > 0:
if m := regexp.MustCompile(`(?m)^\s+error: [|>]?-?\s*\n?\s*(.+)$`).FindStringSubmatch(out); m != nil {
return "fails", strings.TrimSpace(m[1])
}
return "fails", lastLines(out, 6)
case pass > 0 && err == nil:
return "passes", lastLines(out, 3)
}
return "error", lastLines(out, 6)
}
func replayHere(ctx context.Context, r replays.Replay, env string) (string, string) {
cmd := exec.CommandContext(ctx, "go", "test", "-count=1", "-run", "^"+r.Test, r.Package)
cmd.Env = append(os.Environ(), env)
+120
View File
@@ -32,6 +32,11 @@ const (
// judged by the node-engine at the commit, and the controller at the commit judging its gate from what
// the engine said (novox/hq ADR 0240). Two repositories move together: Repository and With.
Liveness Kind = "liveness"
// Bed is a bed of the lab, raised on its hypervisor: Test is its file under test/integration, run with
// the node-engine and its installer built from Repository at the commit, beside the With repositories at
// theirs (novox/hq issue 92). A bed that could not reach the step it replays skips, and the prover reads
// a skip as an error, never as the fault reproduced.
Bed Kind = "bed"
)
// Also is another repository a replay runs at its own commits beside Repository's: before its fix and on
@@ -357,6 +362,31 @@ var Register = []Replay{
"answer: only what needs pacman fails, with the probe's words, and the file is written and recorded",
Package: "./cmd/mesh-host", Test: "TestReplay233",
Files: []string{"cmd/mesh-host/replay233_test.go"}},
// Genesis pushed to a registry its runtime did not yet trust (2026-09-22): the first real genesis raised the
// mesh's registry and pushed the control plane's image to it by the address it was given, and the runtime
// refused plain HTTP, because the trust was written by the docker module six steps after the push. The
// lab never saw it: its base image trusts the documentation ranges before any bed starts. A bed here,
// whose anchor has that trust taken off before the installer runs, raised with the node-engine and its
// installer built at the commit; the control plane genesis builds and the catalogue it reads are pinned,
// the same on both sides.
//
// **Pinned to today's genesis, not to the fix's merge** (hq issues 146, 590, 596, 597): at the merge of
// the fix (mesh-host #91, dd9ab792) no genesis got past step 6, so neither side reached the push. Fix is
// mesh-host main with every genesis fix since; Before is the same main with #91 reverted, kept on the
// branch replay/r92-before and never merged.
{ID: "R92", Issue: 92, Kind: Bed, Repository: "mesh-host", Fix: "0d11b4fc930d6723f3dc54dc173175f66fb6b3b3",
Before: "9e233e1d87569273b4ed353c450b0bd27d21039b",
What: "the first real genesis pushed the control plane's image to the registry it had just raised and was " +
"refused, server gave HTTP response to HTTPS client: the runtime's trust of the registry was written " +
"by the docker module, six steps after the push",
Asserts: "on a runtime that trusts no registry but loopback, genesis given --registry <its own address>:5000 " +
"pushes the control plane to the registry it raised, and the runtime trusts that registry by the " +
"mesh's name too",
Test: "test/integration/replay92.test.ts",
With: []Also{
{Repository: "mesh-controller", Fix: "49102e1645c920e42e453caf0aa0746d2b93ce90", Before: "49102e1645c920e42e453caf0aa0746d2b93ce90"},
{Repository: "mesh-catalog", Fix: "f88e3452f8b8b285ed86e1fe93e1a153f71faada", Before: "f88e3452f8b8b285ed86e1fe93e1a153f71faada"},
}},
// Not a core incident, and the first of its kind: a module's. The crash loop was found by a person
// reading the agent server's log for another reason (issue 268); research 032 measured it, and ADR
// 0240 makes the node-engine judge it and the gate fail it.
@@ -378,6 +408,96 @@ var Register = []Replay{
Asserts: "a web server whose application never answers is said unhealthy by its declared HTTP check within two " +
"looks, and the controller raises the module's condition on the second",
Package: ".", Test: "TestReplaySilentWebApp", Files: []string{"cmd/mesh-controller/replays_test.go"}},
// A merge check judged the head alone (2026-10-09): node-engine #66 was checked green at its head after #64/#65
// had moved the trunk, both adding a field under the JSON key `declared`; git merged the two edits cleanly and the
// trunk no longer compiled. A test in the controller's builder, written with only what it had before the fix, run
// with a container runtime that runs each container's command on the machine. The fix is still on its branch:
// Fix is its pull request's head, proved against the main it branched from (novox/hq ADR 0323).
{ID: "R341", Issue: 341, Kind: InRepository, Repository: "mesh-controller", Fix: "83a9cf6", Before: "3cfc121",
What: "node-engine #66 passed both statuses at its head and merged; merged into the trunk #65 had moved, it did " +
"not compile: Declared redeclared",
Asserts: "a check judges the head merged into the trunk's head, and fails a head whose merge does not compile, " +
"saying so",
Package: "./internal/builder", Test: "TestReplay341", Files: []string{"internal/builder/replay341_test.go"}},
// The mesh made a value for a secret only an outside party issues (2026-10-10): nobody had given the mounts
// module's smb-credentials, the send made a random value for it and placed it, and the module read it as a
// credential given and wrong (ADR 0228: such a secret is never made). The fix's own test reads what the fix added,
// so the replay is a test of its own in the controller, written with only what it had before the fix — register,
// assign, planFor, declarationFor, the inventory's secret reads — laid over the commit before. Needs a store:
// MESH_TEST_POSTGRES, as R237. Fix is the merge of its pull request (mesh-controller #262); Home is the commit that
// added the replay (mesh-controller #274), reachable once that pull request merges.
{ID: "R401", Issue: 401, Kind: InRepository, Repository: "mesh-controller", Fix: "1e28342edec170d59570e8127ddead7b19a70c20",
What: "the send made a random value for an own secret issued outside the mesh that nobody gave, and placed it: " +
"the module read it as a credential given and wrong",
Asserts: "the send makes no value for an own secret issued outside the mesh that nobody gave and places none, " +
"places no value the mesh made for it before, and places a value once a person gives one",
Package: "./cmd/mesh-controller", Test: "TestReplay401", Files: []string{"cmd/mesh-controller/replay401_test.go"},
Home: "mesh-controller", HomeRef: "f3c15e00af5004d053bc424fe01c7f9a24656d59"},
// A plan's id was pasted into its query (2026-10-12): an id given to the plans verb holding a quote answered
// another plan, or failed as a syntax error. The fix's own test is a file of its own using only what the
// inventory had before (ForTest, SavePlan, PlanByID, RecentPlans), so it is laid over the commit before. Needs a
// store: MESH_TEST_POSTGRES. Fix is the merge of its pull request (mesh-controller #268).
{ID: "R561", Issue: 561, Kind: InRepository, Repository: "mesh-controller", Fix: "f8daec01d3f085ad30aa7fb584055d8d451c79dc",
What: "a plan's id was pasted into the SQL that reads it: an id holding a quote answered another plan, or " +
"failed as a syntax error",
Asserts: "an id holding a quote is read as a plain id: no plan answers it but one of that very id, and " +
"RecentPlans takes its limit as a parameter",
Package: "./internal/inventory", Test: "TestAPlanIdHoldingAQuoteIsReadAsAPlainId",
Files: []string{"internal/inventory/plan_id_test.go"}},
// A plan sent the control node a controller older than the one running there (2026-10-02): two merges a minute
// apart made two plans; the controller's plan rolled the newer controller, which widened its seat's row, and the
// node-engine's plan then sent the build before it, whose binary refused the row. The fix's own TestReplay201
// reads what the fix added, so the replay is a test of its own in the controller, written with only what it had
// before — the inventory's build, gate, assignment and send records, keepingRecorded, planFor, declarationFor —
// laid over the commit before. Needs a store: MESH_TEST_POSTGRES. Fix is the merge of its pull request
// (mesh-controller #273); Home is the commit that added the replay (mesh-controller #275), reachable once that
// pull request merges.
{ID: "R201", Issue: 201, Kind: InRepository, Repository: "mesh-controller", Fix: "84deb530ee5afe2ffdf4d2cc65cdc355b12f8ccb",
What: "a plan sent the control node a controller older than the one running there, whose seat row the newer " +
"one had widened: the older binary refused the row and the mesh went quiet",
Asserts: "a send that is no person's push carries the controller at the build its machine was last sent, not " +
"an older record; a person's push carries the record",
Package: "./cmd/mesh-controller", Test: "TestReplay201ThePlansSend",
Files: []string{"cmd/mesh-controller/replay201_test.go"},
Home: "mesh-controller", HomeRef: "45a1783ba9a43fd466a518ee85673c701223b517"},
// A requirement could not be optional (issue 166): every soft dependency had become a hard requirement, so a
// manifest could not say grafana runs without a data source — a mesh without influxdb could not register it,
// and with influxdb only in the catalogue, assigning grafana installed influxdb for it. A test of its own in
// the controller, written with only what it had before — ParseManifest, Resolve, the resolve tests' helpers —
// laid over the commit before. Fix is the merge of its pull request (mesh-controller #281); Home is the commit
// that added the replay (mesh-controller #287), reachable once that pull request merges.
{ID: "R166", Issue: 166, Kind: InRepository, Repository: "mesh-controller", Fix: "4473bc7d7315bb462dcce7d6a8927bff37ecdc59",
What: "a manifest could not say a requirement is optional: grafana, which runs without a data source, could " +
"not be assigned on a mesh without influxdb, and influxdb only in the catalogue was installed for it",
Asserts: "a requirement marked optional parses; with no provider running, assigning its consumer is not refused " +
"and installs nothing for it; with a provider running elsewhere it binds",
Package: "./internal/catalogue", Test: "TestReplay166", Files: []string{"internal/catalogue/replay166_test.go"},
Home: "mesh-controller", HomeRef: "b1baa8d8baf0289b76e8082b3b95d146af6a973e"},
// A folder could not be owned by the account its module runs as (2026-10-06): the media managers' recycle-bin
// folders were declared owned by a literal user and group, and on a machine whose puid and pgid named another
// account the apps refused them as not writable. The fix's own tests read what the fix added, so the replay is
// a test of its own in the controller, written with only what it had before — Compose, a setting layer, the
// adoption tests' anchor — laid over the commit before. Fix is the merge of its pull request (mesh-controller
// #260); Home is the commit that added the replay, reachable once its pull request merges.
{ID: "R279", Issue: 279, Kind: InRepository, Repository: "mesh-controller", Fix: "9eddf36503f2a9af7ac22f6dffd4ab4462592b27",
What: "the TV and film managers refused their recycle-bin folders as not writable: a declared directory's owner " +
"was literal, and could not follow the puid and pgid the module runs as on that machine",
Asserts: "a directory owned by ${setting:puid}:${setting:pgid} reaches the node-engine owned by the numbers the " +
"machine's settings give",
Package: "./internal/catalogue", Test: "TestReplay279", Files: []string{"internal/catalogue/replay279_test.go"},
Home: "mesh-controller", HomeRef: "3bdab29a5a0ed0f15cbfdb4738a321f968ac9467"},
// A seat did not name the paths its holder owns (2026-10-10): who owns /etc/hosts was enforced only when two
// modules on one machine declared it, so a module not claiming node-hostname could declare it, and a holder of
// node-hostname could declare none of its paths. A test of its own in the controller, written with only what it
// had before — CatalogueProblems, SeatNamed, CanHold — laid over the commit before. Fix is the merge of its pull
// request (mesh-controller #267); Home as R279.
{ID: "R412", Issue: 412, Kind: InRepository, Repository: "mesh-controller", Fix: "4dbd4066ca54681bd92169502379ec42ff7599b6",
What: "a module not claiming node-hostname could declare /etc/hosts, and a module could claim node-hostname " +
"declaring neither /etc/hosts nor /etc/hostname: nothing refused either",
Asserts: "a module declaring a seat's path without claiming the seat is refused naming the seat, and a claim " +
"whose module does not declare the seat's paths is refused naming each",
Package: "./internal/catalogue", Test: "TestReplay412", Files: []string{"internal/catalogue/replay412_test.go"},
Home: "mesh-controller", HomeRef: "3bdab29a5a0ed0f15cbfdb4738a321f968ac9467"},
}
// Find is the replay of that id, or of that issue.
+9
View File
@@ -2,6 +2,7 @@ package replays
import (
"regexp"
"slices"
"testing"
)
@@ -29,6 +30,14 @@ func TestEveryReplayIsWhole(t *testing.T) {
if len(r.Files) == 0 || len(r.With) == 0 {
t.Errorf("%s runs two repositories and lays the controller's half over its commit: %+v", r.ID, r)
}
case Bed:
if !regexp.MustCompile(`^test/integration/[a-z0-9-]+\.test\.ts$`).MatchString(r.Test) {
t.Errorf("%s is a bed and names no bed of the lab to raise: %q", r.ID, r.Test)
}
if !slices.ContainsFunc(r.With, func(a Also) bool { return a.Repository == "mesh-controller" }) ||
!slices.ContainsFunc(r.With, func(a Also) bool { return a.Repository == "mesh-catalog" }) {
t.Errorf("%s is a bed and does not pin the controller and the catalogue it raises: %+v", r.ID, r)
}
case Bus, Resolver:
default:
t.Errorf("%s is of no kind the prover runs: %q", r.ID, r.Kind)
+41
View File
@@ -0,0 +1,41 @@
# GENESIS PAST ITS BROKER STEP: the bed of novox/hq ADR 0333 §5 (issue 590).
#
# The installer raises the bus from its bundle, then adopts it as the `nats` module at its broker step (step
# 18 of 24). Before ADR 0333 the bundle raised the bus under another name and on other paths than the module
# keeps it, so adopting it would have raised a second bus beside the first, and genesis stopped there. The
# bed runs the installer from bare to that step, looks at the bus, runs it on past the step, and looks again.
#
# Two machines on one public segment, both with a way out — the installer pulls the store, the bus and the
# toolchains over it, as a bare machine does:
# - anchor: the machine genesis raises;
# - forge: serves the control plane's, the base's, the SDK's and the catalogue's repositories at the
# commits under test over git's own protocol, so the installer builds exactly those and nothing on the
# workstation listens for the lab. On the anchor itself it would be a listener, and genesis refuses a
# machine something already listens on.
scenario: genesis-keeps-its-bus
segments:
hosting:
kind: public
cidr: [192.0.2.0/24]
machines:
anchor:
at: { segment: hosting, address: [192.0.2.10] }
egress: true
inbound: allow
# The foundation, the registry, the forge genesis raises, the base and the modules it builds.
memory: 8GiB
cpus: 4
disk: 60GiB
forge:
at: { segment: hosting, address: [192.0.2.30] }
egress: true
inbound: allow
memory: 1GiB
cpus: 1
disk: 10GiB
place:
all: [host, runtime]
+42
View File
@@ -0,0 +1,42 @@
# GENESIS on a runtime nobody told to trust a registry: the bed of replay R92 (novox/hq issue 92).
#
# The first real genesis pushed the control plane's image to the registry it had just raised, and the
# container runtime refused: "server gave HTTP response to HTTPS client". The mesh's registry speaks plain
# HTTP on purpose, and the trust that lets a runtime speak to it was written six steps after the push. The
# lab never saw it, because its base image trusts the documentation ranges as plain-HTTP registries before
# any bed starts (src/lifecycle/base.ts). The bed takes that trust back off the anchor before genesis runs,
# so the anchor's runtime is a bare machine's: it trusts loopback and nothing else.
#
# Two machines on one public segment, both with a way out — the installer pulls the store, the bus and the
# registry over it, as a bare machine does:
# - anchor: the machine genesis raises, given its registry at its own address, 192.0.2.10:5000;
# - forge: serves the control plane's repository at the commit under test over git's own protocol, so the
# installer builds exactly that and nothing on the workstation listens for the lab. On the anchor
# itself it would be a listener, and genesis refuses a machine something already listens on.
scenario: genesis-untrusted
segments:
hosting:
kind: public
cidr: [192.0.2.0/24]
machines:
anchor:
at: { segment: hosting, address: [192.0.2.10] }
egress: true
inbound: allow
# Genesis-single's anchor: the foundation, the registry, and two control planes during the pivot.
memory: 8GiB
cpus: 4
disk: 40GiB
forge:
at: { segment: hosting, address: [192.0.2.30] }
egress: true
inbound: allow
memory: 2GiB
cpus: 2
disk: 15GiB
place:
all: [host, runtime]
+76
View File
@@ -0,0 +1,76 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { busNotKept, runningFrom, streamsFrom, written, type Seen } from "./integration/bus-kept.ts";
/**
* The judgement of the bed that raises genesis past its broker step (novox/hq ADR 0333 §5, issue 590):
* exactly one bus container, it is mesh-broker-nats, a stream written before the step is still there, and
* the first node is still connected. Held here without a lab, so the bed's verdict is the judgement's and
* not whatever a bed happened to compare.
*/
const UPSTREAM = "nats@sha256:" + "b".repeat(64);
const MODULES = "192.0.2.10:5000/nats@sha256:" + "c".repeat(64);
const PORTS = "127.0.0.1:8222->8222/tcp, 0.0.0.0:5671->4222/tcp";
function jsz(streams: Array<[string, string, number, number]>): string {
return JSON.stringify({ account_details: [{ name: "MESH", stream_detail: streams.map(([name, created, messages, last]) =>
({ name, created, state: { messages, last_seq: last } })) }] });
}
const before: Seen = {
running: runningFrom(`mesh-store\tpostgres@sha256:aa\t0.0.0.0:5432->5432/tcp\nmesh-broker-nats\t${UPSTREAM}\t${PORTS}\n` +
"mesh-controller\t192.0.2.10:5000/mesh-controller@sha256:dd\t\n"),
streams: streamsFrom(jsz([["KV_mesh-controller_lease", "2026-10-13T00:10:00Z", 3, 7], ["EMPTY", "2026-10-13T00:10:01Z", 0, 0]])),
};
const kept: Seen = {
running: runningFrom(`mesh-store\tpostgres@sha256:aa\t0.0.0.0:5432->5432/tcp\nmesh-broker-nats\t${MODULES}\t${PORTS}\n` +
"mesh-controller\t192.0.2.10:5000/mesh-controller@sha256:dd\t\n"),
streams: streamsFrom(jsz([["KV_mesh-controller_lease", "2026-10-13T00:10:00Z", 3, 9]])),
};
const SAID = "broker — the foundation's bus, adopted as the nats module\n restarting mesh-broker-nats — once, onto the nats module's image";
const HERE = "anchor here last 3s ago";
test("a bus adopted in place is kept: one bus, the module's image, its streams, the node connected", () => {
assert.deepEqual(busNotKept(before, kept, HERE, SAID), []);
});
test("only a stream holding something counts as written before the step", () => {
assert.deepEqual(written(before).map((s) => s.name), ["KV_mesh-controller_lease"]);
});
test("a second bus beside the first is not kept: the fault genesis had before ADR 0333", () => {
const two: Seen = { ...kept, running: [...kept.running,
{ name: "mesh-broker", image: UPSTREAM, ports: "0.0.0.0:5671->4222/tcp" }] };
const wrong = busNotKept(before, two, HERE, SAID);
assert.equal(wrong.length, 1);
assert.match(wrong[0] as string, /2 bus containers.*mesh-broker \(/);
});
test("a bus under another name, or none, is not kept", () => {
const renamed: Seen = { ...kept, running: kept.running.map((r) => r.name === "mesh-broker-nats" ? { ...r, name: "nats-server" } : r) };
assert.ok(busNotKept(before, renamed, HERE, SAID).some((w) => /mesh-broker-nats does not run/.test(w)));
const none: Seen = { ...kept, running: kept.running.filter((r) => r.name !== "mesh-broker-nats") };
assert.ok(busNotKept(before, none, HERE, SAID).some((w) => /0 bus containers/.test(w)));
});
test("a bus still on the bundle's image was not adopted", () => {
const same: Seen = { ...kept, running: before.running };
assert.ok(busNotKept(before, same, HERE, SAID).some((w) => /still runs .* the image the bundle raised/.test(w)));
assert.ok(busNotKept(before, kept, HERE, "broker — adopted").some((w) => /did not say the bus restarts/.test(w)));
});
test("a stream gone or made again is not kept", () => {
const gone: Seen = { ...kept, streams: [] };
assert.ok(busNotKept(before, gone, HERE, SAID).some((w) => /KV_mesh-controller_lease .* is gone/.test(w)));
const again: Seen = { ...kept, streams: streamsFrom(jsz([["KV_mesh-controller_lease", "2026-10-13T00:40:00Z", 1, 1]])) };
assert.ok(busNotKept(before, again, HERE, SAID).some((w) => /was made again/.test(w)));
});
test("a node the mesh has not heard from since the step is not connected", () => {
assert.ok(busNotKept(before, kept, "anchor out of touch 4m", SAID).some((w) => /has not heard from the first node/.test(w)));
assert.ok(busNotKept(before, kept, "", SAID).some((w) => /no record/.test(w)));
});
@@ -16,7 +16,7 @@
*
* MESH_LAB_INCUS='sudo -n incus'
* MESH_LAB_HOST_BINARY=.../mesh-host/mesh-host
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=.../mesh-catalog/modules
*/
import { test, before, after } from "node:test";
+1 -1
View File
@@ -34,7 +34,7 @@
*
* MESH_LAB_INCUS='sudo -n incus'
* MESH_LAB_HOST_BINARY=<mesh-host>/mesh-host MESH_LAB_BOOTSTRAP_BINARY=<mesh-host>/mesh-bootstrap
* MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=<mesh-catalog>/modules MESH_LAB_MODULES=<mesh-controller>/examples/modules
* MESH_TOOLS=<mesh-tools> MESH_SDK=<mesh-sdk> (default: the checkouts beside this one)
* MESH_LAB_KEEP=1 leave it standing MESH_LAB_WARM=1 iterate from the adopted foundation
+1 -1
View File
@@ -36,7 +36,7 @@
* in for the authenticated cross-node call a manager node would make). The node-private-key stub of
* the earlier cut is GONE — the host uses its own real key.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* Build both runtime images into the local daemon first:
* scripts/build-module-runtime.sh anthropic-manager /tmp/anthropic-manager.tar
* scripts/build-module-runtime.sh anthropic-consumer /tmp/anthropic-consumer.tar
+1 -1
View File
@@ -10,7 +10,7 @@
* It needs the host binary, the foundation bundle, and the runtime image the scenario loads:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-runtime-image.sh builds mesh-runtime-audit:development into the local daemon,
* which scenarios/audit-node.yml stocks — so no MESH_LAB_RUNTIME here; the host pulls it.
*/
+1 -1
View File
@@ -13,7 +13,7 @@
* would say nothing at all about removal — which is the half issue 129 asked for by name.
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* MESH_LAB_CATALOG=.../mesh-catalog/modules
* step-ca's image is upstream, pinned by the catalogue, pulled by the machine over its uplink.
* ca-trust carries no image: a script, a unit, and the machine's own systemd.
@@ -17,7 +17,7 @@
*
* All are assigned to the one anchor, pushed ONCE, and the node converges ONCE with every one up.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh {mongodb,unifi,postgres} build the runtime images into the local
* daemon; scenarios/catalogue-apps.yml stocks them. mongo:7, lscr.io/linuxserver/unifi-controller
* and synesthesiam/marytts must be in the local daemon to be stocked.
@@ -23,7 +23,7 @@
*
* All is assigned to the one anchor, pushed ONCE, and the node converges ONCE with both modules up.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh {sonarr,radarr} build the runtime images into the local daemon;
* scenarios/catalogue-media.yml stocks them. lscr.io/linuxserver/{sonarr,radarr} must be in the
* local daemon; the service images are pulled from the internet. Each *arr runtime is given a lab
@@ -22,7 +22,7 @@
* the seed), and mosquitto's provisioner — running in the assigned runtime — creates a scoped client
* for a contribution the mesh delivered, which then authenticates with the password the mesh minted.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh mosquitto builds mesh-runtime-mosquitto:development (carrying
* mosquitto_ctrl and the compiled bootstrap entrypoint) into the local daemon, which
* scenarios/catalogue-mqtt.yml stocks. eclipse-mosquitto:2 must be in the local daemon to be
@@ -18,7 +18,7 @@
* path is fulfilled by creating the consumer's login with the mesh-minted password — it seals nothing
* and needs no seal key (novox/hq ADR 0048, issue 032-provider-runtime-has-no-seal-key).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh {postgres,redis,minio,plex} build the four runtime images into the
* local daemon; scenarios/catalogue-small.yml stocks them. postgres:17-alpine, redis:7-alpine and
* minio/minio:latest is pulled from the internet by the node itself.
@@ -22,7 +22,7 @@
* It needs a host binary and the foundation bundle:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*
* HELPER — stock the two runtimes into the local daemon before the run (some may already be there):
* scripts/build-module-runtime.sh postgres /tmp/postgres.tar
@@ -25,7 +25,7 @@
* registry by digest; the host pulls and runs it on the cadence.
*
* MESH_LAB_HOST_BINARY=.../mesh-host (feat/apply-schedule — the scheduler that fires the step)
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* MESH_LAB_MODULES=.../mesh-controller/examples/modules (feat/schedule-container — the parser that
* carries `schedule` through). scenarios/schedule-tick.yml stocks alpine:latest (which must be in
* the local daemon) and serves it by digest; there is no runtime image — schedtest is a bare tick.
@@ -17,7 +17,7 @@
* A tool would only fail if it were actually invoked without real creds — which this bed does not do,
* because the point is exactly that serving does not require them.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh confluence builds mesh-runtime-confluence:development into the
* local daemon; scenarios/tools-confluence.yml stocks it. There is no service image.
*/
@@ -16,7 +16,7 @@
* A tool would only fail if it were actually invoked without real creds — which this bed does not do,
* because the point is exactly that serving does not require them.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh gitlab builds mesh-runtime-gitlab:development into the local
* daemon; scenarios/tools-gitlab.yml stocks it. There is no service image — gitlab is tools-only.
*/
@@ -22,7 +22,7 @@
* It needs a host binary and the foundation bundle:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*
* HELPER — stock the three runtimes into the local daemon before the run (some may already be there):
* scripts/build-module-runtime.sh postgres /tmp/postgres.tar
+1 -1
View File
@@ -22,7 +22,7 @@
* The manifests are the catalogue's own (../mesh-catalog/modules/{mesh-vault,redis}/module.json), with
* the runtime artifact named as the image the lab built, exactly as the other assigned-* beds do.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh mesh-vault / redis build the two runtime images into the local
* daemon; scenarios/vault-node.yml stocks them.
*/
@@ -19,7 +19,7 @@
* by the firewall the nftables module derives (issues 055/056/057 in one bed).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BOOTSTRAP_BINARY=.../mesh-bootstrap
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock (the TEMPLATE)
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock (the TEMPLATE)
* MESH_LAB_CATALOG=.../mesh-catalog/modules
* MESH_LAB_SOURCE=git://<forge>/mesh-controller.git MESH_LAB_SOURCE_REF=<commit>
* MESH_LAB_BUILD_REF=<branch or commit for module builds, default main>
+112
View File
@@ -0,0 +1,112 @@
/**
* Whether genesis kept its bus through the broker step (novox/hq ADR 0333 §5, issue 590).
*
* Pure, so the judgement is tested without a lab (test/bus-kept.test.ts) and the bed only gathers what it
* judges: the containers the anchor runs, the streams its bus holds, and what the mesh says of the node,
* once before the broker step and once after it.
*/
/** One running container, as `docker ps --format '{{.Names}}\t{{.Image}}\t{{.Ports}}'` says it. */
export interface Running {
name: string;
image: string;
ports: string;
}
/** One stream on the bus, as the server's monitor says it (`/jsz?accounts=true&streams=true`). */
export interface Stream {
account: string;
name: string;
created: string;
messages: number;
lastSeq: number;
}
/** What the anchor showed at one moment. */
export interface Seen {
running: Running[];
streams: Stream[];
}
/** The container the bundle raises the bus as, and the nats module keeps it as (ADR 0333 §1). */
export const BUS = "mesh-broker-nats";
/** `docker ps --format '{{.Names}}\t{{.Image}}\t{{.Ports}}'`, read. */
export function runningFrom(ps: string): Running[] {
return ps.split("\n").map((l) => l.trim()).filter(Boolean).map((l) => {
const [name = "", image = "", ports = ""] = l.split("\t");
return { name, image, ports };
});
}
/** The server's `/jsz?accounts=true&streams=true`, read: every stream of every account. */
export function streamsFrom(jsz: string): Stream[] {
const parsed = JSON.parse(jsz) as {
account_details?: Array<{
name?: string;
stream_detail?: Array<{ name?: string; created?: string; state?: { messages?: number; last_seq?: number } }>;
}>;
};
const out: Stream[] = [];
for (const account of parsed.account_details ?? []) {
for (const s of account.stream_detail ?? []) {
out.push({
account: account.name ?? "", name: s.name ?? "", created: s.created ?? "",
messages: s.state?.messages ?? 0, lastSeq: s.state?.last_seq ?? 0,
});
}
}
return out;
}
/**
* A bus container: one that serves the bus's port inside it, or carries a bus's name. Both, because a
* second bus raised by a module under another name is exactly what this looks for, and so is one raised on
* another port under the bus's name.
*/
export function busContainers(running: Running[]): Running[] {
return running.filter((r) => /->4222\/tcp/.test(r.ports) || r.name.startsWith("mesh-broker"));
}
/** The streams written before the step: the ones holding anything. */
export function written(seen: Seen): Stream[] {
return seen.streams.filter((s) => s.messages > 0 || s.lastSeq > 0);
}
/**
* Every way the bus was not kept, in sentences; empty when it was. `node` is the mesh's line for the first
* node from `node list`; `said` is what the installer printed on the run that crossed the step.
*/
export function busNotKept(before: Seen, after: Seen, node: string, said: string): string[] {
const wrong: string[] = [];
const buses = busContainers(after.running);
if (buses.length !== 1) {
wrong.push(`${buses.length} bus containers run after the broker step, not one: ` +
(buses.map((b) => `${b.name} (${b.image}, ${b.ports || "nothing published"})`).join("; ") || "none"));
}
const bus = after.running.find((r) => r.name === BUS);
if (!bus) {
wrong.push(`${BUS} does not run after the broker step`);
}
const was = before.running.find((r) => r.name === BUS);
if (bus && was && bus.image === was.image) {
wrong.push(`${BUS} still runs ${bus.image}, the image the bundle raised it from: the module's image never ` +
`took its place (ADR 0333 §3)`);
}
if (!/restarting\s+mesh-broker-nats/.test(said)) {
wrong.push("the installer did not say the bus restarts onto the module's image (ADR 0333 §3)");
}
for (const s of written(before)) {
const now = after.streams.find((a) => a.account === s.account && a.name === s.name);
if (!now) {
wrong.push(`the stream ${s.name} (${s.account}), holding ${s.messages} message(s) before the step, is gone`);
} else if (now.created !== s.created || now.lastSeq < s.lastSeq) {
wrong.push(`the stream ${s.name} (${s.account}) was made again: created ${s.created}, last ${s.lastSeq} ` +
`before the step; created ${now.created}, last ${now.lastSeq} after it`);
}
}
if (!/^\S+\s+here\b/.test(node.trim())) {
wrong.push(`the mesh has not heard from the first node since the step: ${node.trim() || "it has no record of it"}`);
}
return wrong;
}
+1 -1
View File
@@ -17,7 +17,7 @@
* It needs the host binary and the foundation bundle, like the mesh walk, plus a runtime image:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* MESH_LAB_RUNTIME=.../mesh-runtime-audit.tar (docker save of the runtime+audit-logger image;
* built by scripts/build-runtime-image.sh)
*
+1 -1
View File
@@ -31,7 +31,7 @@
* MESH_LAB_INCUS='sudo -n incus'
* MESH_LAB_HOST_BINARY=.../mesh-host/mesh-host
* MESH_LAB_BOOTSTRAP_BINARY=.../mesh-host/mesh-bootstrap
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=.../mesh-catalog/modules
* MESH_LAB_SOURCE=<forge>/mesh-controller.git MESH_LAB_SOURCE_REF=<commit>
* MESH_LAB_KEEP=1 to leave it standing afterwards
@@ -0,0 +1,269 @@
/**
* GENESIS KEEPS ITS BUS through the broker step (novox/hq ADR 0333 §5, issue 590).
*
* The installer raises the bus from its bundle and, at its broker step (step 18 of 24), adopts it as the
* catalogue's `nats` module. Until ADR 0333 the bundle raised the bus as `mesh-broker` on docker volumes,
* and the module keeps it as `mesh-broker-nats` on directories of the machine: adopting it would have raised
* a second bus beside the first, so the installer refused there and genesis stopped. ADR 0333 has the bundle
* raise the bus where the module keeps it, so the adoption replaces the server's image once and keeps
* everything else.
*
* The bed runs the installer from bare twice. The first run is given a catalogue without the `nats` module,
* so it stops at the broker step by name, before anything is registered — the moment just before the step,
* with everything genesis wrote on the bus by then. The bed reads the bus there: its containers, and every
* stream holding anything. The second run, given the whole catalogue, finds the steps before done and goes
* on through the broker step. The bed reads the bus again, and passes only when (ADR 0333 §5):
*
* - exactly one bus container runs, and it is mesh-broker-nats, on the module's image now;
* - every stream that held something before the step is still there, the same stream, as long or longer;
* - the mesh has heard from the first node since.
*
* The judgement is test/integration/bus-kept.ts, held without a lab by test/bus-kept.test.ts.
*
* **A bed that could not reach the step says so and does not fail**: a first run that stopped earlier than
* the broker step — a pull the internet refused, a build that broke — proves nothing about the step, and the
* test is skipped with the reason. A second run that stops AT the broker step is the fault, and fails. One
* that stops after it has crossed it: what it stopped on is reported, and the bus is judged.
*
* MESH_LAB_HOST_BINARY=<mesh-host>/mesh-host MESH_LAB_BOOTSTRAP_BINARY=<mesh-host>/mesh-bootstrap
* MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=<mesh-catalog>/modules
* MESH_LAB_REPOS=<a directory holding mesh-controller, mesh-tools, mesh-sdk and mesh-catalog checkouts>
* — served by the forge machine at each checkout's HEAD; the catalogue's is the one built from
* MESH_LAB_KEEP=1 leave it standing
*/
import { test, before, after } from "node:test";
import assert from "node:assert/strict";
import { cpSync, existsSync, mkdtempSync, rmSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { loadScenario } from "../../src/declaration/parse.ts";
import { raise } from "../../src/lifecycle/raise.ts";
import { destroy, exec, push } from "../../src/lifecycle/operate.ts";
import { bootstrapBinaryPath, hostBinaryPath } from "../../src/lifecycle/place.ts";
import { labIsUsable, destroyAll, foundationBundle } from "./harness.ts";
import { genesis, type GenesisResult } from "./genesis.ts";
import { BUS, busContainers, busNotKept, runningFrom, streamsFrom, written, type Seen } from "./bus-kept.ts";
const SCENARIO = "genesis-keeps-its-bus";
const ANCHOR = "anchor";
const FORGE = "forge";
const FORGE_ADDRESS = "192.0.2.30";
const REGISTRY = "192.0.2.10:5000";
/** The repositories the installer clones, served by the forge at each checkout's HEAD. */
const REPOS = ["mesh-controller", "mesh-tools", "mesh-sdk", "mesh-catalog"] as const;
/** The step this bed is about, as the installer names it. */
const BROKER = "broker";
/** The installer's steps before it, in its order: a first run stopped at one of these never reached it. */
const BEFORE_BROKER = ["preflight", "load", "build", "bundle", "apply", "verify", "enrol", "operator", "registry",
"publish", "control-plane", "retire", "builder", "packages", "sdk", "base", "store"];
const capability = await labIsUsable();
const binary = hostBinaryPath();
const installer = bootstrapBinaryPath();
const bundle = process.env["MESH_LAB_BUNDLE"] ?? "";
const catalogDir = process.env["MESH_LAB_CATALOG"] ?? "";
const repos = process.env["MESH_LAB_REPOS"] ?? "";
const KEEP = !!process.env["MESH_LAB_KEEP"];
const FIXED_ID = process.env["MESH_LAB_INSTANCE_ID"] ?? (KEEP ? "genesis-keeps-its-bus-live" : undefined);
const missingRepo = REPOS.find((r) => !repos || !existsSync(resolve(repos, r, ".git")));
const skip =
!capability.usable ? capability.why :
!binary ? "MESH_LAB_HOST_BINARY is not set to a built mesh-host" :
!installer ? "MESH_LAB_BOOTSTRAP_BINARY is not set to a built mesh-bootstrap" :
!bundle || !existsSync(bundle) ? "MESH_LAB_BUNDLE is not set to the genesis bundle" :
!catalogDir || !existsSync(join(catalogDir, "nats", "module.json")) ? "MESH_LAB_CATALOG is not set to mesh-catalog/modules" :
missingRepo ? `MESH_LAB_REPOS holds no ${missingRepo} checkout` :
false;
let instanceId = "";
/** Why the bed never reached the step, or "" when it did. */
let unreached = "";
let first: GenesisResult | undefined;
let second: GenesisResult | undefined;
let seenBefore: Seen | undefined;
let seenAfter: Seen | undefined;
let nodeLine = "";
const heads: Record<string, string> = {};
const report: string[] = [];
async function on(machine: string, command: string, timeoutMs?: number): Promise<{ out: string; ok: boolean }> {
const { stdout } = await exec(instanceId, machine, ["sh", "-c", `exec 2>&1\n${command}\necho "__exit=$?"`], timeoutMs);
const marker = stdout.lastIndexOf("__exit=");
if (marker < 0) return { out: stdout, ok: false };
return { out: stdout.slice(0, marker), ok: stdout.slice(marker + 7).trim() === "0" };
}
async function must(machine: string, command: string, timeoutMs?: number): Promise<string> {
const { out, ok } = await on(machine, command, timeoutMs);
if (!ok) throw new Error(`${machine}: ${command}\n${out}`);
return out;
}
/** Each repository at its checkout's HEAD, served from the forge machine over git's protocol as `main`. */
async function raiseForge(): Promise<void> {
const dir = mkdtempSync(join(tmpdir(), "mesh-lab-590-forge-"));
try {
for (const repo of REPOS) {
const checkout = resolve(repos, repo);
heads[repo] = execFileSync("git", ["-C", checkout, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
const bare = join(dir, `${repo}.git`);
execFileSync("git", ["init", "-q", "--bare", bare]);
// No collection after the push: one run in the background rewrites the objects while they are carried.
execFileSync("git", ["-C", bare, "config", "receive.autogc", "false"]);
execFileSync("git", ["-C", checkout, "push", "-q", "--force", bare, "HEAD:refs/heads/main"], { stdio: "pipe" });
}
const tar = join(tmpdir(), `mesh-lab-590-forge-${process.pid}.tar`);
execFileSync("tar", ["-cf", tar, "-C", dir, "."]);
await push(instanceId, FORGE, tar, "/tmp/forge.tar");
rmSync(tar, { force: true });
} finally {
rmSync(dir, { recursive: true, force: true });
}
// Owned by the daemon's user, or git refuses to serve it ("dubious ownership") and says nothing.
await must(FORGE, `mkdir -p /srv/git && tar --no-same-owner -xf /tmp/forge.tar -C /srv/git && chown -R root:root /srv/git && ` +
`git daemon --base-path=/srv/git --export-all --reuseaddr --detach --listen=${FORGE_ADDRESS} --pid-file=/run/git-daemon.pid`);
for (let i = 0; ; i++) {
if ((await on(ANCHOR, `git ls-remote git://${FORGE_ADDRESS}/mesh-catalog.git main`)).ok) break;
if (i >= 30) throw new Error(`the anchor cannot reach the forge at git://${FORGE_ADDRESS}/`);
await new Promise((r) => setTimeout(r, 2_000));
}
}
/** What the anchor shows of its bus: the containers it runs, and every stream the bus holds. */
async function look(): Promise<Seen> {
const ps = await must(ANCHOR, `docker ps --format '{{.Names}}\t{{.Image}}\t{{.Ports}}'`);
// The monitor, published on the anchor's loopback by the bundle and by the module alike.
let jsz = "";
for (let i = 0; ; i++) {
const asked = await on(ANCHOR, `curl -sf --max-time 10 'http://127.0.0.1:8222/jsz?accounts=true&streams=true'`);
if (asked.ok) { jsz = asked.out; break; }
if (i >= 30) throw new Error(`the bus's monitor does not answer on the anchor: ${asked.out}`);
await new Promise((r) => setTimeout(r, 2_000));
}
return { running: runningFrom(ps), streams: streamsFrom(jsz) };
}
function stoppedAt(r: GenesisResult): string {
return r.step.replace(/^step \d+ of \d+, /, "");
}
before(async () => {
if (skip) return;
const raised = await raise(loadScenario(`scenarios/${SCENARIO}.yml`), {
onProgress: (m) => console.log(`raise: ${m}`),
...(FIXED_ID ? { instanceId: FIXED_ID } : {}),
});
instanceId = raised.instanceId;
console.log(`INSTANCE ${instanceId}${KEEP ? " (KEEP — will be left standing)" : ""}`);
try {
await raiseForge();
report.push(` forge ${REPOS.map((r) => `${r} ${heads[r]?.slice(0, 8)}`).join(", ")}`);
} catch (err) {
unreached = `the forge was not raised, so the installer never ran: ${(err as Error).message}`;
return;
}
const forge = (repo: string) => `git://${FORGE_ADDRESS}/${repo}.git`;
const run = (catalogue: string) => genesis({
instanceId,
node: ANCHOR,
installer: installer as string,
catalogDir: catalogue,
catalogueModules: ["distribution", "build-agent", "postgres"],
bundleTemplate: foundationBundle(bundle, []),
registry: REGISTRY,
source: forge("mesh-controller"),
sourceRef: heads["mesh-controller"] as string,
toolsSource: forge("mesh-tools"),
sdkSource: forge("mesh-sdk"),
catalogSource: forge("mesh-catalog"),
// A refusal is the answer, and a re-run is the second half of this bed, not a retry.
attempts: 1,
verify: false,
log: (m) => console.log(m),
});
// 1. From bare to the broker step, and no further: the catalogue the installer reads has no nats module.
const withoutTheBus = mkdtempSync(join(tmpdir(), "mesh-lab-590-catalogue-"));
try {
const nats = join(catalogDir, "nats");
cpSync(catalogDir, withoutTheBus, { recursive: true, filter: (src) => src !== nats && !src.startsWith(nats + "/") });
first = await run(withoutTheBus);
} catch (err) {
unreached = `the installer could not be run: ${(err as Error).message}`;
return;
} finally {
rmSync(withoutTheBus, { recursive: true, force: true });
}
report.push(...first.report);
if (first.ok || stoppedAt(first) !== BROKER) {
unreached = first.ok
? "the first run finished without the nats module, so the broker step never stopped it"
: `the first run stopped at ${first.step || "no step it named"}, before the broker step:\n${first.why}`;
return;
}
if (!/nats module's manifest could not be read/.test(first.said)) {
unreached = `the first run stopped at the broker step for another reason than the missing module:\n${first.why}`;
return;
}
seenBefore = await look();
report.push(` before the step ${busContainers(seenBefore.running).map((b) => `${b.name} on ${b.image}`).join("; ")}`);
report.push(` ${written(seenBefore).length} stream(s) holding something: ` +
written(seenBefore).map((s) => `${s.name} (last ${s.lastSeq})`).join(", "));
if (written(seenBefore).length === 0) {
unreached = "nothing was written on the bus before the broker step, so whether its streams survive it says nothing";
return;
}
// 2. The whole catalogue: the steps before are done already, and the broker step adopts the bus.
try {
second = await run(catalogDir);
} catch (err) {
unreached = `the installer could not be run again: ${(err as Error).message}`;
return;
}
report.push(...second.report);
if (!second.ok && BEFORE_BROKER.includes(stoppedAt(second))) {
unreached = `the second run stopped at ${second.step}, before the broker step it was run again for:\n${second.why}`;
return;
}
seenAfter = await look();
report.push(` after the step ${busContainers(seenAfter.running).map((b) => `${b.name} on ${b.image}`).join("; ") || "no bus"}`);
const nodes = await on(ANCHOR, `docker exec mesh-controller /mesh-controller node list`, 60_000);
nodeLine = nodes.out.split("\n").map((l) => l.trim()).find((l) => l.startsWith(`${ANCHOR} `)) ?? "";
report.push(` node list ${nodeLine || nodes.out.trim()}`);
}, { timeout: 7_200_000 });
after(async () => {
if (KEEP) {
console.log(`\nLEFT STANDING: ${instanceId} — not destroyed (MESH_LAB_KEEP).`);
return;
}
if (instanceId) await destroy(instanceId);
await destroyAll(`${SCENARIO}-`);
}, { timeout: 900_000 });
test("genesis adopts its bus as the nats module in place: one bus, its streams kept, the node connected", {
skip, timeout: 7_200_000,
}, async (t) => {
console.log(report.join("\n"));
if (unreached) {
t.skip(`ADR 0333 §5 NOT REACHED: ${unreached}`);
return;
}
const ran = second as GenesisResult;
// Stopped AT the broker step: the adoption itself refused or failed — the fault, not a missed bed.
assert.ok(ran.ok || stoppedAt(ran) !== BROKER,
`genesis stopped at its broker step and did not adopt the bus:\n${ran.why}`);
if (!ran.ok) {
console.log(`\nthe second run crossed the broker step and stopped later, at ${ran.step} — not this bed's ` +
`question:\n${ran.why}`);
}
const wrong = busNotKept(seenBefore as Seen, seenAfter as Seen, nodeLine, ran.said);
assert.deepEqual(wrong, [], `genesis did not keep its bus through the broker step:\n - ${wrong.join("\n - ")}`);
console.log(`\nVERDICT: one bus, ${BUS}, on the module's image; ${written(seenBefore as Seen).length} stream(s) ` +
`kept; ${ANCHOR} connected.`);
});
+1 -1
View File
@@ -12,7 +12,7 @@
* MESH_LAB_INCUS='sudo -n incus'
* MESH_LAB_HOST_BINARY=.../mesh-host/mesh-host
* MESH_LAB_BOOTSTRAP_BINARY=.../mesh-host/mesh-bootstrap
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=.../mesh-catalog/modules
* MESH_LAB_KEEP=1 to leave it standing afterwards
*/
+1 -1
View File
@@ -112,7 +112,7 @@ export async function genesis(o: GenesisOptions): Promise<GenesisResult> {
const registry = o.registry ?? "127.0.0.1:5000";
// The registry's and the builder's. Not the control plane's: its manifest lives in its own
// repository and genesis takes it from the build it runs (novox/hq ADR 0069, 04-ISSUES/072).
const modules = o.catalogueModules ?? ["distribution", "builder"];
const modules = o.catalogueModules ?? ["distribution", "build-agent"];
const catalogueOnMachine = o.catalogueOnMachine ?? "/opt/mesh-catalog";
const log = o.log ?? (() => {});
+7 -11
View File
@@ -23,14 +23,14 @@ import { mustBeHandedOver, pinnedInto, referenceFor, repositoryOf, type HeldImag
/**
* The example bundle in mesh-host names a registry that no longer exists.
*
* `examples/foundation-first-node-nats.lock` was written **for a target**, and the target was the lab: it
* `examples/foundation-first-node.lock` was written **for a target**, and the target was the lab: it
* pins `192.0.2.250:5000/…` because that is where the registry the lab used to raise served from.
* That registry is gone, so those three references name nothing.
*
* Two of them are ordinary third-party images and belong to the internet. Rather than invent
* digests here, they are the ones the mesh's own modules already pin — mesh-catalog's `postgres`
* and `lavinmq` — so the foundation's store and broker are literally the images the mesh runs. The
* third, mesh-controller, exists in no registry at all and becomes the ID the machine holds it under.
* Two of them are ordinary third-party images and belong to the internet. The store's is the one
* mesh-catalog's `postgres` module already pins, so the foundation's store is literally the image the
* mesh runs; the bus's is below. The third, mesh-controller, exists in no registry at all and becomes
* the ID the machine holds it under.
*
* **The bundle itself should be fixed in mesh-host**, and this substitution deleted with it. It is
* here because the file lives in another repository and because a fixture that lies about where an
@@ -38,11 +38,9 @@ import { mustBeHandedOver, pinnedInto, referenceFor, repositoryOf, type HeldImag
*/
const UPSTREAM_STORE =
"postgres@sha256:7456ef82e5f5bc43d997f4781bbd7c0d6389bff397564649a356e206ba473aee";
const UPSTREAM_BROKER =
"cloudamqp/lavinmq@sha256:3eb54c12916d700a978c2ea86e6362cd4974b0e3189508718006d4e6d341246b";
/**
* And the bus, for `foundation-first-node-nats.lock` — the bundle the mesh raises since it stopped
* speaking AMQP (novox/hq ADR 0131). The digest is the bundle's own: what the registry served was a
* And the bus, for `foundation-first-node.lock` — the one genesis bundle, which raises the bus the
* mesh runs on since it stopped speaking AMQP (novox/hq ADR 0131, ADR 0331). The digest is the bundle's own: what the registry served was a
* copy of the upstream image, so the same digest resolves on Docker Hub, and this is a prefix being
* removed rather than a reference being replaced.
*/
@@ -59,8 +57,6 @@ const UPSTREAM_BUS =
export function foundationBundle(path: string, held: HeldImage[]): string {
let text = readFileSync(path, "utf8");
text = text.replaceAll(/[A-Za-z0-9_.:-]+\/postgres@sha256:[0-9a-f]{64}/g, UPSTREAM_STORE);
text = text.replaceAll(
/[A-Za-z0-9_.:-]+\/cloudamqp\/lavinmq@sha256:[0-9a-f]{64}/g, UPSTREAM_BROKER);
text = text.replaceAll(/[A-Za-z0-9_.:-]+:[0-9]+\/nats@sha256:[0-9a-f]{64}/g, UPSTREAM_BUS);
return pinnedInto(text, held);
}
@@ -13,7 +13,7 @@
* It needs a host binary, the foundation bundle and the control plane's image:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* (mesh-controller:development, from mesh-controller's `make image`)
*/
import { test, before, after } from "node:test";
+1 -1
View File
@@ -25,7 +25,7 @@
* its vhost — the provider named the vhost after the login — and nothing is hardcoded; the provider's
* `serves` carries the port so the consumer references `${bound:amqp:port}`.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*
* HELPER — stock the two runtimes into the local daemon before the run (some may already be there):
* scripts/build-module-runtime.sh lavinmq /tmp/lavinmq.tar
+1 -1
View File
@@ -15,7 +15,7 @@
* asserts the templated URL and that a request to it reaches the running server (ollama answers
* /v1/models even with no model pulled — the wiring is what is proven, not a model's output).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* No module runtime image is built — both modules are pure declaration.
*/
@@ -11,7 +11,7 @@
* Mint on one side and create on the other agreeing, with no shared key and nothing placed by the
* test, is the entire provider/consumer contract working as one thing.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh redis builds mesh-runtime-redis:development, which
* scenarios/redis-node.yml stocks.
*/
+1 -1
View File
@@ -9,7 +9,7 @@
* It needs a host binary and the foundation bundle:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*
* The bundle's image references are rewritten to the ones this scenario's own registry serves.
* A digest belongs to whatever registry serves it, so a committed bundle names a registry that is
+3 -3
View File
@@ -31,7 +31,7 @@
* MESH_LAB_INCUS='sudo -n incus'
* MESH_LAB_HOST_BINARY=.../mesh-host/mesh-host
* MESH_LAB_BOOTSTRAP_BINARY=.../mesh-host/mesh-bootstrap
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../mesh-host/examples/foundation-first-node.lock
* MESH_LAB_CATALOG=.../mesh-catalog/modules
* MESH_LAB_SOURCE=<forge>/mesh-controller.git MESH_LAB_SOURCE_REF=<commit>
* MESH_LAB_KEEP=1 to leave it standing afterwards
@@ -109,7 +109,7 @@ const CONTROL_PLANE = { module: "mesh-controller", repo: "mesh-controller", path
* the registry and the builder — are here too: they are carried in, and a mesh missing any of them
* is not one.
*/
const MUST_HOLD = ["mesh-controller", "distribution", "builder", "mesh-tools", "postgres",
const MUST_HOLD = ["mesh-controller", "distribution", "build-agent", "mesh-tools", "postgres",
"mesh-catalog", "lavinmq", "mesh-vault", "amqp-ping"];
const MUST_RUN = ["mesh-controller", "mesh-registry", "mesh-broker", "mesh-store",
"mesh-postgres", "mesh-catalog", "mesh-lavinmq", "mesh-vault", "amqp-ping"];
@@ -898,7 +898,7 @@ before(async () => {
// does. novox/hq issue 050 — on a fresh mesh the modules built before the catalogue existed
// are exactly the ones it needed in order to exist, so the hole is always the foundation.
const missing = MUST_HOLD.filter((m) =>
!["distribution", "builder"].includes(m) && !held.includes(m));
!["distribution", "build-agent"].includes(m) && !held.includes(m));
assert.deepEqual(missing, [],
`the catalogue does not hold ${missing.join(", ")} — the mesh built them and its own ` +
`record has no trace of it (novox/hq issue 050):\n${held}`);
+1 -1
View File
@@ -12,7 +12,7 @@
* ordinary sealed-delivery path — with NO manager, NO refresh, NO access/refresh split, NO usage. The
* whole of OpenAI's integration in the control plane is one registry line (vendor -> static-key).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* Build the consumer runtime image into the local daemon first:
* scripts/build-module-runtime.sh openai-consumer /tmp/openai-consumer.tar
*/
+238
View File
@@ -0,0 +1,238 @@
/**
* REPLAY R92 — genesis pushes to its own registry on a runtime nobody told to trust it (novox/hq issue 92).
*
* On the first real genesis the push of the control plane's image into the registry genesis had just
* raised was refused: `Get "https://<address>/v2/": http: server gave HTTP response to HTTPS client`. The
* registry speaks plain HTTP on purpose (ADR 0082), and the trust that lets a runtime speak to it was
* written by the `docker` module, installed six steps after the push. The fix (mesh-host #91) has genesis
* write that trust into the runtime's configuration itself, and confirm it through `docker info`, before
* anything is pushed.
*
* **The lab hid it.** Its base image trusts the documentation ranges as plain-HTTP registries before any bed
* starts (src/lifecycle/base.ts), so every genesis bed pushed to a registry its runtime already trusted. This
* bed takes that trust back off the anchor — the base's file removed, the runtime restarted, and the runtime
* asked that it now trusts loopback and nothing else — and then runs the installer as an operator does, with
* `--registry 192.0.2.10:5000`.
*
* What it holds: genesis gets past its publish step, the registry it raised serves the control plane's image
* it pushed by the address it was given, and the runtime trusts that registry by the mesh's name too, which
* the builder pushes to later. Before the fix the push is refused, and the bed fails naming it.
*
* **A bed that could not reach the step it replays says so and does not fail**: a genesis stopped before
* its registry step — a pull the internet refused, a build that broke — proves nothing about the order this
* replays, and the test is skipped with the reason, which the prover reads as an error, never as the fault
* reproduced. Genesis is run once and not asked to finish: the steps after the control plane read
* repositories this bed does not serve, and are not what it replays.
*
* MESH_LAB_HOST_BINARY=<mesh-host>/mesh-host MESH_LAB_BOOTSTRAP_BINARY=<mesh-host>/mesh-bootstrap
* MESH_LAB_BUNDLE=<mesh-host>/examples/foundation-first-node.lock (the installer refuses the bus one)
* MESH_LAB_CATALOG=<mesh-catalog>/modules MESH_REPLAY_CONTROLLER=<a mesh-controller checkout>
* MESH_LAB_KEEP=1 leave it standing
*
* Run by `go run ./replays/cmd/prove R92`, which builds all of that at the fix and at the commit before it.
*/
import { test, before, after } from "node:test";
import assert from "node:assert/strict";
import { existsSync, mkdtempSync, rmSync } from "node:fs";
import { execFileSync } from "node:child_process";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { loadScenario } from "../../src/declaration/parse.ts";
import { raise } from "../../src/lifecycle/raise.ts";
import { destroy, exec, push } from "../../src/lifecycle/operate.ts";
import { bootstrapBinaryPath, hostBinaryPath } from "../../src/lifecycle/place.ts";
import { labIsUsable, destroyAll, foundationBundle } from "./harness.ts";
import { genesis, type GenesisResult } from "./genesis.ts";
const SCENARIO = "genesis-untrusted";
const ANCHOR = "anchor";
const FORGE = "forge";
const ANCHOR_ADDRESS = "192.0.2.10";
const FORGE_ADDRESS = "192.0.2.30";
/** The registry as the operator gives it: the anchor's own address and the registry's port. */
const REGISTRY = `${ANCHOR_ADDRESS}:5000`;
/** And as the mesh names it: the node, the mesh's internal suffix, the same port. */
const REGISTRY_BY_NAME = `${ANCHOR}.internal:5000`;
/** The installer's steps up to and including the one this replays, in its order. */
const UP_TO_PUBLISH = ["preflight", "load", "build", "bundle", "apply", "verify", "enrol", "operator", "registry", "publish"];
/** The steps before the registry's: a stop there never reached what this replays. */
const BEFORE_REGISTRY = UP_TO_PUBLISH.slice(0, UP_TO_PUBLISH.indexOf("registry"));
const capability = await labIsUsable();
const binary = hostBinaryPath();
const installer = bootstrapBinaryPath();
const bundle = process.env["MESH_LAB_BUNDLE"] ?? "";
const catalogDir = process.env["MESH_LAB_CATALOG"] ?? "";
const controller = process.env["MESH_REPLAY_CONTROLLER"] ?? "";
const KEEP = !!process.env["MESH_LAB_KEEP"];
const FIXED_ID = process.env["MESH_LAB_INSTANCE_ID"] ?? (KEEP ? "genesis-untrusted-live" : undefined);
const skip =
!capability.usable ? capability.why :
!binary ? "MESH_LAB_HOST_BINARY is not set to a built mesh-host" :
!installer ? "MESH_LAB_BOOTSTRAP_BINARY is not set to a built mesh-bootstrap" :
!bundle || !existsSync(bundle) ? "MESH_LAB_BUNDLE is not set to a foundation template" :
!catalogDir || !existsSync(catalogDir) ? "MESH_LAB_CATALOG is not set to mesh-catalog/modules" :
!controller || !existsSync(resolve(controller, ".git")) ? "MESH_REPLAY_CONTROLLER is not set to a mesh-controller checkout" :
false;
let instanceId = "";
/** Why the bed never reached the step it replays, or "" when it did. */
let unreached = "";
let result: GenesisResult | undefined;
let untrusted = "";
const report: string[] = [];
async function on(machine: string, command: string, timeoutMs?: number): Promise<{ out: string; ok: boolean }> {
const { stdout } = await exec(instanceId, machine, ["sh", "-c", `exec 2>&1\n${command}\necho "__exit=$?"`], timeoutMs);
const marker = stdout.lastIndexOf("__exit=");
if (marker < 0) return { out: stdout, ok: false };
return { out: stdout.slice(0, marker), ok: stdout.slice(marker + 7).trim() === "0" };
}
async function must(machine: string, command: string, timeoutMs?: number): Promise<string> {
const { out, ok } = await on(machine, command, timeoutMs);
if (!ok) throw new Error(`${machine}: ${command}\n${out}`);
return out;
}
/** The control plane's repository at the checkout's HEAD, served from the forge machine over git's protocol. */
async function raiseForge(): Promise<string> {
const dir = mkdtempSync(join(tmpdir(), "mesh-lab-r92-forge-"));
const head = execFileSync("git", ["-C", controller, "rev-parse", "HEAD"], { encoding: "utf8" }).trim();
try {
const bare = join(dir, "mesh-controller.git");
execFileSync("git", ["init", "-q", "--bare", bare]);
// No collection after the push: one run in the background rewrites the objects while they are carried.
execFileSync("git", ["-C", bare, "config", "receive.autogc", "false"]);
execFileSync("git", ["-C", controller, "push", "-q", "--force", bare, "HEAD:refs/heads/main"], { stdio: "pipe" });
const tar = join(tmpdir(), `mesh-lab-r92-forge-${process.pid}.tar`);
execFileSync("tar", ["-cf", tar, "-C", dir, "."]);
await push(instanceId, FORGE, tar, "/tmp/forge.tar");
rmSync(tar, { force: true });
} finally {
rmSync(dir, { recursive: true, force: true });
}
// Owned by the daemon's user, or git refuses to serve it ("dubious ownership") and says nothing.
await must(FORGE, `mkdir -p /srv/git && tar --no-same-owner -xf /tmp/forge.tar -C /srv/git && chown -R root:root /srv/git && ` +
`git daemon --base-path=/srv/git --export-all --reuseaddr --detach --listen=${FORGE_ADDRESS} --pid-file=/run/git-daemon.pid`);
for (let i = 0; ; i++) {
if ((await on(ANCHOR, `git ls-remote git://${FORGE_ADDRESS}/mesh-controller.git main`)).ok) break;
if (i >= 30) throw new Error(`the anchor cannot reach the forge at git://${FORGE_ADDRESS}/`);
await new Promise((r) => setTimeout(r, 2_000));
}
return head;
}
/**
* The anchor's runtime made a bare machine's: the base's trust of the documentation ranges taken off, and
* the runtime asked that it trusts no registry but loopback. Before genesis, so nothing runs that a restart
* would stop. Answers what the runtime said.
*/
async function untrust(): Promise<string> {
await must(ANCHOR, `rm -f /etc/docker/daemon.json && systemctl restart docker`, 180_000);
for (let i = 0; ; i++) {
if ((await on(ANCHOR, `docker info >/dev/null`)).ok) break;
if (i >= 60) throw new Error("the anchor's runtime did not answer after its trust was taken off");
await new Promise((r) => setTimeout(r, 2_000));
}
const config = (await must(ANCHOR, `docker info --format '{{json .RegistryConfig}}'`)).trim();
const parsed = JSON.parse(config) as { InsecureRegistryCIDRs?: string[]; IndexConfigs?: Record<string, { Secure?: boolean }> };
const cidrs = parsed.InsecureRegistryCIDRs ?? [];
const insecureNames = Object.entries(parsed.IndexConfigs ?? {}).filter(([, c]) => c.Secure === false).map(([n]) => n);
if (cidrs.some((c) => c !== "127.0.0.0/8" && c !== "::1/128") || insecureNames.length > 0) {
throw new Error(`the anchor's runtime still trusts more than loopback after the base's trust was taken off: ${config}`);
}
return `trusts ${cidrs.join(", ") || "nothing"} as plain-HTTP registries, and no registry by name`;
}
before(async () => {
if (skip) return;
const raised = await raise(loadScenario(`scenarios/${SCENARIO}.yml`), {
onProgress: (m) => console.log(`raise: ${m}`),
...(FIXED_ID ? { instanceId: FIXED_ID } : {}),
});
instanceId = raised.instanceId;
console.log(`INSTANCE ${instanceId}${KEEP ? " (KEEP — will be left standing)" : ""}`);
let head = "";
try {
head = await raiseForge();
report.push(` forge git://${FORGE_ADDRESS}/mesh-controller.git at ${head.slice(0, 8)}`);
untrusted = await untrust();
report.push(` anchor's runtime ${untrusted}`);
} catch (err) {
unreached = `the bed was not prepared, so the installer never ran: ${(err as Error).message}`;
return;
}
const forge = (repo: string) => `git://${FORGE_ADDRESS}/${repo}.git`;
try {
result = await genesis({
instanceId,
node: ANCHOR,
installer: installer as string,
catalogDir,
// The registry's manifest is all the steps this replays read from the catalogue.
catalogueModules: ["distribution"],
bundleTemplate: foundationBundle(bundle, []),
registry: REGISTRY,
source: forge("mesh-controller"),
sourceRef: head,
// Named because the installer requires them; served by nobody, since the steps that clone them
// come after the one replayed here.
toolsSource: forge("mesh-tools"),
sdkSource: forge("mesh-sdk"),
catalogSource: forge("mesh-catalog"),
attempts: 1,
verify: false,
log: (m) => console.log(m),
});
} catch (err) {
unreached = `the installer could not be run: ${(err as Error).message}`;
return;
}
report.push(...result.report);
const stoppedAt = result.step.replace(/^step \d+ of \d+, /, "");
if (!result.ok && (BEFORE_REGISTRY.includes(stoppedAt) || !result.step)) {
unreached = `genesis stopped at ${result.step || "no step it named"}, before its registry step, so the order ` +
`this replays was never reached:\n${result.why}`;
}
}, { timeout: 3_600_000 });
after(async () => {
if (KEEP) {
console.log(`\nLEFT STANDING: ${instanceId} — not destroyed (MESH_LAB_KEEP).`);
return;
}
if (instanceId) await destroy(instanceId);
await destroyAll(`${SCENARIO}-`);
}, { timeout: 900_000 });
test("genesis pushes to the registry it raised on a runtime nobody told to trust it", {
skip, timeout: 3_600_000,
}, async (t) => {
console.log(report.join("\n"));
if (unreached) {
t.skip(`R92 NOT REACHED: ${unreached}`);
return;
}
const ran = result as GenesisResult;
const stoppedAt = ran.step.replace(/^step \d+ of \d+, /, "");
// The incident's own words, and the step it stopped at.
assert.doesNotMatch(ran.said, /server gave HTTP response to HTTPS client/,
`the runtime refused to push to ${REGISTRY} over plain HTTP — the registry was not trusted before the push ` +
`(stopped at ${ran.step || "no step"}):\n${ran.why}`);
assert.ok(ran.ok || !UP_TO_PUBLISH.includes(stoppedAt),
`genesis stopped at ${ran.step}, before its control plane was published to ${REGISTRY}:\n${ran.why}`);
// The registry agreeing: the image genesis pushed, by the address it was given.
const tags = (await on(ANCHOR, `curl -s --max-time 10 http://${REGISTRY}/v2/mesh-controller/tags/list`)).out.trim();
assert.match(tags, /"genesis"/, `${REGISTRY} does not serve the control plane genesis pushed: ${tags || "no answer"}`);
// And the runtime trusts the registry by the mesh's name as well: the builder pushes there later.
const config = (await must(ANCHOR, `docker info --format '{{json .RegistryConfig.IndexConfigs}}'`)).trim();
const byName = (JSON.parse(config) as Record<string, { Secure?: boolean }>)[REGISTRY_BY_NAME];
assert.ok(byName && byName.Secure === false,
`the runtime does not trust ${REGISTRY_BY_NAME}, the name the mesh pushes to its registry by: ${config}`);
});
+1 -1
View File
@@ -25,7 +25,7 @@
* publicly-trusted certificate and answering an HTTP-01 challenge at the name — is proven separately
* by certificates.test.ts, which drives the same proxy binary against a real ACME server (Pebble).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-route-proxy-image.sh builds mesh-route-proxy:development into the local daemon;
* scenarios/route-forwarding.yml stocks it and alpine:latest, and serves both by digest.
*/
@@ -12,7 +12,7 @@
* the container was replaced (a new container id) and the config on disk carries the new value.
* It builds the host from source (no --no-build), because the behaviour under test is the host's.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh grafana builds mesh-runtime-grafana:development, which
* scenarios/grafana-node.yml stocks.
*/
+1 -1
View File
@@ -14,7 +14,7 @@
* It needs a host binary and the foundation bundle:
*
* MESH_LAB_HOST_BINARY=.../mesh-host
* MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*/
import { test, before, after } from "node:test";
import assert from "node:assert/strict";
+1 -1
View File
@@ -20,7 +20,7 @@
* references of OURS are rewritten to the IDs the machine holds, and the co-located
* host-port collisions are remapped at load time (see REMAP).
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
*/
import { test, before, after } from "node:test";
+2 -2
View File
@@ -50,7 +50,7 @@
* (whole-mesh-full-live) and NOT torn down — it is left standing and browsable. Without it the bed
* behaves like every other: raise in before(), destroy in after().
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* MESH_LAB_BOOTSTRAP_BINARY=.../mesh-bootstrap MESH_LAB_CATALOG=.../mesh-catalog/modules
*/
@@ -119,7 +119,7 @@ const CATALOGUE_ON_MACHINE = "/opt/mesh-catalog";
* a third, this list is where the bed finds out, by the installer saying which manifest it could
* not read.
*/
const CATALOGUE_MODULES = ["distribution", "builder"];
const CATALOGUE_MODULES = ["distribution", "build-agent"];
/**
* Where this mesh keeps its own images, as the anchor reaches it.
+1 -1
View File
@@ -28,7 +28,7 @@
* host ports here (container ports unchanged); the provider ports the consumers actually connect to
* (postgres 5432, minio 9000, mongodb 27017, mssql 1433) are left as-is. See REMAP below.
*
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node-nats.lock
* MESH_LAB_HOST_BINARY=.../mesh-host MESH_LAB_BUNDLE=.../examples/foundation-first-node.lock
* scripts/build-module-runtime.sh builds one runtime per module that has code; the route-proxy image
* is built by scripts/build-route-proxy-image.sh; scenarios/whole-mesh-novox.yml stocks them all
* alongside every server image.