From 333e3c21a5e115b5a1435b5e46c2f2e9632c6870 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 12 Nov 2026 09:39:54 +0100 Subject: [PATCH] C1c-2b: the three build modules keep a run's answer in an outputs store and serve the verb output Each module's puller keeps an answer over what step-ended carries inline in the object store `outputs` its manifest requires (template objects, 256 MiB) and its tools serve `.output` from it; the manifest claims the verb. Builds: design 47 G A-254, A-257 Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h --- .../mesh-build-go/cmd/mesh-build-go/asks.go | 4 +-- .../cmd/mesh-build-go/asks_test.go | 2 +- .../cmd/mesh-build-go/forge_test.go | 4 ++- .../mesh-build-go/cmd/mesh-build-go/main.go | 2 ++ .../mesh-build-go/cmd/mesh-build-go/module.go | 4 ++- modules/mesh-build-go/module.json | 11 +++++++- .../cmd/mesh-build-image/asks.go | 4 +-- .../cmd/mesh-build-image/compose_test.go | 4 +-- .../cmd/mesh-build-image/forge_test.go | 4 ++- .../cmd/mesh-build-image/main.go | 3 +++ .../cmd/mesh-build-image/manifest_test.go | 25 ++++++++++++++++++- .../cmd/mesh-build-image/module.go | 2 ++ modules/mesh-build-image/module.json | 3 ++- .../cmd/mesh-build-node/asks.go | 4 +-- .../cmd/mesh-build-node/main.go | 3 +++ .../cmd/mesh-build-node/manifest_test.go | 25 ++++++++++++++++++- .../cmd/mesh-build-node/module.go | 2 ++ modules/mesh-build-node/module.json | 3 ++- 18 files changed, 92 insertions(+), 17 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 8991c7b77..395f9193b 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/asks.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/asks.go @@ -91,7 +91,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{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, 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 { @@ -112,7 +112,7 @@ 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()) + return append(steprun.SeatTools(Seat, "Go", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) } // 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 f89a29619..e68553468 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 @@ -119,7 +119,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"}) { + 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"}) { t.Fatalf("claims = %+v", m.Claims) } if len(m.Reads) != 0 { diff --git a/modules/mesh-build-go/cmd/mesh-build-go/forge_test.go b/modules/mesh-build-go/cmd/mesh-build-go/forge_test.go index 2acdce793..51248bd7c 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/forge_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/forge_test.go @@ -151,12 +151,14 @@ func TestManifestRequiresForgeAccountKeepsKeysAndTakesFilesFromTemplates(t *test // detected-steps: the state of the verb steps (design 47 G §326, §414), asked by the template state. // kept-builds: the builds kept for the artifact store's holder (keptbuilds.go), by the template objects (W12.5). kept := map[string]any{"name": "kept-builds", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(1024)}} + // outputs: a run's answer over what step-ended carries inline, by the template objects (design 47 G A-254). + outputs := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(256)}} detected := map[string]any{"name": "detected-steps", "storage": "key-value", "template": "state", "options": map[string]any{"history": float64(1)}} // The findings are asked in requires as a part that is no foundation part asks them (design 47 G §529, A-30). findings := map[string]any{"name": "findings", "storage": "key-value", "template": "state"} findingEvents := map[string]any{"name": "finding-events", "storage": "stream", "template": "events", "options": map[string]any{ "events": []any{"finding-written.*", "finding-cleared.*", "findings-stated.*"}, "max-age-days": float64(7), "max-mib": float64(16)}} - if want := []any{detected, kept, "artifact-store", "forge-account", "go-toolchain", "go-package-registry", "node-tools", findings, findingEvents}; !reflect.DeepEqual(m.Requires, want) { + if want := []any{detected, kept, outputs, "artifact-store", "forge-account", "go-toolchain", "go-package-registry", "node-tools", findings, findingEvents}; !reflect.DeepEqual(m.Requires, want) { t.Errorf("requires = %v, want %v", m.Requires, want) } keeps := false 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 809b1317e..589e70156 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/main.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/main.go @@ -15,6 +15,7 @@ import ( seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildgo" 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" ) @@ -69,6 +70,7 @@ func main() { m.ReadManifest = askManifest m.AskInput = stdio.Ask m.KeptBuilds = busstate.ObjectsOf(KeptBuildsStore) + m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) 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 3b179c5e3..8ea1f0182 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/module.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/module.go @@ -126,7 +126,9 @@ 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 - Self string + // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + Outputs steprun.OutputObjects + Self string // SayToolchain says an event on a seat's subject (stdio.SeatPublish; nil says none, a test's); ToolchainProgram finds the go // program whose digest the toolchain's is (exec.LookPath when nil). diff --git a/modules/mesh-build-go/module.json b/modules/mesh-build-go/module.json index f70fc1b91..c73830420 100644 --- a/modules/mesh-build-go/module.json +++ b/modules/mesh-build-go/module.json @@ -31,7 +31,8 @@ "pause", "resume", "steps", - "kept-artifact" + "kept-artifact", + "output" ] } ], @@ -104,6 +105,14 @@ "max-mib": 1024 } }, + { + "name": "outputs", + "storage": "object-store", + "template": "objects", + "options": { + "max-mib": 256 + } + }, "artifact-store", "forge-account", "go-toolchain", 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 95ea231a4..7872621cb 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/asks.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/asks.go @@ -69,7 +69,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{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, 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 { @@ -84,7 +84,7 @@ 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()) + return append(steprun.SeatTools(Seat, "image", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) } // 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/compose_test.go b/modules/mesh-build-image/cmd/mesh-build-image/compose_test.go index 72a70ec14..827f5c85f 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/compose_test.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/compose_test.go @@ -15,7 +15,7 @@ import ( // what the mesh fills reaches its files). func TestTheModuleInvokesTheImageSeatAndHoldsNoRegistry(t *testing.T) { var m struct { - Requires []string `json:"requires"` + Requires []any `json:"requires"` Invokes []string `json:"invokes"` Consumes []string `json:"consumes"` } @@ -35,7 +35,7 @@ func TestTheModuleInvokesTheImageSeatAndHoldsNoRegistry(t *testing.T) { if !slices.Equal(m.Consumes, consumes) { t.Errorf("consumes = %v, want %v", m.Consumes, consumes) } - if slices.Contains(m.Requires, "artifact-store") { + if slices.Contains(m.Requires, any("artifact-store")) { t.Errorf("requires = %v: the module holds no store", m.Requires) } if _, err := os.Stat(filepath.Join(moduleDir, "files", "registry")); !os.IsNotExist(err) { diff --git a/modules/mesh-build-image/cmd/mesh-build-image/forge_test.go b/modules/mesh-build-image/cmd/mesh-build-image/forge_test.go index 553d1e616..dd0e4be71 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/forge_test.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/forge_test.go @@ -145,7 +145,9 @@ func TestForgeFilesRenderFromTheBoundValuesInTheModulesOwnHome(t *testing.T) { // template in the files/ archive (novox/hq ADR 0349 §2). func TestManifestRequiresForgeAccountKeepsKeysAndTakesFilesFromTemplates(t *testing.T) { m := readForgeManifest(t) - if want := []any{"forge-account", "rootless-image-build", "node-tools"}; !reflect.DeepEqual(m.Requires, want) { + // outputs: a run's answer over what step-ended carries inline, by the template objects (design 47 G A-254). + outputs := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(256)}} + if want := []any{outputs, "forge-account", "rootless-image-build", "node-tools"}; !reflect.DeepEqual(m.Requires, want) { t.Errorf("requires = %v, want %v", m.Requires, want) } keeps := false 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 a52d17d40..47a0bfd23 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/main.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/main.go @@ -17,7 +17,9 @@ import ( reg "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/containerimageregistry" seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildimage" 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 directories the module's manifest places outside its home (ADR 0466 §1): the workspaces, and buildah's image @@ -65,6 +67,7 @@ func main() { logf("announcing the states it keeps: %v", err) os.Exit(1) } + m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) 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 e4b6b3d4c..91fed199f 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 @@ -4,6 +4,7 @@ import ( "encoding/json" "os" "path/filepath" + "reflect" "regexp" "slices" "strings" @@ -125,7 +126,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes if want := []string{"keys", MirrorWaitsState, "pauses", "steps"}; !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"}) { + 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"}) { t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat) } raw, _ := os.ReadFile(filepath.Join(moduleDir, "module.json")) @@ -211,3 +212,25 @@ func TestTheModuleRequiresNodeToolsItPullsThrough(t *testing.T) { t.Errorf("requires %v lack node-tools", m.Requires) } } + +// Design 47 G A-254: the module keeps a run's answer over what step-ended carries inline in an object store of its own, asked for +// in `requires` by the template objects, and serves it through the verb output. +func TestManifestRequiresTheOutputsStore(t *testing.T) { + raw, err := os.ReadFile(moduleDir + "/module.json") + if err != nil { + t.Fatal(err) + } + var doc struct { + Requires []any `json:"requires"` + } + if err := json.Unmarshal(raw, &doc); err != nil { + t.Fatal(err) + } + want := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(256)}} + for _, r := range doc.Requires { + if reflect.DeepEqual(r, want) { + return + } + } + t.Errorf("requires %v lack %v", doc.Requires, want) +} 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 d1799f421..e8dca05dc 100644 --- a/modules/mesh-build-image/cmd/mesh-build-image/module.go +++ b/modules/mesh-build-image/cmd/mesh-build-image/module.go @@ -23,6 +23,8 @@ type Module struct { // Callers says which seats the build seat's definition lists as callers of an accepted kind (steprun.SeatListCallers when // the module pulls through its runtime; nil in a test checks no named asker): design 47 G §543, A-163. Callers func(kind string) ([]string, bool) + // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + 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). SayEvent func(subject string, body any, id string) error diff --git a/modules/mesh-build-image/module.json b/modules/mesh-build-image/module.json index 7fefa26e9..5eb0ee006 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"] + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"] } ], "config": { @@ -57,6 +57,7 @@ "build_image_health" ], "requires": [ + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 256}}, "forge-account", "rootless-image-build", "node-tools" 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 b2043f107..de769feeb 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/asks.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/asks.go @@ -79,7 +79,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{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, 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 { @@ -94,7 +94,7 @@ 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()) + return append(steprun.SeatTools(Seat, "Node", p), m.stepsTool(), m.keptArtifactVerb(), steprun.OutputTool(Seat, steprun.ReadOutputFrom(m.Outputs))) } // 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 26944e8b0..18752e4d7 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/main.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/main.go @@ -18,7 +18,9 @@ import ( seat "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-contracts/go/seats/nodebuildnode" sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" dforgekey "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/forgekey" + "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" ) // CacheDir is the cache directory, outside the account's home (ADR 0466 §1; module.json resource `cache`). @@ -77,6 +79,7 @@ func main() { logf("announcing the states it keeps: %v", err) os.Exit(1) } + m.Outputs = busstate.ObjectsOf(steprun.OutputsStore) 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 32b9b6681..11ea32d03 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 @@ -4,6 +4,7 @@ import ( "encoding/json" "os" "path/filepath" + "reflect" "regexp" "slices" "strings" @@ -117,7 +118,7 @@ func TestManifestKeepsItsStatesClaimsItsBuildSeatAndDeclaresItsHealthTool(t *tes if want := []string{"keys", "pauses", "steps", "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"}) { + 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"}) { t.Errorf("claims = %v, want the seat %s alone", m.Claims, Seat) } if !slices.Contains(m.Tools, HealthTool) { @@ -277,3 +278,25 @@ func TestTheModuleRequiresNodeToolsItPullsThrough(t *testing.T) { t.Errorf("requires %v lack node-tools", m.Requires) } } + +// Design 47 G A-254: the module keeps a run's answer over what step-ended carries inline in an object store of its own, asked for +// in `requires` by the template objects, and serves it through the verb output. +func TestManifestRequiresTheOutputsStore(t *testing.T) { + raw, err := os.ReadFile(moduleDir + "/module.json") + if err != nil { + t.Fatal(err) + } + var doc struct { + Requires []any `json:"requires"` + } + if err := json.Unmarshal(raw, &doc); err != nil { + t.Fatal(err) + } + want := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(256)}} + for _, r := range doc.Requires { + if reflect.DeepEqual(r, want) { + return + } + } + t.Errorf("requires %v lack %v", doc.Requires, want) +} 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 a5efcaab1..b21fbd131 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/module.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/module.go @@ -28,6 +28,8 @@ type Module struct { // Callers says which seats the build seat's definition lists as callers of an accepted kind (steprun.SeatListCallers when // the module pulls through its runtime; nil in a test checks no named asker): design 47 G §543, A-163. Callers func(kind string) ([]string, bool) + // Outputs is the object store of a run's answers over what step-ended carries inline (steprun.OutputsStore); nil keeps none. + 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). SayEvent func(subject string, body any, id string) error diff --git a/modules/mesh-build-node/module.json b/modules/mesh-build-node/module.json index 99da70e35..da27f0712 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"] + "serves": ["current", "drop", "pause", "resume", "steps", "kept-artifact", "output"] } ], "config": { @@ -58,6 +58,7 @@ ], "requires": [ {"name": "detected-steps", "storage": "key-value", "template": "state", "options": {"history": 1}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 256}}, "artifact-store", "forge-account", "npm-package-registry",