From 804f5c4ab4fb450f3f09bd558f7a9459cfe08d47 Mon Sep 17 00:00:00 2001 From: jochen Date: Wed, 25 Nov 2026 17:39:00 +0100 Subject: [PATCH] failurekit: G8 kit-checked, a build module whose tests do not run the reproducible case is refused Every build module claiming a node-build-* seat must hold a test that calls conformance.Reproducible; mesh-build-node's tests now run it over its bundle build, as mesh-build-go's and mesh-build-image's do. A row of the check's test (a module with the rest of the kit and no reproducible case) is refused. Builds: design 47 H2 H-A-591 (4), H-A-593 (3) --- checks/failurekit/failurekit.go | 12 ++++++++++- checks/failurekit/failurekit_test.go | 12 ++++++----- .../cmd/mesh-build-node/kit_test.go | 21 +++++++++++++++++++ 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/checks/failurekit/failurekit.go b/checks/failurekit/failurekit.go index 561138846..5d5f2c871 100644 --- a/checks/failurekit/failurekit.go +++ b/checks/failurekit/failurekit.go @@ -5,7 +5,7 @@ // exempt from that, and said so. Every build module, test step or not, must also hold a test that calls // conformance.LeftRunning with its own start sweep, so a step a previous process left running is ended at its start // (issue 1890), and one that calls conformance.Passing, so a step whose network did not answer is said as a transport fault -// (issue 1748), and one that calls conformance.StepEnds, so its steps can say a pipeline step's end (design 47 G §24). Its manifest asks the capability seat-settle-delay (ADR 0664 §5). +// (issue 1748), and one that calls conformance.StepEnds, so its steps can say a pipeline step's end (design 47 G §24), and one that calls conformance.Reproducible, so its build gives one digest per artifact in any folder (design 47 H2 H-A-591 (4)). Its manifest asks the capability seat-settle-delay (ADR 0664 §5). package failurekit import ( @@ -110,6 +110,16 @@ func Judge(root string) ([]Judged, error) { refused = append(refused, fmt.Sprintf("it claims %s, and no test of it calls conformance.StepEnds "+ "(mesh-delivery-sdk steprun/conformance): run the kit's step-ends case with the module's own steps (design 47 G §24)", seat)) } + // H-A-591 (4): every build module builds one source at one version to one digest, in any folder and at any time, so every one + // runs the kit's reproducible case over its fixture of each kind it builds. + same, err := runsTheKit(dir, "conformance.Reproducible(") + if err != nil { + return nil, err + } + if !same { + refused = append(refused, fmt.Sprintf("it claims %s, and no test of it calls conformance.Reproducible "+ + "(mesh-delivery-sdk steprun/conformance): run the kit's case that its build gives one digest per artifact from two folders (design 47 H2 H-A-591)", seat)) + } // Every build module meets the network (a fetch, a download, an install, a publish), so every one runs the passing case: its // steps say a network that did not answer as a transport fault the bus gives the ask again for (ADR 0664, issue 1748). says, err := runsTheKit(dir, "conformance.Passing(") diff --git a/checks/failurekit/failurekit_test.go b/checks/failurekit/failurekit_test.go index 27dad2f4e..1dc1d04c2 100644 --- a/checks/failurekit/failurekit_test.go +++ b/checks/failurekit/failurekit_test.go @@ -8,12 +8,12 @@ import ( // 1901/AC7 and 1890/AC8: a build module with a test step and no kit is refused, one that runs the kit passes, one with no // test step is exempt from the failure cases but not from the left-running case, a module that runs only the failure -// cases is refused, a module that does not ask the capability seat-settle-delay is refused (ADR 0664 §5), and a module that +// cases is refused, a module that does not ask the capability seat-settle-delay is refused (ADR 0664 §5), a module that runs the rest of the kit but not the reproducible case is refused (design 47 H2 H-A-591 (4)), and a module that // claims no node-build-* seat is not judged. func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) { root := t.TempDir() const imp = "package main\n\nimport \"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun/conformance\"\n\n" - const sweep = "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestEnds(t *testing.T) { conformance.StepEnds(t, steprun.AskSteps{}) }\nfunc TestCounted(t *testing.T) { conformance.RunsCounted(t, nil) }\n" + const sweep = "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestEnds(t *testing.T) { conformance.StepEnds(t, steprun.AskSteps{}) }\nfunc TestCounted(t *testing.T) { conformance.RunsCounted(t, nil) }\nfunc TestSame(t *testing.T) { conformance.Reproducible(t, nil, nil) }\n" kit := imp + "func TestKit(t *testing.T) { conformance.Run(t, conformance.GoTest, nil) }\n" + sweep for path, body := range map[string]string{ "modules/a/module.json": `{"claims":[{"name":"node-build-a"}],"tools":["build_a_fetch","build_a_test"]}`, @@ -33,7 +33,9 @@ func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) { "modules/j/module.json": `{"claims":[{"name":"node-build-j"}],"capabilities":["seat-settle-delay"],"tools":["build_j_build"]}`, // the rest of the kit, and no step-ends case "modules/j/cmd/j/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestCounted(t *testing.T) { conformance.RunsCounted(t, nil) }\n", "modules/k/module.json": `{"claims":[{"name":"node-build-k"}],"capabilities":["seat-settle-delay"],"tools":["build_k_build"]}`, // no runs-counted case - "modules/k/cmd/k/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestEnds(t *testing.T) { conformance.StepEnds(t, steprun.AskSteps{}) }\n", + "modules/k/cmd/k/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestEnds(t *testing.T) { conformance.StepEnds(t, steprun.AskSteps{}) }\nfunc TestSame(t *testing.T) { conformance.Reproducible(t, nil, nil) }\n", + "modules/l/module.json": `{"claims":[{"name":"node-build-l"}],"capabilities":["seat-settle-delay"],"tools":["build_l_build"]}`, // the rest of the kit, and no reproducible case + "modules/l/cmd/l/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\nfunc TestPassing(t *testing.T) { conformance.Passing(t, nil, nil) }\nfunc TestEnds(t *testing.T) { conformance.StepEnds(t, steprun.AskSteps{}) }\nfunc TestCounted(t *testing.T) { conformance.RunsCounted(t, nil) }\n", "modules/e/module.json": `{"claims":[{"name":"node-build-e"}],"tools":["build_e_test"]}`, "modules/e/cmd/e/kit.go": kit, // not a test file } { @@ -49,9 +51,9 @@ func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) { if err != nil { t.Fatal(err) } - want := map[string]string{"a": "refused", "b": "passes", "c": "exempt", "e": "refused", "f": "refused", "g": "refused", "h": "refused", "i": "refused", "j": "refused", "k": "refused"} + want := map[string]string{"a": "refused", "b": "passes", "c": "exempt", "e": "refused", "f": "refused", "g": "refused", "h": "refused", "i": "refused", "j": "refused", "k": "refused", "l": "refused"} if len(got) != len(want) { - t.Fatalf("judged %+v, want a, b, c, e, f, g, h, i, j and k", got) + t.Fatalf("judged %+v, want a, b, c, e, f, g, h, i, j, k and l", got) } for _, j := range got { is := "passes" diff --git a/modules/mesh-build-node/cmd/mesh-build-node/kit_test.go b/modules/mesh-build-node/cmd/mesh-build-node/kit_test.go index c52105302..cdf5b4235 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/kit_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/kit_test.go @@ -115,3 +115,24 @@ func TestThePullerCountsRunsThatStarted(t *testing.T) { return m.Puller(nil, steprun.NewFakeAsks()) }) } + +// H-A-591 (4), H-A-593 (3): the kit's `reproducible` case. The module's own build step packs a fixture bundle twice, in two +// workspace folders of other names and other file times (the compiler and the bundler stand in, as in every build test of this +// module, and write what they would from the same source), and the archive's digest is the same: nothing of the folder or +// the clock is in the pack. +func TestTheBuildOfABundleIsOneDigestInAnyFolder(t *testing.T) { + conformance.Reproducible(t, func(dir string) error { + workspaceWith(t, dir, map[string]string{"modules/m/module.json": strings.Replace(bundleManifest, "%s", "", 1), + "modules/m/tools/index.ts": "export {}"}) + return nil + }, func(dir string) (map[string]string, error) { + m, f, _ := newMachine(t) + m.Work = dir + f.effect = esbuildEffect(t) + out, err := m.build(context.Background(), buildArgs()) + if err != nil { + return nil, err + } + return map[string]string{"tools": out.(BuildResult).Digest}, nil + }) +}