From b3e52ecdef497f560088d922926bca005eb0e47f Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 13:41:48 +0100 Subject: [PATCH 1/2] A pipeline step's ask names the language of the build seat it is asked of stepAsk took the artifact's language word (typescript), which node-build-node's module refuses as unreadable (go, node, image). The language is now derived from the chosen seat (buildstep.AskLanguageOfSeat), and the placement test holds every ask to its seat. Builds: design 47 G A-488 (hq 25df48ad) Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../internal/pipeline/place.go | 13 +++++++++--- .../internal/pipeline/place_test.go | 21 ++++++++++++------- modules/mesh-delivery-sdk/buildstep/ask.go | 13 ++++++++++++ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/place.go b/modules/mesh-delivery-pipeline/internal/pipeline/place.go index a9bec3c3..14a82a20 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/place.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/place.go @@ -127,9 +127,16 @@ func place(p seat.Pipeline, reg catalog.Registration, entries map[string]catalog steps = append(steps, s) continue } + // The ask names the language of the seat it is asked of, never the artifact's word (design 47 G A-488). + language, err := sdkstep.AskLanguageOfSeat(bs) + if err != nil { + s.Outcome, s.Started, s.Ended, s.Why = seat.StepResultOutcomeCouldNotRun, &now, &now, err.Error() + steps = append(steps, s) + continue + } s.Seat, s.Outcome, s.Started = bs, seat.StepResultOutcomeRunning, &now s.Ask = AskID(startOf(p, now), p.Pipeline, a.Ref, step) - body := stepAsk(p, entry, a, step, s.Ask, asker, now) + body := stepAsk(p, entry, a, language, step, s.Ask, asker, now) ask := Asked{Seat: bs, ID: s.Ask, Ask: body} if share && BoundSeat(bs) { digest := ShareDigest(p.Fingerprint, step, status, body.Step.Fetch) @@ -192,14 +199,14 @@ type Asked struct { Readers []seat.TestRunReader } -func stepAsk(p seat.Pipeline, e catalog.CatalogEntry, a catalog.Artifact, step, id, asker string, now time.Time) nodebuildgo.StepAsk { +func stepAsk(p seat.Pipeline, e catalog.CatalogEntry, a catalog.Artifact, language, step, id, asker string, now time.Time) nodebuildgo.StepAsk { // A step is for its module alone (principle 10, A-447): the fetch always names the module's directory, and the // artifact's named paths in it when the entry has them. fetch := nodebuildgo.Fetch{Repository: p.Repository, Commit: p.Commit, Dir: e.Path} if paths := artifactPaths(e, a.Ref); len(paths) > 0 { fetch.Paths = paths } - return nodebuildgo.StepAsk{V: 1, ID: id, Asker: asker, Kind: "step", Language: a.Language, At: &now, + return nodebuildgo.StepAsk{V: 1, ID: id, Asker: asker, Kind: "step", Language: language, At: &now, Step: &nodebuildgo.StepRun{Artifact: a.Ref, Branch: p.Branch, Commit: p.Commit, Fetch: fetch, Fingerprint: p.Fingerprint, Module: p.Module, Pipeline: p.Pipeline, Revision: p.Source, Step: step}} } diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go index eec07992..13fcdbb4 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go @@ -295,8 +295,9 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { reg := catalog.Registration{Module: "app", Policy: catalog.Policy{Steps: catalog.StepStatuses{Lint: "required", Unit: "required", Integration: "required"}}} entries := map[string]catalog.CatalogEntry{ "app": {Module: "app", Artifacts: []catalog.Artifact{{Ref: "app:server", Kind: "image"}, {Ref: "app:files", Kind: "archive"}, - {Ref: "app:mirror", Kind: "upstream"}, {Ref: "app:web", Language: "rust"}}}, + {Ref: "app:mirror", Kind: "upstream"}, {Ref: "app:web", Language: "rust"}, {Ref: "app:lib", Language: "typescript"}}}, "mesh-build-image": {Module: "mesh-build-image", Acts: []catalog.ActingRule{{Seat: "node-build-image", Step: "build", On: seatdef.OnKindImage}}}, + "mesh-build-node": {Module: "mesh-build-node", Acts: []catalog.ActingRule{{Seat: "node-build-node", Step: "build", On: "typescript"}}}, } steps, asks := Place(seat.Pipeline{Pipeline: "main.4.app", Module: "app"}, reg, entries, time.Unix(0, 0), "the-runner") want := map[string]struct{ outcome, seat, status string }{ @@ -304,6 +305,7 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { "app:files": {seat.StepResultOutcomeBypassed, "", seat.StepResultStatusBypass}, "app:mirror": {seat.StepResultOutcomeBypassed, "", seat.StepResultStatusBypass}, "app:web": {seat.StepResultOutcomeCouldNotRun, "", "required"}, + "app:lib": {seat.StepResultOutcomeRunning, "node-build-node", "required"}, } n := 0 for _, s := range steps { @@ -316,16 +318,21 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { t.Errorf("%s %s is %s/%s at %q (%s), want %s/%s at %q", s.Artifact, s.Step, s.Status, s.Outcome, s.Seat, s.Why, w.status, w.outcome, w.seat) } } - if n != 12 { - t.Errorf("placed %d build steps of the four artifacts, want 12", n) + if n != 15 { + t.Errorf("placed %d build steps of the five artifacts, want 15", n) } for _, a := range asks { - if a.Seat != builds.Seat && a.Seat != wants.Seat && a.Seat != "node-build-image" { - t.Errorf("asked %s, want only the build, the composition and the image's build seat", a.Seat) + if a.Seat != builds.Seat && a.Seat != wants.Seat && a.Seat != "node-build-image" && a.Seat != "node-build-node" { + t.Errorf("asked %s, want only the build, the composition and the image's and the node's build seats", a.Seat) + } + // Design 47 G A-488: a step's ask names the language of the seat it is asked of (node-build-node node, node-build-image + // image), never the artifact's word (typescript). + if ask, ok := a.Ask.(nodebuildgo.StepAsk); ok && ask.Language != strings.TrimPrefix(a.Seat, "node-build-") { + t.Errorf("the ask %s on %s names the language %q, want %q", a.ID, a.Seat, ask.Language, strings.TrimPrefix(a.Seat, "node-build-")) } } - if len(asks) != 5 { - t.Errorf("asked %d, want the build, the image's three steps and the composition", len(asks)) + if len(asks) != 8 { + t.Errorf("asked %d, want the build, the image's and the node's three steps each and the composition", len(asks)) } } diff --git a/modules/mesh-delivery-sdk/buildstep/ask.go b/modules/mesh-delivery-sdk/buildstep/ask.go index 2e664ce9..e6d3e96f 100644 --- a/modules/mesh-delivery-sdk/buildstep/ask.go +++ b/modules/mesh-delivery-sdk/buildstep/ask.go @@ -141,6 +141,19 @@ func BuildSeat(language string) (string, error) { return "node-build-" + language, nil } +// AskLanguageOfSeat is the language of the asks a build seat takes: node-build-go go, node-build-node node, node-build-image +// image (BuildSeat's inverse). A pipeline step's ask names it, never the artifact's language word (design 47 G A-488). +func AskLanguageOfSeat(seat string) (string, error) { + language, ok := strings.CutPrefix(seat, "node-build-") + if !ok { + return "", fmt.Errorf("buildstep: %q is no build seat", seat) + } + if err := checkAskLanguage(language); err != nil { + return "", err + } + return language, nil +} + // AskSubject is the subject a build seat accepts a queue's asks on: the seat's accept subject of main's form, which names no // asker (design 47 G §600, §483). func AskSubject(language, queue string) (string, error) { -- 2.54.0 From 2e03fcb8751ab849b982209bc5f4e4d5dadaaa38 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 19 Nov 2026 13:48:29 +0100 Subject: [PATCH 2/2] A step ask's toolchain is read by the artifact's toolchain language, not the ask's The ask's language names the seat (A-488), so the runner read the toolchain of node for a TypeScript step and none matched. Asked carries the artifact's language, and the placement test holds a go and a TypeScript artifact to their seats and their toolchains. Builds: design 47 G A-488, A-488b (hq 57c14047) Claude-Session: https://claude.ai/code/session_01JG73KHUnBze48rdua8u2sy --- .../internal/pipeline/place.go | 7 ++++-- .../internal/pipeline/place_test.go | 22 ++++++++++++++----- .../internal/pipeline/start.go | 10 ++++----- 3 files changed, 26 insertions(+), 13 deletions(-) diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/place.go b/modules/mesh-delivery-pipeline/internal/pipeline/place.go index 14a82a20..72cb8195 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/place.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/place.go @@ -137,7 +137,7 @@ func place(p seat.Pipeline, reg catalog.Registration, entries map[string]catalog s.Seat, s.Outcome, s.Started = bs, seat.StepResultOutcomeRunning, &now s.Ask = AskID(startOf(p, now), p.Pipeline, a.Ref, step) body := stepAsk(p, entry, a, language, step, s.Ask, asker, now) - ask := Asked{Seat: bs, ID: s.Ask, Ask: body} + ask := Asked{Seat: bs, ID: s.Ask, Ask: body, Toolchain: a.Language} if share && BoundSeat(bs) { digest := ShareDigest(p.Fingerprint, step, status, body.Step.Fetch) run := TestRunKey(candidate, step, digest) @@ -196,7 +196,10 @@ type Asked struct { // Run is the test run the ask asks, its key in test-runs, with its level, its share digest and the steps of the pipeline // reading it, the asking step first (§724, §725); empty for an ask of no test run. Run, Level, Digest string - Readers []seat.TestRunReader + // Toolchain is the language of the artifact's toolchain as the catalog keys it (go, typescript; design 47 G A-104, A-488b), + // never the ask's language, which names the seat; empty for an artifact with none (an image). + Toolchain string + Readers []seat.TestRunReader } func stepAsk(p seat.Pipeline, e catalog.CatalogEntry, a catalog.Artifact, language, step, id, asker string, now time.Time) nodebuildgo.StepAsk { diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go b/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go index 13fcdbb4..3251eb56 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/place_test.go @@ -242,7 +242,9 @@ func TestAStepAskCarriesTheKeptResultsAndTheToolchain(t *testing.T) { reg, entries := placeFixture() e := entries["app"] e.Artifacts[0].Package = &catalog.ArtifactPackage{Ecosystem: "go", Name: "git.example/o/app"} + e.Artifacts = append(e.Artifacts, catalog.Artifact{Ref: "app:lib", Language: "typescript"}) entries["app"] = e + entries["mesh-build-node"] = catalog.CatalogEntry{Module: "mesh-build-node", Acts: []catalog.ActingRule{{Seat: "node-build-node", Step: "build", On: "typescript"}}} store, asks := created{}, &stepAsks{} reads := 0 s := &Starter{Pipelines: store, Say: func(string, any) error { return nil }, Steps: asks, Name: "the-runner", @@ -260,7 +262,7 @@ func TestAStepAskCarriesTheKeptResultsAndTheToolchain(t *testing.T) { if _, err := s.Start(Begin{Branch: "main", Source: 4, Module: "app", Commit: "c1", Fp: "src2:aa", Repository: "o/app", Entries: entries}); err != nil { t.Fatal(err) } - var program, tools *nodebuildgo.StepRun + var program, tools, lib *nodebuildgo.StepRun for _, a := range asks.asks { if ask, ok := a.(nodebuildgo.StepAsk); ok { switch { @@ -268,6 +270,8 @@ func TestAStepAskCarriesTheKeptResultsAndTheToolchain(t *testing.T) { program = ask.Step case ask.Step.Artifact == "app:tools" && ask.Step.Step == "unit": tools = ask.Step + case ask.Step.Artifact == "app:lib" && ask.Step.Step == "unit": + lib = ask.Step } } } @@ -277,6 +281,10 @@ func TestAStepAskCarriesTheKeptResultsAndTheToolchain(t *testing.T) { if tools == nil || len(tools.Kept) != 0 || tools.Toolchain == nil { t.Errorf("an artifact with no package carries no kept result and its language's toolchain: %+v", tools) } + // Design 47 G A-488b: the toolchain is read by the artifact's toolchain language (typescript), never by the ask's (node). + if lib == nil || lib.Toolchain == nil || lib.Toolchain.Language != "typescript" { + t.Errorf("the TypeScript artifact's ask carries the toolchain %+v, want the one of typescript", lib) + } for pkg, want := range map[string]bool{"a/b": true, "a/b/c": true, "a/bc": false, "a": false} { if InPackage(pkg, "a/b") != want { t.Errorf("InPackage(%s, a/b) = %v, want %v", pkg, !want, want) @@ -295,7 +303,8 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { reg := catalog.Registration{Module: "app", Policy: catalog.Policy{Steps: catalog.StepStatuses{Lint: "required", Unit: "required", Integration: "required"}}} entries := map[string]catalog.CatalogEntry{ "app": {Module: "app", Artifacts: []catalog.Artifact{{Ref: "app:server", Kind: "image"}, {Ref: "app:files", Kind: "archive"}, - {Ref: "app:mirror", Kind: "upstream"}, {Ref: "app:web", Language: "rust"}, {Ref: "app:lib", Language: "typescript"}}}, + {Ref: "app:mirror", Kind: "upstream"}, {Ref: "app:web", Language: "rust"}, {Ref: "app:lib", Language: "typescript"}, {Ref: "app:cli", Language: "go"}}}, + "mesh-build-go": {Module: "mesh-build-go", Acts: []catalog.ActingRule{{Seat: "node-build-go", Step: "build", On: "go"}}}, "mesh-build-image": {Module: "mesh-build-image", Acts: []catalog.ActingRule{{Seat: "node-build-image", Step: "build", On: seatdef.OnKindImage}}}, "mesh-build-node": {Module: "mesh-build-node", Acts: []catalog.ActingRule{{Seat: "node-build-node", Step: "build", On: "typescript"}}}, } @@ -306,6 +315,7 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { "app:mirror": {seat.StepResultOutcomeBypassed, "", seat.StepResultStatusBypass}, "app:web": {seat.StepResultOutcomeCouldNotRun, "", "required"}, "app:lib": {seat.StepResultOutcomeRunning, "node-build-node", "required"}, + "app:cli": {seat.StepResultOutcomeRunning, "node-build-go", "required"}, } n := 0 for _, s := range steps { @@ -318,11 +328,11 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { t.Errorf("%s %s is %s/%s at %q (%s), want %s/%s at %q", s.Artifact, s.Step, s.Status, s.Outcome, s.Seat, s.Why, w.status, w.outcome, w.seat) } } - if n != 15 { - t.Errorf("placed %d build steps of the five artifacts, want 15", n) + if n != 18 { + t.Errorf("placed %d build steps of the six artifacts, want 18", n) } for _, a := range asks { - if a.Seat != builds.Seat && a.Seat != wants.Seat && a.Seat != "node-build-image" && a.Seat != "node-build-node" { + if a.Seat != builds.Seat && a.Seat != wants.Seat && a.Seat != "node-build-image" && a.Seat != "node-build-node" && a.Seat != "node-build-go" { t.Errorf("asked %s, want only the build, the composition and the image's and the node's build seats", a.Seat) } // Design 47 G A-488: a step's ask names the language of the seat it is asked of (node-build-node node, node-build-image @@ -331,7 +341,7 @@ func TestAnArtifactWithoutALanguageIsPlacedByItsKind(t *testing.T) { t.Errorf("the ask %s on %s names the language %q, want %q", a.ID, a.Seat, ask.Language, strings.TrimPrefix(a.Seat, "node-build-")) } } - if len(asks) != 8 { + if len(asks) != 11 { t.Errorf("asked %d, want the build, the image's and the node's three steps each and the composition", len(asks)) } } diff --git a/modules/mesh-delivery-pipeline/internal/pipeline/start.go b/modules/mesh-delivery-pipeline/internal/pipeline/start.go index dcc1ab14..625d8dcb 100644 --- a/modules/mesh-delivery-pipeline/internal/pipeline/start.go +++ b/modules/mesh-delivery-pipeline/internal/pipeline/start.go @@ -483,16 +483,16 @@ func (s *Starter) carry(key string, asks []Asked) { if a.Package != "" { ask.Step.Kept = kept[a.Package] } - if s.Toolchain == nil || ask.Language == "" { + if s.Toolchain == nil || a.Toolchain == "" { continue } - t, done := chains[ask.Language] + t, done := chains[a.Toolchain] if !done { var err error - if t, err = s.Toolchain(ask.Language); err != nil { - s.logf("the toolchain of %s for the steps of %s is not read: %v", ask.Language, key, err) + if t, err = s.Toolchain(a.Toolchain); err != nil { + s.logf("the toolchain of %s for the steps of %s is not read: %v", a.Toolchain, key, err) } - chains[ask.Language] = t + chains[a.Toolchain] = t } ask.Step.Toolchain = t } -- 2.54.0