build modules: every one runs the runs-counted kit case; failurekit refuses one that does not (A-489a)

Builds: design 47 G §24; lead answers A-489a, A-489b

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
This commit is contained in:
2026-11-19 15:42:44 +01:00
parent 0a446c7572
commit 7c64c17e65
5 changed files with 46 additions and 4 deletions
+8
View File
@@ -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))
+6 -4
View File
@@ -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"
@@ -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())
})
}
@@ -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())
})
}
@@ -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())
})
}