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
This commit is contained in:
2026-11-19 13:41:48 +01:00
parent 1eec825926
commit b3e52ecdef
3 changed files with 37 additions and 10 deletions
@@ -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}}
}
@@ -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))
}
}
@@ -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) {