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 a54618ce4..2e17a639b 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,14 +151,17 @@ 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, in the steps state's objects store (design 47 G A-254, A-313). - outputs := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} + // steps: a step's end over what step-ended carries inline, in the steps state's objects store (design 47 G A-254, A-313; + // H2 H-A-412 addendum), read by the verb answer. + steps := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} + // outputs: a run's test output, read by the verb output (design 47 H2 §791, §820: 1 GiB, 7 days). + outputs := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(1024), "max-age-days": float64(7)}} 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{outputs, detected, kept, "artifact-store", "forge-account", "go-toolchain", "go-package-registry", "node-tools", findings, findingEvents}; !reflect.DeepEqual(m.Requires, want) { + if want := []any{steps, detected, outputs, kept, "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/kit_test.go b/modules/mesh-build-go/cmd/mesh-build-go/kit_test.go index 3f1962c7d..fc8ed61e9 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 @@ -3,14 +3,17 @@ package main import ( "context" "encoding/json" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" - "git.novox.be/novox/mesh-sdk/go/forgekey" + "errors" "os" "path/filepath" "strings" "testing" "time" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" + "git.novox.be/novox/mesh-sdk/go/buscalls" + "git.novox.be/novox/mesh-sdk/go/forgekey" + buildrun "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildrun" sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun/conformance" @@ -87,6 +90,26 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { // 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)) + // Design 47 H2 §791, §801, H-A-412, H-A-421: the seat's verbs current, output and answer keep the build-step part's form 2, + // and a pipeline step's run output is kept in the module's outputs objects and read back through output. + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }, Outputs: kitObjects{}} + conformance.SeatVerbs(t, Seat, m.SeatTools(m.Puller(nil, steprun.NewFakeAsks())), m.askSteps(nil)) +} + +// kitObjects is an outputs store in memory, for the kit's SeatVerbs. +type kitObjects map[string][]byte + +func (k kitObjects) Put(name string, data []byte, _ string) (buscalls.ObjectInfo, error) { + k[name] = data + return buscalls.ObjectInfo{Name: name}, nil +} + +func (k kitObjects) Get(name string) (buscalls.ObjectData, error) { + d, ok := k[name] + if !ok { + return buscalls.ObjectData{}, errors.New("object not found") + } + return buscalls.ObjectData{Data: d}, 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 diff --git a/modules/mesh-build-go/cmd/mesh-build-go/levels.go b/modules/mesh-build-go/cmd/mesh-build-go/levels.go index 2d702ec0d..d002de777 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/levels.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/levels.go @@ -6,6 +6,7 @@ package main // step that could not run. import ( + "encoding/json" "fmt" "sort" "strings" @@ -63,6 +64,10 @@ type TestResult struct { // §800, H-A-294): counted apart from passed and failed, they leave the level passing, listed here, where the delivery // SDK's test step reads them into the step's end. NotRun []sdkstep.NotRun `json:"not-run,omitempty"` + // Output is the level's text (design 47 H2 §791, H-A-412 second addendum (a)): the Output lines of test2json, of + // every go.mod directory in the order they were tested. The delivery SDK's step run takes it out of the answer and + // keeps it as the run's output in the outputs objects; it is never part of a check's answer. + Output string `json:"output,omitempty"` // Store and Bus are what the integration level ran against: the postgres major version and the nats-server // version (ADR 0470 §4). // OverBound says a bound was kept no longer, and OverWhich which: setup, run or both. The level's verdict, Passed, is @@ -82,6 +87,21 @@ type TestResult struct { By string `json:"by,omitempty"` } +// goTestText is the text of `go test -json`'s output out: the Output of each of its events, in order (H-A-412 (a)); a line +// that is no event is none of it. +func goTestText(out string) string { + var text strings.Builder + for line := range strings.Lines(out) { + var ev struct { + Output string `json:"Output"` + } + if json.Unmarshal([]byte(line), &ev) == nil { + text.WriteString(ev.Output) + } + } + return text.String() +} + // readGoTest reads one go.mod directory's `go test -json` into res through the SDK's reader (issue 1901: one failure // contract for every build module, sdkstep.Failure), and answers the lines that were no event and how many packages // it named. diff --git a/modules/mesh-build-go/cmd/mesh-build-go/test.go b/modules/mesh-build-go/cmd/mesh-build-go/test.go index 0b7a0e0fc..543dd5222 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/test.go @@ -284,6 +284,7 @@ func (m *Module) runLevel(ctx context.Context, tree string, o levelOpts) (*TestR r runAnswer noise []string packages int + text string } var todo []string for _, d := range dirs { @@ -321,6 +322,7 @@ func (m *Module) runLevel(ctx context.Context, tree string, o levelOpts) (*TestR dr.res = &TestResult{} dr.r = run(ctx, append(append(m.goEnvFor(filepath.Join(tree, d)), o.env...), levelBoundEnv(o.bounds)...), "go", args...) dr.noise, dr.packages = readGoTest(dr.res, d, dr.r.Stdout) + dr.text = goTestText(dr.r.Stdout) }() } wg.Wait() @@ -339,6 +341,7 @@ func (m *Module) runLevel(ctx context.Context, tree string, o levelOpts) (*TestR res.NotRun = append(res.NotRun, dr.res.NotRun...) res.Packages = append(res.Packages, dr.res.Packages...) res.Slowest = append(res.Slowest, dr.res.Slowest...) + res.Output += dr.text if dr.res.Elapsed > res.Elapsed { res.Elapsed = dr.res.Elapsed } diff --git a/modules/mesh-build-go/cmd/mesh-build-go/test_test.go b/modules/mesh-build-go/cmd/mesh-build-go/test_test.go index afbded703..b3fe63370 100644 --- a/modules/mesh-build-go/cmd/mesh-build-go/test_test.go +++ b/modules/mesh-build-go/cmd/mesh-build-go/test_test.go @@ -110,6 +110,10 @@ func TestUnitLevelNamesTheFailingTestAndFailsTheLevel(t *testing.T) { if st.State != sdkstep.StepPassed || !res.Passed || !slices.Equal(res.NotRun, want) { t.Errorf("step %s, passed %v, not run %+v; want the level passing with not run %+v", st.State, res.Passed, res.NotRun, want) } + // Design 47 H2 §791, H-A-412 (a): the level's answer carries its text in output, test2json's Output lines in order. + if !strings.HasPrefix(res.Output, "=== RUN TestTwo\n--- PASS: TestTwo (0.00s)\n") || !strings.Contains(res.Output, "NOT RUN: npm is not on this node") || strings.Contains(res.Output, `"Action"`) { + t.Errorf("the level's output is %q, want test2json's Output lines", res.Output) + } } // Issue 1921: a fixture with a failing test in each of two packages: one level's run names both, each with its own diff --git a/modules/mesh-build-go/module.json b/modules/mesh-build-go/module.json index 4cebbdd0f..9714631ce 100644 --- a/modules/mesh-build-go/module.json +++ b/modules/mesh-build-go/module.json @@ -111,6 +111,15 @@ "history": 1 } }, + { + "name": "outputs", + "storage": "object-store", + "template": "objects", + "options": { + "max-mib": 1024, + "max-age-days": 7 + } + }, { "name": "kept-builds", "storage": "object-store", 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 7e37eedc5..0e188a830 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,9 +145,11 @@ func TestForgeFilesRenderFromTheBoundValuesInTheModulesOwnHome(t *testing.T) { // template in the files/ archive (novox/hq ADR 0349 §2). func TestManifestRequiresForgeAccountKeepsKeysAndTakesFilesFromTemplates(t *testing.T) { m := readForgeManifest(t) - // outputs: a run's answer over what step-ended carries inline, in the steps state's objects store (design 47 G A-254, A-313). - outputs := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} - if want := []any{outputs, "forge-account", "rootless-image-build", "node-tools"}; !reflect.DeepEqual(m.Requires, want) { + // steps: a step's end over what step-ended carries inline, in the steps state's objects store (design 47 G A-254, A-313). + steps := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} + // outputs: a run's test output, read by the verb output (design 47 H2 §791, §820: 1 GiB, 7 days). + outputs := map[string]any{"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(1024), "max-age-days": float64(7)}} + if want := []any{steps, 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/kit_test.go b/modules/mesh-build-image/cmd/mesh-build-image/kit_test.go index d151dcf28..4fde49f59 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 @@ -4,15 +4,17 @@ 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" - "git.novox.be/novox/mesh-sdk/go/forgekey" "os" "path/filepath" "strings" "testing" "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-sdk/go/buscalls" + "git.novox.be/novox/mesh-sdk/go/forgekey" + buildrun "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildrun" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun/conformance" ) @@ -76,6 +78,26 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { // 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)) + // Design 47 H2 §791, §801, H-A-412, H-A-421: the seat's verbs current, output and answer keep the build-step part's form 2, + // and a pipeline step's run output is kept in the module's outputs objects and read back through output. + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }, Outputs: kitObjects{}} + conformance.SeatVerbs(t, Seat, m.SeatTools(m.Puller(nil, steprun.NewFakeAsks())), m.askSteps(nil)) +} + +// kitObjects is an outputs store in memory, for the kit's SeatVerbs. +type kitObjects map[string][]byte + +func (k kitObjects) Put(name string, data []byte, _ string) (buscalls.ObjectInfo, error) { + k[name] = data + return buscalls.ObjectInfo{Name: name}, nil +} + +func (k kitObjects) Get(name string) (buscalls.ObjectData, error) { + d, ok := k[name] + if !ok { + return buscalls.ObjectData{}, errors.New("object not found") + } + return buscalls.ObjectData{Data: d}, 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 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 6c3966f78..d345b6396 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 @@ -223,8 +223,9 @@ func TestTheModuleRequiresNodeToolsItPullsThrough(t *testing.T) { } } -// Design 47 G A-254, A-313, A-314: the module keeps a run's answer over what step-ended carries inline in the steps state's own -// objects store, sized in `requires` by the state option objects-max-mib, and serves it through the verb output. +// Design 47 G A-254, A-313, A-314: the module keeps a step's end over what step-ended carries inline in the steps state's own +// objects store, sized in `requires` by the state option objects-max-mib, and serves it through the verb answer (H2 H-A-412 +// addendum); and a run's test output in its outputs objects, 1 GiB kept 7 days, read by the verb output (H2 §791, §820). func TestManifestRequiresTheStepsStateWithItsObjectsStore(t *testing.T) { raw, err := os.ReadFile(moduleDir + "/module.json") if err != nil { @@ -236,11 +237,12 @@ func TestManifestRequiresTheStepsStateWithItsObjectsStore(t *testing.T) { if err := json.Unmarshal(raw, &doc); err != nil { t.Fatal(err) } - want := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} - for _, r := range doc.Requires { - if reflect.DeepEqual(r, want) { - return + for _, want := range []map[string]any{ + {"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(1024), "max-age-days": float64(7)}}, + } { + if !slices.ContainsFunc(doc.Requires, func(r any) bool { return reflect.DeepEqual(r, any(want)) }) { + t.Errorf("requires %v lack %v", doc.Requires, want) } } - t.Errorf("requires %v lack %v", doc.Requires, want) } diff --git a/modules/mesh-build-image/module.json b/modules/mesh-build-image/module.json index 219d31c34..ae2a83de5 100644 --- a/modules/mesh-build-image/module.json +++ b/modules/mesh-build-image/module.json @@ -65,6 +65,7 @@ ], "requires": [ {"name": "steps", "storage": "key-value", "template": "state", "options": {"ttl-seconds": 172800, "objects-max-mib": 256}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 1024, "max-age-days": 7}}, "forge-account", "rootless-image-build", "node-tools" diff --git a/modules/mesh-build-node/cmd/mesh-build-node/check.go b/modules/mesh-build-node/cmd/mesh-build-node/check.go index 4f0b5b244..8f4a6ec57 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/check.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/check.go @@ -75,6 +75,10 @@ type TestResult struct { // By is the build module and the SDK it was built with (sdkstep.By): the checker names it when a failure hides // its cause. By string `json:"by,omitempty"` + // Output is the level's text (design 47 H2 §791, H-A-412 second addendum (a)): what each command the level ran wrote, + // its stdout then its stderr, in the order they ran. The delivery SDK's step run takes it out of the answer and keeps + // it as the run's output in the outputs objects; it is never part of a check's answer. + Output string `json:"output,omitempty"` // OutOfStep are the generated TypeScript files of a contracts module out of step with the seat generator (CAT-BN2, // steprun.OutOfStep): the unit level fails on any, Why naming each. Absent when none is. OutOfStep []string `json:"out-of-step,omitempty"` @@ -156,6 +160,7 @@ func (m *Module) testLevel(ctx context.Context, args map[string]any) (*TestResul } var check, run time.Duration var failed []Failure + var text strings.Builder tested := false for _, tg := range targets { scripts, err := packageScripts(tg.dir) @@ -176,6 +181,8 @@ func (m *Module) testLevel(ctx context.Context, args map[string]any) (*TestResul } // a command that could not start is not a verdict: the step fails. One that ran and said no is. ran := func(name string, r forgekey.Ran, report string) error { + text.WriteString(r.Stdout) + text.WriteString(r.Stderr) if r.Err != "" { return fmt.Errorf("%s could not be run: status %d %s: %s", name, r.Status, r.Err, firstLine(r.Stderr)) } @@ -225,7 +232,7 @@ func (m *Module) testLevel(ctx context.Context, args map[string]any) (*TestResul } return res, nil } - res.Failed = failed + res.Failed, res.Output = failed, text.String() var why []string for _, f := range failed { why = append(why, failureWhy(f)) diff --git a/modules/mesh-build-node/cmd/mesh-build-node/check_test.go b/modules/mesh-build-node/cmd/mesh-build-node/check_test.go index ca66028cf..144e38a0f 100644 --- a/modules/mesh-build-node/cmd/mesh-build-node/check_test.go +++ b/modules/mesh-build-node/cmd/mesh-build-node/check_test.go @@ -111,6 +111,7 @@ func TestTheIntegrationLevelRunsItsScriptAndReportsSetupAndRunningApart(t *testi workspaceWith(t, work, map[string]string{"index.ts": `export const a = 1;`, "tsconfig.json": `{}`, "package.json": `{"scripts":{"test":"x","test:integration":"node --test int"}}`}) f.cost["tsc"], f.cost["npm"] = 2*time.Second, 40*time.Second + f.answer["npm"] = forgekey.Ran{Stdout: "ok 1 - joins\n", Stderr: "(node) warning\n"} out, err := m.test(context.Background(), testArgs("integration")) if err != nil { t.Fatal(err) @@ -127,6 +128,10 @@ func TestTheIntegrationLevelRunsItsScriptAndReportsSetupAndRunningApart(t *testi if !slices.Contains(last.env, "MESH_TEST_LEVEL_BOUND=1m0s") { t.Errorf("the integration script ran with %v, not the level's bound MESH_TEST_LEVEL_BOUND=1m0s", last.env) } + // Design 47 H2 §791, H-A-412 (a): the level's answer carries its text in output, what its commands wrote. + if !strings.HasSuffix(r.Output, "ok 1 - joins\n(node) warning\n") { + t.Errorf("the level's output is %q, want the script's stdout then its stderr", r.Output) + } if tsc := f.calls[0]; strings.Join(tsc.args[1:], " ") != "--noEmit -p ." { t.Errorf("a package with a tsconfig was checked with %s", joined(tsc)) } 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 68d5e34a3..ddadfe488 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 @@ -3,13 +3,16 @@ package main import ( "context" "encoding/json" - "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" + "errors" "os" "path/filepath" "strings" "testing" "time" + "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun" + "git.novox.be/novox/mesh-sdk/go/buscalls" + buildrun "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildrun" sdkstep "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/buildstep" "git.novox.be/novox/mesh-delivery/modules/mesh-delivery-sdk/steprun/conformance" @@ -81,6 +84,26 @@ func TestTheStepsSayAFailedNetworkAsATransportFault(t *testing.T) { // 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)) + // Design 47 H2 §791, §801, H-A-412, H-A-421: the seat's verbs current, output and answer keep the build-step part's form 2, + // and a pipeline step's run output is kept in the module's outputs objects and read back through output. + m := &Module{Node: "kitnode", Capacity: func() int { return 1 }, Outputs: kitObjects{}} + conformance.SeatVerbs(t, Seat, m.SeatTools(m.Puller(nil, steprun.NewFakeAsks())), m.askSteps(nil)) +} + +// kitObjects is an outputs store in memory, for the kit's SeatVerbs. +type kitObjects map[string][]byte + +func (k kitObjects) Put(name string, data []byte, _ string) (buscalls.ObjectInfo, error) { + k[name] = data + return buscalls.ObjectInfo{Name: name}, nil +} + +func (k kitObjects) Get(name string) (buscalls.ObjectData, error) { + d, ok := k[name] + if !ok { + return buscalls.ObjectData{}, errors.New("object not found") + } + return buscalls.ObjectData{Data: d}, 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 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 7372c3eaf..91fb3ac2b 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 @@ -290,8 +290,9 @@ func TestTheModuleRequiresNodeToolsItPullsThrough(t *testing.T) { } } -// Design 47 G A-254, A-313, A-314: the module keeps a run's answer over what step-ended carries inline in the steps state's own -// objects store, sized in `requires` by the state option objects-max-mib, and serves it through the verb output. +// Design 47 G A-254, A-313, A-314: the module keeps a step's end over what step-ended carries inline in the steps state's own +// objects store, sized in `requires` by the state option objects-max-mib, and serves it through the verb answer (H2 H-A-412 +// addendum); and a run's test output in its outputs objects, 1 GiB kept 7 days, read by the verb output (H2 §791, §820). func TestManifestRequiresTheStepsStateWithItsObjectsStore(t *testing.T) { raw, err := os.ReadFile(moduleDir + "/module.json") if err != nil { @@ -303,11 +304,12 @@ func TestManifestRequiresTheStepsStateWithItsObjectsStore(t *testing.T) { if err := json.Unmarshal(raw, &doc); err != nil { t.Fatal(err) } - want := map[string]any{"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}} - for _, r := range doc.Requires { - if reflect.DeepEqual(r, want) { - return + for _, want := range []map[string]any{ + {"name": "steps", "storage": "key-value", "template": "state", "options": map[string]any{"ttl-seconds": float64(172800), "objects-max-mib": float64(256)}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": map[string]any{"max-mib": float64(1024), "max-age-days": float64(7)}}, + } { + if !slices.ContainsFunc(doc.Requires, func(r any) bool { return reflect.DeepEqual(r, any(want)) }) { + t.Errorf("requires %v lack %v", doc.Requires, want) } } - t.Errorf("requires %v lack %v", doc.Requires, want) } diff --git a/modules/mesh-build-node/module.json b/modules/mesh-build-node/module.json index fdef48552..e998f5ed2 100644 --- a/modules/mesh-build-node/module.json +++ b/modules/mesh-build-node/module.json @@ -70,6 +70,7 @@ "requires": [ {"name": "steps", "storage": "key-value", "template": "state", "options": {"ttl-seconds": 172800, "objects-max-mib": 256}}, {"name": "detected-steps", "storage": "key-value", "template": "state", "options": {"history": 1}}, + {"name": "outputs", "storage": "object-store", "template": "objects", "options": {"max-mib": 1024, "max-age-days": 7}}, "artifact-store", "forge-account", "npm-package-registry",