mesh-build-go: a seat's ask type runs as the neutral ask (AskOf, the step description, the fetch arguments) (B5i; issue 1966)

Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
2026-11-05 16:08:26 +01:00
parent 941959198e
commit 8f1581f34a
@@ -10,6 +10,8 @@ import (
"testing"
"time"
nodebuildgo "git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildgo"
nodebuildnode "git.novox.be/novox/mesh-delivery/contracts/go/seats/nodebuildnode"
sdkstep "git.novox.be/novox/mesh-delivery/sdk/buildstep"
)
@@ -340,3 +342,32 @@ func TestRunAskRunsEveryPackageAndLevelAfterAFailure(t *testing.T) {
t.Fatalf("calls %v, levels %+v: want b then a at each of the two levels", r.calls, a.Levels)
}
}
// A seat's own ask type (the generated one of any of the three build seats) is the neutral ask through the form's one
// conversion (sdkstep.AskOf), reads for its step description through the same conversion (askRead), and reaches the
// fetch tool as the fetch's arguments alone: no layout version, nothing of the ask's.
func TestASeatsAskTypeRunsAsTheNeutralAsk(t *testing.T) {
at := time.Now().UTC()
fetch := &nodebuildgo.Fetch{Commit: runCommit, Repository: "novox/x", Dir: "modules/m", Paths: []string{"src"}}
goAsk := nodebuildgo.StepAsk{V: sdkstep.StepAskVersion, ID: sdkstep.NewID(), Kind: sdkstep.AskDelivery, Language: sdkstep.AskGo, Asker: "mesh-delivery-builder", At: &at,
Build: &nodebuildgo.StepAskBuild{Module: "m", Path: "modules/m", Fetch: fetch, Artifacts: []nodebuildgo.AskArtifact{{Artifact: "bundle"}}},
Packages: map[string]string{"git.novox.be/novox/mesh-sdk/go": runCommit}}
a, err := sdkstep.AskOf(goAsk)
if err != nil {
t.Fatal(err)
}
if read := askRead(a); read.Kind != sdkstep.AskDelivery || read.Build == nil || read.Build.Module != "m" {
t.Errorf("the step description reads %+v", read)
}
r := &recorder{fetch: map[string]any{"workspace": "/w"}}
if _, err := RunAsk(context.Background(), r.steps(), a); err != nil {
t.Fatal(err)
}
want := `fetch {"commit":"` + runCommit + `","dir":"modules/m","packages":{"git.novox.be/novox/mesh-sdk/go":"` + runCommit + `"},"paths":["src"],"repository":"novox/x"}`
if len(r.calls) == 0 || r.calls[0] != want {
t.Errorf("the fetch tool was called with %v, want %s", r.calls, want)
}
if back, err := sdkstep.AskAs[nodebuildnode.StepAsk](a); err != nil || back.Build == nil || back.Build.Module != "m" {
t.Errorf("the ask as another seat's type: %+v, %v", back, err)
}
}