From 1d8839640efa86e796d4eb482f33e403b8002485 Mon Sep 17 00:00:00 2001 From: jochen Date: Sun, 22 Nov 2026 01:19:00 +0100 Subject: [PATCH] BM4b: the build modules keep an oversized end in steps-objects, read by the verb answer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The delivery SDK replaced the output chunks with the verb answer over the steps state's objects and output at form 2: each build module keeps an end over the steps state's value with KeepAnswerIn, serves AnswerTool and OutputTool over its steps state, and its steps name their outputs objects. Builds: design 47 H2 §791, H-A-412 addendum, H-A-412 second addendum (b), H-A-399 (1) --- modules/mesh-build-go/cmd/mesh-build-go/asks.go | 16 ++++++++++++++-- .../mesh-build-go/cmd/mesh-build-go/asks_test.go | 2 +- modules/mesh-build-go/cmd/mesh-build-go/main.go | 2 +- .../mesh-build-go/cmd/mesh-build-go/module.go | 6 +++++- modules/mesh-build-go/module.json | 3 ++- .../cmd/mesh-build-image/asks.go | 16 ++++++++++++++-- .../cmd/mesh-build-image/main.go | 2 +- .../cmd/mesh-build-image/manifest_test.go | 2 +- .../cmd/mesh-build-image/module.go | 6 +++++- modules/mesh-build-image/module.json | 2 +- .../mesh-build-node/cmd/mesh-build-node/asks.go | 16 ++++++++++++++-- .../mesh-build-node/cmd/mesh-build-node/main.go | 2 +- .../cmd/mesh-build-node/manifest_test.go | 2 +- .../cmd/mesh-build-node/module.go | 6 +++++- modules/mesh-build-node/module.json | 2 +- 15 files changed, 67 insertions(+), 18 deletions(-) diff --git a/modules/mesh-build-go/cmd/mesh-build-go/asks.go b/modules/mesh-build-go/cmd/mesh-build-go/asks.go index 7d8315498..7b07ee9e9 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/asks.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/asks.go @@ -10,6 +10,7 @@ import ( sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" stdio "git.novox.be/novox/mesh-sdk/go" + "git.novox.be/novox/mesh-sdk/go/busstate" ) // **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6, ADR 0536 §4; issue 1887 A3go). It holds the seat @@ -50,9 +51,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps { Lint: m.lintStep, Node: m.Node, SayStep: m.sayStep(), + Outputs: m.outputs(), } } +// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791, +// §820): Outputs when a test sets it, else the module's own objects store on the bus. +func (m *Module) outputs() steprun.OutputObjects { + if m.Outputs != nil { + return m.Outputs + } + return busstate.ObjectsOf(steprun.OutputsStore) +} + // 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 { if source == nil { @@ -88,7 +99,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul if m.SayEvent != nil { say = steprun.SayOn(sdkstep.AskGo, m.Node, m.SayEvent) } - return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskGo, Say: say, 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, + return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskGo, Say: say, 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, Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { if err := m.Check(ctx); err != nil { @@ -109,7 +120,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul // SeatTools are the seat's verbs on this node (ADR 0525 §10): what it runs, and its pause and resume. func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool { - return append(steprun.SeatTools(Seat, "Go", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) + return append(steprun.SeatTools(Seat, "Go", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)), + steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers))) } // StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes. diff --git a/modules/mesh-build-go/cmd/mesh-build-go/asks_test.go b/modules/mesh-build-go/cmd/mesh-build-go/asks_test.go index 88542ab6b..955b8925a 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/asks_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/asks_test.go @@ -142,7 +142,7 @@ func mustJSON(v any) []byte { b, _ := json.Marshal(v); return b } // the node's build capacity as a setting, with the builder's default; the seat's verbs are served as its tools. func TestManifestClaimsTheGoBuildSeatAndReadsItsCapacity(t *testing.T) { m := readManifest(t) - if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) { + if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) { t.Fatalf("claims = %+v", m.Claims) } if len(m.Reads) != 0 { diff --git a/modules/mesh-build-go/cmd/mesh-build-go/main.go b/modules/mesh-build-go/cmd/mesh-build-go/main.go index 79a538789..9566774a1 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/main.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/main.go @@ -70,7 +70,7 @@ func main() { m.ReadEntry = askEntry m.AskInput = stdio.Ask m.KeptBuilds = busstate.ObjectsOf(KeptBuildsStore) - m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) + m.Answers = busstate.ObjectsOf(steprun.AnswersStore) m.Self = strings.TrimSpace(os.Getenv("MESH_MODULE")) m.Probe = ProbeGo(m.Home, m.Cache) m.Bubblewrap = ProbeBubblewrap diff --git a/modules/mesh-build-go/cmd/mesh-build-go/module.go b/modules/mesh-build-go/cmd/mesh-build-go/module.go index 7e67a8b1b..150ab04e5 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/module.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/module.go @@ -124,7 +124,11 @@ type Module struct { // KeptBuilds is the object store of the builds kept for the artifact store's holder (keptbuilds.go); nil keeps none. // Self is this module's name as the runtime launched it (MESH_MODULE), the first part of the store's name on the bus. KeptBuilds KeptObjects - // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + // Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended + // carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none. + Answers steprun.OutputObjects + // Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output + // reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own. Outputs steprun.OutputObjects Self string diff --git a/modules/mesh-build-go/module.json b/modules/mesh-build-go/module.json index 3198c8f59..4cebbdd0f 100644 --- a/modules/mesh-build-go/module.json +++ b/modules/mesh-build-go/module.json @@ -28,7 +28,8 @@ "resume", "steps", "kept-artifact", - "output" + "output", + "answer" ] } ], diff --git a/modules/mesh-build-image/cmd/mesh-build-image/asks.go b/modules/mesh-build-image/cmd/mesh-build-image/asks.go index 30ade441c..3c0c74a48 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/asks.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/asks.go @@ -9,6 +9,7 @@ import ( sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" stdio "git.novox.be/novox/mesh-sdk/go" + "git.novox.be/novox/mesh-sdk/go/busstate" ) // **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6; issue 1887 A3image), as mesh-build-go does: the seat @@ -33,9 +34,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps { Logf: m.Say, Node: m.Node, SayStep: m.sayStep(), + Outputs: m.outputs(), } } +// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791, +// §820): Outputs when a test sets it, else the module's own objects store on the bus. +func (m *Module) outputs() steprun.OutputObjects { + if m.Outputs != nil { + return m.Outputs + } + return busstate.ObjectsOf(steprun.OutputsStore) +} + // 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 { @@ -77,7 +88,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul if m.SayEvent != nil { say = steprun.SayOn(sdkstep.AskImage, m.Node, m.SayEvent) } - return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskImage, Say: say, 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, + return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskImage, Say: say, 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, Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { if err := m.Check(ctx); err != nil { @@ -92,7 +103,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul // SeatTools are the seat's verbs on this node (ADR 0525 §10). func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool { - return append(steprun.SeatTools(Seat, "image", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) + return append(steprun.SeatTools(Seat, "image", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)), + steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers))) } // StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes. diff --git a/modules/mesh-build-image/cmd/mesh-build-image/main.go b/modules/mesh-build-image/cmd/mesh-build-image/main.go index 61b05a9c8..f9bbd7227 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/main.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/main.go @@ -67,7 +67,7 @@ func main() { logf("announcing the states it keeps: %v", err) os.Exit(1) } - m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) + m.Answers = busstate.ObjectsOf(steprun.AnswersStore) steps := m.StepTools() booted := time.Now() puller := m.Puller(steps, nil) diff --git a/modules/mesh-build-image/cmd/mesh-build-image/manifest_test.go b/modules/mesh-build-image/cmd/mesh-build-image/manifest_test.go index a2f8be6c7..6c3966f78 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/manifest_test.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/manifest_test.go @@ -136,7 +136,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes if want := []string{"keys", MirrorWaitsState, "pauses"}; !slices.Equal(states, want) { t.Errorf("state = %v, want %v", states, want) } - if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) { + if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) { t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat) } raw, _ := os.ReadFile(filepath.Join(moduleDir, "module.json")) diff --git a/modules/mesh-build-image/cmd/mesh-build-image/module.go b/modules/mesh-build-image/cmd/mesh-build-image/module.go index a5679adca..2e24457e7 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/module.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/module.go @@ -20,7 +20,11 @@ const CheckRound = 10 * time.Minute // Module is the image build module's one running state. type Module struct { - // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + // Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended + // carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none. + Answers steprun.OutputObjects + // Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output + // reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own. Outputs steprun.OutputObjects // 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). diff --git a/modules/mesh-build-image/module.json b/modules/mesh-build-image/module.json index 6f99328dc..219d31c34 100644 --- a/modules/mesh-build-image/module.json +++ b/modules/mesh-build-image/module.json @@ -21,7 +21,7 @@ { "name": "node-build-image", "scope": "node", - "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"] + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"] } ], "config": { diff --git a/modules/mesh-build-node/cmd/mesh-build-node/asks.go b/modules/mesh-build-node/cmd/mesh-build-node/asks.go index dc864e5e6..ddcf77176 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/asks.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/asks.go @@ -10,6 +10,7 @@ import ( sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" stdio "git.novox.be/novox/mesh-sdk/go" + "git.novox.be/novox/mesh-sdk/go/busstate" ) // **The module pulls its seat's asks** (novox/hq ADR 0525 §2-§6, ADR 0536 §4; issue 1887 A3node), as mesh-build-go @@ -45,9 +46,19 @@ func (m *Module) askSteps(steps []StepTool) steprun.AskSteps { Lint: m.lintStep, Node: m.Node, SayStep: m.sayStep(), + Outputs: m.outputs(), } } +// outputs are the outputs objects a test step keeps its run's output in and the verb output reads (design 47 H2 §791, +// §820): Outputs when a test sets it, else the module's own objects store on the bus. +func (m *Module) outputs() steprun.OutputObjects { + if m.Outputs != nil { + return m.Outputs + } + return busstate.ObjectsOf(steprun.OutputsStore) +} + // 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 { @@ -89,7 +100,7 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul if m.SayEvent != nil { say = steprun.SayOn(sdkstep.AskNode, m.Node, m.SayEvent) } - return &steprun.Puller{KeepOutput: steprun.KeepOutputIn(m.Outputs), Source: source, Language: sdkstep.AskNode, Say: say, 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, + return &steprun.Puller{KeepAnswer: steprun.KeepAnswerIn(m.Answers), Source: source, Language: sdkstep.AskNode, Say: say, 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, Run: func(ctx context.Context, a sdkstep.StepAsk) (any, error) { if err := m.Prepare(ctx); err != nil { @@ -104,7 +115,8 @@ func (m *Module) Puller(steps []StepTool, source steprun.AskSource) *steprun.Pul // SeatTools are the seat's verbs on this node (ADR 0525 §10). func (m *Module) SeatTools(p *steprun.Puller) []stdio.Tool { - return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) + return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, m.Node, m.outputs(), steprun.EndedHere(m.Node, m.ReadSteps.Keys, m.ReadSteps.Get)), + steprun.AnswerTool(Seat, steprun.ReadAnswerFrom(m.Answers))) } // StepEndTool ends one step left running (issue 1890); the module's steps state is the one it reads and writes. diff --git a/modules/mesh-build-node/cmd/mesh-build-node/main.go b/modules/mesh-build-node/cmd/mesh-build-node/main.go index 92a9ca911..b41d596b0 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/main.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/main.go @@ -79,7 +79,7 @@ func main() { logf("announcing the states it keeps: %v", err) os.Exit(1) } - m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) + m.Answers = busstate.ObjectsOf(steprun.AnswersStore) steps := m.StepTools() booted := time.Now() puller := m.Puller(steps, nil) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/manifest_test.go b/modules/mesh-build-node/cmd/mesh-build-node/manifest_test.go index 6640f55a9..7372c3eaf 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/manifest_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/manifest_test.go @@ -118,7 +118,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes if want := []string{"keys", "pauses", "toolchains"}; !slices.Equal(states, want) { t.Errorf("state = %v, want %v", states, want) } - if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output"}) { + if len(m.Claims) != 1 || m.Claims[0].Name != Seat || !slices.Equal(m.Claims[0].Serves, []string{"current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"}) { t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat) } if !slices.Contains(m.Tools, HealthTool) { diff --git a/modules/mesh-build-node/cmd/mesh-build-node/module.go b/modules/mesh-build-node/cmd/mesh-build-node/module.go index ac30b5810..b121d41fd 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/module.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/module.go @@ -25,7 +25,11 @@ const CheckRound = 10 * time.Minute // Module is the Node build module's one running state: the node it runs on, its recipe, the toolchain guard, the // toolchain directory and the states it writes (toolchains, steps). type Module struct { - // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + // Answers is the steps state's objects (steprun.AnswersStore), where a step's end over what its key or step-ended + // carries is kept and the seat's verb answer reads it (design 47 H2 H-A-412 addendum); nil keeps none. + Answers steprun.OutputObjects + // Outputs are the outputs objects (steprun.OutputsStore) a test step keeps a run's output in, which the verb output + // reads (design 47 H2 §791); nil is the module's own on the bus (outputs), a test sets its own. Outputs steprun.OutputObjects // SayEvent publishes an event of the node 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). diff --git a/modules/mesh-build-node/module.json b/modules/mesh-build-node/module.json index 994095fa2..fdef48552 100644 --- a/modules/mesh-build-node/module.json +++ b/modules/mesh-build-node/module.json @@ -21,7 +21,7 @@ { "name": "node-build-node", "scope": "node", - "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"] + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output", "answer"] } ], "consumes": [