From 7c64c17e65bfe2b05ed0eefdc78731940787731b Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 15:42:44 +0100 Subject: [PATCH] build modules: every one runs the runs-counted kit case; failurekit refuses one that does not (A-489a) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds: design 47 G §24; lead answers A-489a, A-489b Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- checks/failurekit/failurekit.go | 8 ++++++++ checks/failurekit/failurekit_test.go | 10 ++++++---- modules/mesh-build-go/cmd/mesh-build-go/kit_test.go | 10 ++++++++++ .../mesh-build-image/cmd/mesh-build-image/kit_test.go | 11 +++++++++++ .../mesh-build-node/cmd/mesh-build-node/kit_test.go | 11 +++++++++++ 5 files changed, 46 insertions(+), 4 deletions(-) diff --git a/checks/failurekit/failurekit.go b/checks/failurekit/failurekit.go index 934992930..b188ef5fb 100644 --- a/checks/failurekit/failurekit.go +++ b/checks/failurekit/failurekit.go @@ -97,6 +97,14 @@ func Judge(root string) ([]Judged, error) { if err != nil { return nil, err } + counts, err := runsTheKit(dir, "conformance.RunsCounted(") + if err != nil { + return nil, err + } + if !counts { + refused = append(refused, fmt.Sprintf("it claims %s, and no test of it calls conformance.RunsCounted "+ + "(mesh-delivery-sdk steprun/conformance): run the kit's case that its puller counts the runs that started, not the bus's deliveries (A-489a)", seat)) + } if !ends { 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)) diff --git a/checks/failurekit/failurekit_test.go b/checks/failurekit/failurekit_test.go index f49d3d924..27dad2f4e 100644 --- a/checks/failurekit/failurekit_test.go +++ b/checks/failurekit/failurekit_test.go @@ -13,7 +13,7 @@ import ( 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{}) }\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" 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"]}`, @@ -31,7 +31,9 @@ func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) { "modules/i/module.json": `{"claims":[{"name":"node-build-i"}],"capabilities":["other"],"tools":["build_i_build"]}`, // the whole kit, and no seat-settle-delay "modules/i/cmd/i/kit_test.go": imp + sweep, "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) }\n", + "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/e/module.json": `{"claims":[{"name":"node-build-e"}],"tools":["build_e_test"]}`, "modules/e/cmd/e/kit.go": kit, // not a test file } { @@ -47,9 +49,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"} + want := map[string]string{"a": "refused", "b": "passes", "c": "exempt", "e": "refused", "f": "refused", "g": "refused", "h": "refused", "i": "refused", "j": "refused", "k": "refused"} if len(got) != len(want) { - t.Fatalf("judged %+v, want a, b, c, e, f, g, h, i and j", got) + t.Fatalf("judged %+v, want a, b, c, e, f, g, h, i, j and k", got) } for _, j := range got { is := "passes" diff --git a/modules/mesh-build-go/cmd/mesh-build-go/kit_test.go b/modules/mesh-build-go/cmd/mesh-build-go/kit_test.go index c311d63cb..8afd7d673 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/kit_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/kit_test.go @@ -62,3 +62,13 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { func TestTheStepsCanSayAStepsEnd(t *testing.T) { conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil)) } + +// A-489a: the module's puller counts the runs its steps state says started, not the bus's deliveries (an ask given back before +// it ran is no run), so the poison rule never ends an ask that never ran. +func TestThePullerCountsRunsThatStarted(t *testing.T) { + conformance.RunsCounted(t, func(read func(string) (json.RawMessage, error)) *steprun.Puller { + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }} + m.ReadSteps = StateRead{Get: read} + return m.Puller(nil, steprun.NewFakeAsks()) + }) +} diff --git a/modules/mesh-build-image/cmd/mesh-build-image/kit_test.go b/modules/mesh-build-image/cmd/mesh-build-image/kit_test.go index 4aaead31f..0dfd8ce8e 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/kit_test.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/kit_test.go @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/json" "errors" sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" @@ -50,3 +51,13 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { func TestTheStepsCanSayAStepsEnd(t *testing.T) { conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil)) } + +// A-489a: the module's puller counts the runs its steps state says started, not the bus's deliveries (an ask given back before +// it ran is no run), so the poison rule never ends an ask that never ran. +func TestThePullerCountsRunsThatStarted(t *testing.T) { + conformance.RunsCounted(t, func(read func(string) (json.RawMessage, error)) *steprun.Puller { + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }} + m.ReadSteps = StateRead{Get: read} + return m.Puller(nil, steprun.NewFakeAsks()) + }) +} 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 157c614c2..2fbbcac74 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 @@ -2,6 +2,7 @@ package main import ( "context" + "encoding/json" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" "strings" "testing" @@ -55,3 +56,13 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { func TestTheStepsCanSayAStepsEnd(t *testing.T) { conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil)) } + +// A-489a: the module's puller counts the runs its steps state says started, not the bus's deliveries (an ask given back before +// it ran is no run), so the poison rule never ends an ask that never ran. +func TestThePullerCountsRunsThatStarted(t *testing.T) { + conformance.RunsCounted(t, func(read func(string) (json.RawMessage, error)) *steprun.Puller { + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }} + m.ReadSteps = StateRead{Get: read} + return m.Puller(nil, steprun.NewFakeAsks()) + }) +}