BM2b (sdk): a step's install archive reaches its test calls

The integration step's ask names the install archive; the step run carries
it on the check job it runs and hands it to every test call as its argument
archive, for the Go build module to unpack into the workspace.

Builds: design 47 H2 §800; H-A-367 (4), H-A-399 (1)
This commit is contained in:
2026-11-22 00:53:20 +01:00
parent 3fce8700bf
commit 592637e6d7
4 changed files with 20 additions and 1 deletions
@@ -373,6 +373,10 @@ type CheckJob struct {
// Toolchain is the toolchain the checker agreed for the language (ADR 0584 clause 2): a holder whose node reports
// another version declines the check.
Toolchain *ToolchainUsed `json:"toolchain,omitempty"`
// Archive is the install archive a pipeline step's ask names (StepRun.Archive, design 47 H2 §800), which the step run
// hands each test call as its argument archive for the build module to unpack into the workspace. A check ask names
// none, so it is no part of the ask's form.
Archive string `json:"-"`
}
// ComposeJob asks one compose-candidate build.
@@ -360,6 +360,9 @@ func (s AskSteps) level(ctx context.Context, job sdkstep.CheckJob, level string,
if len(job.NodeNames) > 0 {
args[sdkstep.NodeNamesArg] = job.NodeNames // the names check's (ADR 0567 §12)
}
if job.Archive != "" {
args["archive"] = job.Archive // the install archive the build module unpacks (design 47 H2 §800)
}
return args
}
test := func(args map[string]any) (bool, error) {
@@ -443,6 +443,7 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
run int // which run of the ask this is (the step's Run), 0 outside a puller
notRun []sdkstep.NotRun
saidOpen string // the end's said opens with these words
archive string // the step's install archive, which every test call names
}{
{name: "unit: the kept package carried, the other tested and kept", ask: stepOf(sdkstep.StepUnit, sdkstep.KeptResult{Package: "x/a", Digest: "d-a", Level: "unit"}),
digests: map[string]string{"x/a": "d-a", "x/b": "d-b"}, tests: map[string]bool{"x/b": true}, outcome: sdkstep.OutcomePassed, counts: 1, carried: []string{"x/a"}, kept: []string{"x/b"}},
@@ -469,6 +470,9 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
saidOpen: "the bus did not answer in setup within 5m0s under load"},
{name: "a starved setup beside an assertion: failed", ask: stepOf(sdkstep.StepIntegration), digests: map[string]string{"x/b": "d-b"}, run: 1, outcome: sdkstep.OutcomeFailed, counts: 2,
test: map[string]any{"passed": false, "tests": 2, "why": "2 failed", "failed": []sdkstep.Failure{{Package: "x/b", Test: "TestT", Cause: "mesh: setup starved: words"}, {Package: "x/b", Test: "TestU", Cause: "got 1, want 2"}}}},
// §800: the install archive the step names reaches the test calls, for the build module to unpack.
{name: "integration with an install archive: the test calls name it", ask: stepOf(sdkstep.StepIntegration), digests: map[string]string{"x/b": "d-b"}, tests: map[string]bool{"x/b": true},
outcome: sdkstep.OutcomePassed, counts: 1, kept: []string{"x/b"}, archive: "oci-artifact-registry://gitea/npm-tree:0.1.4"},
// §799: a fetch met away on the third run ends the step failed with its why.
{name: "a fetch fault's third run: failed, fetch:", ask: stepOf(sdkstep.StepUnit), run: 3, outcome: sdkstep.OutcomeFailed,
fetchErr: &sdkstep.Passing{Err: errors.New("fetch: git fetch: status 502")}, saidOpen: "fetch: git fetch"},
@@ -487,6 +491,9 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
if row.test != nil {
s.Test = func(context.Context, map[string]any) (any, error) { return row.test, nil }
}
if row.archive != "" {
row.ask.Step.Archive = row.archive
}
ctx := context.Background()
if row.run > 0 {
ctx = context.WithValue(ctx, phaseKey{}, &phases{step: sdkstep.Step{Run: row.run}})
@@ -536,6 +543,11 @@ func TestRunAskRunsAPipelineStepAndSaysItsEnd(t *testing.T) {
if _, err := sdkstep.EncodeStepEnded(e); err != nil {
t.Errorf("%s: the end does not encode: %v", row.name, err)
}
for _, c := range r.calls {
if strings.HasPrefix(c, "test ") && row.archive != "" && !strings.Contains(c, `"archive":"`+row.archive+`"`) {
t.Errorf("%s: the test call %s names no archive %s", row.name, c, row.archive)
}
}
if !slices.Equal(e.NotRun, row.notRun) || !strings.HasPrefix(e.Said, row.saidOpen) {
t.Errorf("%s: not run %+v said %q, want %+v and said opening %q", row.name, e.NotRun, e.Said, row.notRun, row.saidOpen)
}
+1 -1
View File
@@ -135,7 +135,7 @@ func (s AskSteps) testStep(ctx context.Context, ask sdkstep.StepAsk, end *sdkste
}
return 0, false, nil
}
job := sdkstep.CheckJob{Fetch: *withPackages(&run.Fetch, ask.Packages), Levels: []string{level}, Kept: true, Toolchain: run.Toolchain}
job := sdkstep.CheckJob{Fetch: *withPackages(&run.Fetch, ask.Packages), Levels: []string{level}, Kept: true, Toolchain: run.Toolchain, Archive: run.Archive}
out, err := s.check(ctx, job)
if err != nil {
return err