mesh-delivery-contracts, sdk buildstep: the check job carries the toolchain the checker agreed (ADR 0584 clause 2) and the node names, so a node on another toolchain declines the check; the part had neither, the sdk's CheckJob lacked the toolchain (B2g; issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -258,6 +258,9 @@ type CheckJob struct {
|
||||
Run string `json:"run,omitempty"`
|
||||
Packages []string `json:"packages,omitempty"`
|
||||
NodeNames []string `json:"node-names,omitempty"`
|
||||
// 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"`
|
||||
}
|
||||
|
||||
// ComposeJob asks one compose-candidate build.
|
||||
@@ -409,6 +412,9 @@ func (c CheckJob) check(id string) error {
|
||||
return fmt.Errorf("buildstep: the check ask %s names a package %q that is no import path", id, p)
|
||||
}
|
||||
}
|
||||
if t := c.Toolchain; t != nil && (t.Language == "" || t.Version == "" || t.Recipe == "") {
|
||||
return fmt.Errorf("buildstep: the check ask %s names a toolchain without its language, version and recipe", id)
|
||||
}
|
||||
seen := map[string]bool{}
|
||||
for _, n := range c.NodeNames {
|
||||
if err := meshkeys.CheckName("node", n); err != nil || strings.Contains(n, ",") || seen[n] {
|
||||
|
||||
@@ -72,6 +72,19 @@ func TestAskCheckAndRoundTrip(t *testing.T) {
|
||||
t.Errorf("a level: %v", err)
|
||||
}
|
||||
chk = goodCheck()
|
||||
chk.Check.Toolchain = &ToolchainUsed{Language: "go", Version: "1.26.0", Recipe: "2"}
|
||||
raw, err := EncodeStepAsk(chk)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if back, err := DecodeStepAsk(raw); err != nil || back.Check.Toolchain == nil || back.Check.Toolchain.Version != "1.26.0" {
|
||||
t.Errorf("the check's toolchain is lost in a round trip: %+v, %v", back.Check, err)
|
||||
}
|
||||
chk.Check.Toolchain.Recipe = ""
|
||||
if _, err := EncodeStepAsk(chk); err == nil || !strings.Contains(err.Error(), "toolchain") {
|
||||
t.Errorf("a toolchain without a recipe: %v", err)
|
||||
}
|
||||
chk = goodCheck()
|
||||
chk.Language = AskImage
|
||||
if _, err := EncodeStepAsk(chk); err == nil || !strings.Contains(err.Error(), "no tests") {
|
||||
t.Errorf("an image check: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user