Compare commits

...
Author SHA1 Message Date
jschoubben 83accdbb4e build modules: cite A-489c on the runs-counted kit tests and failurekit's refusal
Builds: design 47 G §24; lead answer A-489c

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:45:49 +01:00
jschoubben 7c64c17e65 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
2026-11-19 15:42:44 +01:00
jschoubben 0a446c7572 build modules: cite A-489b on the step-ends kit case, its check and the node's need
Builds: design 47 G §24; lead answer A-489b

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:38:16 +01:00
jschoubben e1521a2ecf build modules: every one runs the step-ends kit case; failurekit refuses one that does not; image and go count runs that started
mesh-build-image's steps now carry Node and SayStep (an image has no step, §328, but the kit holds all three). Prior wired in go and image.

Builds: design 47 G §24, §328

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:25:38 +01:00
jschoubben 3a94021766 mesh-build-node: its steps say a step's end, lint is the type-check, it has its own need
A pipeline step ask (the sdk's lib lint and unit steps) was refused with 'this build module says no step's end': its
AskSteps set no SayStep, Node, Lint or Has. They are set as mesh-build-go sets them; lint runs tsc --noEmit over each TypeScript
package; Puller.Prior counts only runs that started toward poison.

Builds: design 47 G §328 (Lint per language), §22, §24, §25

Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy
2026-11-19 15:25:38 +01:00
12 changed files with 217 additions and 7 deletions
+20 -1
View File
@@ -5,7 +5,7 @@
// exempt from that, and said so. Every build module, test step or not, must also hold a test that calls // 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 // 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 1890), and one that calls conformance.Passing, so a step whose network did not answer is said as a transport fault
// (issue 1748). 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). Its manifest asks the capability seat-settle-delay (ADR 0664 §5).
package failurekit package failurekit
import ( import (
@@ -91,6 +91,25 @@ func Judge(root string) ([]Judged, error) {
refused = append(refused, fmt.Sprintf("it claims %s, and no test of it calls conformance.LeftRunning "+ refused = append(refused, fmt.Sprintf("it claims %s, and no test of it calls conformance.LeftRunning "+
"(mesh-build-go buildstep/conformance): run the kit's left-running case with the module's own start sweep (issue 1890)", seat)) "(mesh-build-go buildstep/conformance): run the kit's left-running case with the module's own start sweep (issue 1890)", seat))
} }
// A-489b: every build module is asked pipeline steps, so every one runs the case that its steps can say a step's end: without a
// SayStep every step ask is refused live ("this build module says no step's end"), as mesh-build-node's was.
ends, err := runsTheKit(dir, "conformance.StepEnds(")
if err != nil {
return nil, err
}
counts, err := runsTheKit(dir, "conformance.RunsCounted(")
if err != nil {
return nil, err
}
if !counts {
// A-489c
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))
}
// Every build module meets the network (a fetch, a download, an install, a publish), so every one runs the passing case: its // 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). // 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(") says, err := runsTheKit(dir, "conformance.Passing(")
+7 -3
View File
@@ -13,7 +13,7 @@ import (
func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) { func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) {
root := t.TempDir() root := t.TempDir()
const imp = "package main\n\nimport \"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun/conformance\"\n\n" 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) }\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 kit := imp + "func TestKit(t *testing.T) { conformance.Run(t, conformance.GoTest, nil) }\n" + sweep
for path, body := range map[string]string{ for path, body := range map[string]string{
"modules/a/module.json": `{"claims":[{"name":"node-build-a"}],"tools":["build_a_fetch","build_a_test"]}`, "modules/a/module.json": `{"claims":[{"name":"node-build-a"}],"tools":["build_a_fetch","build_a_test"]}`,
@@ -30,6 +30,10 @@ func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) {
"modules/h/cmd/h/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\n", "modules/h/cmd/h/kit_test.go": imp + "func TestSweep(t *testing.T) { conformance.LeftRunning(t, nil) }\n",
"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/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/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) }\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/module.json": `{"claims":[{"name":"node-build-e"}],"tools":["build_e_test"]}`,
"modules/e/cmd/e/kit.go": kit, // not a test file "modules/e/cmd/e/kit.go": kit, // not a test file
} { } {
@@ -45,9 +49,9 @@ func TestABuildModuleWithATestStepMustRunTheKit(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
want := map[string]string{"a": "refused", "b": "passes", "c": "exempt", "e": "refused", "f": "refused", "g": "refused", "h": "refused", "i": "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) { if len(got) != len(want) {
t.Fatalf("judged %+v, want a, b, c, e, f, g, h and i", got) t.Fatalf("judged %+v, want a, b, c, e, f, g, h, i, j and k", got)
} }
for _, j := range got { for _, j := range got {
is := "passes" is := "passes"
@@ -91,7 +91,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
if m.SayEvent != nil { if m.SayEvent != nil {
say = steprun.SayOn(sdkstep.AskGo, m.Node, m.SayEvent) say = steprun.SayOn(sdkstep.AskGo, m.Node, m.SayEvent)
} }
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskGo, Say: say, Callers: m.Callers, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys, return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskGo, Say: say, Callers: m.Callers, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Has: m.Has, Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Has: m.Has,
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
if err := m.Check(ctx); err != nil { if err := m.Check(ctx); err != nil {
@@ -56,3 +56,19 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) {
} }
}) })
} }
// A-489b, design 47 G §24: the module's own steps can say a pipeline step's end, or
// every step ask the runner sends it is refused ("this build module says no step's end"), as the first live pipeline met.
func TestTheStepsCanSayAStepsEnd(t *testing.T) {
conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil))
}
// A-489c (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())
})
}
@@ -31,9 +31,20 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
Fetch: byName["build_image_fetch"], Build: byName["build_image_build"], Copy: byName["build_image_copy"], Fetch: byName["build_image_fetch"], Build: byName["build_image_build"], Copy: byName["build_image_copy"],
Release: func(ws string) error { return m.spaces().Release(ws) }, Release: func(ws string) error { return m.spaces().Release(ws) },
Logf: m.Say, Logf: m.Say,
Node: m.Node,
SayStep: m.sayStep(),
} }
} }
// sayStep says a step ask's end on this node's subject of the seat (design 47 G §24): an image has no lint, unit or integration
// step (§328), so none is asked of this seat, but the steps of every build module can say their ends, which the kit holds.
func (m *Module) sayStep() func(sdkstep.StepEnded) error {
if m.SayStep != nil {
return m.SayStep
}
return steprun.SayStepOn(sdkstep.AskImage, m.Node, stdio.SeatPublish)
}
// Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil). // Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil).
func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Puller { func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Puller {
if source == nil { if source == nil {
@@ -69,7 +80,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
if m.SayEvent != nil { if m.SayEvent != nil {
say = steprun.SayOn(sdkstep.AskImage, m.Node, m.SayEvent) say = steprun.SayOn(sdkstep.AskImage, m.Node, m.SayEvent)
} }
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskImage, Say: say, Callers: m.Callers, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys, return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskImage, Say: say, Callers: m.Callers, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say, Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Eligible: m.Eligible, Logf: m.Say,
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
if err := m.Check(ctx); err != nil { if err := m.Check(ctx); err != nil {
@@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"encoding/json"
"errors" "errors"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
@@ -44,3 +45,19 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) {
} }
}) })
} }
// A-489b, design 47 G §24: the module's own steps can say a pipeline step's end, or
// every step ask the runner sends it is refused ("this build module says no step's end"), as the first live pipeline met.
func TestTheStepsCanSayAStepsEnd(t *testing.T) {
conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil))
}
// A-489c (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())
})
}
@@ -28,6 +28,8 @@ type Module struct {
// SayEvent publishes an event of the image build seat on a seat subject (stdio.SeatPublish; nil says none, a test's): the // SayEvent publishes an event of the image build seat on a seat subject (stdio.SeatPublish; nil says none, a test's): the
// puller's ask-taken, step-progress and step-ended (design 47 G §496, §602). // puller's ask-taken, step-progress and step-ended (design 47 G §496, §602).
SayEvent func(subject string, body any, id string) error SayEvent func(subject string, body any, id string) error
// SayStep says a step ask's end (steprun.AskSteps.SayStep); the seat's publish on this node when nil (a test's own).
SayStep func(sdkstep.StepEnded) error
Node string Node string
// RecordAct writes an act in the hand-act log of the seat mesh-hand-acts (§463, §480): a drop writes it first. // RecordAct writes an act in the hand-act log of the seat mesh-hand-acts (§463, §480): a drop writes it first.
@@ -41,9 +41,22 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps {
}, },
Release: func(ws string) error { return m.spaces().Release(ws) }, Release: func(ws string) error { return m.spaces().Release(ws) },
Logf: m.Say, Logf: m.Say,
Has: m.Has,
Lint: m.lintStep,
Node: m.Node,
SayStep: m.sayStep(),
} }
} }
// sayStep says a pipeline step's end on this node's subject of the seat (design 47 G §24, *Asked on a work queue, ended by an
// event*): SayStep when a test sets it, else the runtime's seat publish.
func (m *Module) sayStep() func(sdkstep.StepEnded) error {
if m.SayStep != nil {
return m.SayStep
}
return steprun.SayStepOn(sdkstep.AskNode, m.Node, stdio.SeatPublish)
}
// Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil). // Puller is the module's pull of its seat's asks, on source (the runtime's seat pull when nil).
func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Puller { func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Puller {
if source == nil { if source == nil {
@@ -79,7 +92,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul
if m.SayEvent != nil { if m.SayEvent != nil {
say = steprun.SayOn(sdkstep.AskNode, m.Node, m.SayEvent) say = steprun.SayOn(sdkstep.AskNode, m.Node, m.SayEvent)
} }
return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskNode, Say: say, Callers: m.Callers, Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys, return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskNode, Say: say, Callers: m.Callers, Prior: steprun.PriorRuns(m.ReadSteps.Get), Node: m.Node, Put: m.Steps, PausePut: m.Pauses, Load: load, ForgetPause: m.ForgetPause, WatchPauses: m.WatchPauses, PauseKeys: m.ReadPauses.Keys,
Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say, Capacity: capacity, SettingsFile: settings, WatchConfig: watch, CoresPerStep: cores, BuildHours: hours, Logf: m.Say,
Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) {
if err := m.Prepare(ctx); err != nil { if err := m.Prepare(ctx); err != nil {
@@ -9,6 +9,7 @@ import (
"testing" "testing"
"time" "time"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
"git.novox.be/novox/mesh-sdk/go/forgekey" "git.novox.be/novox/mesh-sdk/go/forgekey"
) )
@@ -226,3 +227,54 @@ func TestTheTestScriptFindsTscAndEsbuildOnItsPath(t *testing.T) {
t.Errorf("npm ran with %v, want NODE_OPTIONS naming the TAP reporter and its file", npm.env) t.Errorf("npm ran with %v, want NODE_OPTIONS naming the TAP reporter and its file", npm.env)
} }
} }
// Design 47 G §328 (*Lint per language*: TypeScript's lint is the type-check) and §24: the pipeline step lint of a TypeScript
// artifact runs tsc without emitting over the module's directory; a type error fails it naming the file, a clean package passes,
// a tree with no .ts file has nothing to lint, and a tsc that cannot start is an error, not a verdict.
func TestTheLintStepIsTheTypeCheck(t *testing.T) {
for _, c := range []struct {
name string
files map[string]string
ran forgekey.Ran
failed int
nothing bool
err bool
}{
{"a type error", map[string]string{"tools/bad.ts": `export const n: number = "text";`}, forgekey.Ran{Status: 2, Stdout: tscTypeError}, 1, false, false},
{"a clean package", map[string]string{"index.ts": `export const a = 1;`}, forgekey.Ran{}, 0, false, false},
{"no TypeScript", map[string]string{"package.json": `{"name":"x"}`}, forgekey.Ran{}, 0, true, false},
{"tsc cannot start", map[string]string{"index.ts": `export const a = 1;`}, forgekey.Ran{Status: 127, Err: "no such file"}, 0, false, true},
} {
t.Run(c.name, func(t *testing.T) {
m, f, work := newMachine(t)
workspaceWith(t, work, c.files)
f.answer["tsc"] = c.ran
out, err := m.lintStep(context.Background(), map[string]any{"workspace": "w1", "dir": "."})
if (err != nil) != c.err {
t.Fatalf("error = %v, want error %v", err, c.err)
}
if err != nil {
return
}
la := out.(steprun.LintAnswer)
if len(la.Failed) != c.failed || la.Nothing != c.nothing {
t.Fatalf("answer = %+v, want %d failed, nothing %v", la, c.failed, c.nothing)
}
if c.failed > 0 && !strings.Contains(la.Failed[0].Cause+la.Failed[0].Output, "tools/bad.ts") {
t.Errorf("the failure %+v does not name tools/bad.ts", la.Failed[0])
}
if !c.nothing && !strings.Contains(joined(f.calls[0]), "--noEmit") {
t.Errorf("the lint ran %s, want tsc --noEmit", joined(f.calls[0]))
}
})
}
}
// Design 47 G §24: the Node build module's steps carry what a step ask needs (its node, the lint body, the end's publisher and
// its own need), so the ask the first live pipeline sent is no longer refused as "says no step's end".
func TestTheNodeStepsCarryWhatAStepAskNeeds(t *testing.T) {
s := (&Module{Node: "shanks"}).askSteps(nil)
if s.Lint == nil || s.Node != "shanks" || s.SayStep == nil || s.Has == nil || !s.Has(sdkstep.NeedNodeBuildNode) || s.Has("other") {
t.Errorf("steps = %+v, want Lint, Node, SayStep and Has set", s)
}
}
@@ -2,6 +2,7 @@ package main
import ( import (
"context" "context"
"encoding/json"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
"strings" "strings"
"testing" "testing"
@@ -49,3 +50,19 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) {
} }
}) })
} }
// A-489b, design 47 G §24: the module's own steps can say a pipeline step's end, or
// every step ask the runner sends it is refused ("this build module says no step's end"), as the first live pipeline met.
func TestTheStepsCanSayAStepsEnd(t *testing.T) {
conformance.StepEnds(t, (&Module{Node: "kitnode"}).askSteps(nil))
}
// A-489c (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())
})
}
@@ -0,0 +1,56 @@
package main
import (
"context"
"fmt"
"path/filepath"
sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep"
"git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun"
)
// **The type-check is a TypeScript artifact's pipeline step lint** (design 47 G §328 *Lint per language*: Go's lint is the Go
// build module's linter, TypeScript's the type-check; §22: lint is a step the build seats serve; §24: asked on a work queue,
// its end said as an event). It takes {"workspace", "dir"} as the lint step of mesh-build-go does and runs tsc over each
// TypeScript package of the module's directory (testTargets, the way the unit level finds them), without emitting: a package
// with no .ts file has nothing to lint, and nothing at all ends the step `nothing to run`. A failure is the step's, naming
// the tsc output as the unit level names it; a tsc that could not start is an error, never a verdict.
func (m *Module) lintStep(ctx context.Context, args map[string]any) (any, error) {
workspace, _ := args["workspace"].(string)
dir, _ := args["dir"].(string)
root, mdir, err := m.moduleDirOf(workspace, dir)
if err != nil {
return nil, err
}
targets, err := testTargets(mdir, filepath.ToSlash(filepath.Clean(dir)))
if err != nil {
return nil, err
}
var failed []Failure
linted := false
for _, tg := range targets {
sources, err := typeScriptFiles(tg.dir)
if err != nil {
return nil, err
}
if len(sources) == 0 {
continue
}
linted = true
if err := m.provide(root); err != nil {
return nil, fmt.Errorf("providing the toolchain's packages to the workspace: %w", err)
}
r := m.runIn(ctx, root, false, tg.dir, nil, "node", m.typeCheck(tg.dir, sources)...)
if r.Err != "" {
return nil, fmt.Errorf("type-check could not be run: status %d %s: %s", r.Status, r.Err, firstLine(r.Stderr))
}
if r.Status != 0 {
failed = append(failed, testFailures(tg.where, "type-check", tg.dir, r, "")...)
}
}
return steprun.LintAnswer{Failed: failed, Nothing: !linted}, nil
}
// A-489b: Has says whether this node has a need a package's tests name (sdkstep.AskNeeds): the need node-build-node is this module's own
// (a TypeScript package's tests run through it); any other it lacks.
func (m *Module) Has(need string) bool { return need == sdkstep.NeedNodeBuildNode }
@@ -34,6 +34,9 @@ type Module struct {
// puller's ask-taken, step-progress and step-ended (design 47 G §496, §602). // puller's ask-taken, step-progress and step-ended (design 47 G §496, §602).
SayEvent func(subject string, body any, id string) error SayEvent func(subject string, body any, id string) error
// SayStep says a pipeline step's end (steprun.AskSteps.SayStep); the seat's publish on this node when nil (a test's own).
SayStep func(sdkstep.StepEnded) error
Node string Node string
// Recipe is the recipe in force. Reload, when set, reads it again at every check (the lock file the mesh // Recipe is the recipe in force. Reload, when set, reads it again at every check (the lock file the mesh
// writes can change under a running module); a failure to read it is a refusal. // writes can change under a running module); a failure to read it is a refusal.