Keep a check build whose key is unchanged instead of building it again
mesh/merge-gate head 1666747a2246 merged into trunk 04730b54a8f2 — pass: builds build-agent, mesh-controller → ace, g14, novox, shanks; no bus step; every …
mesh/repo-check head 1666747a2246 merged into trunk 04730b54a8f2 — pass: its merge-check.sh passed
mesh/delivery superseded: a newer head of the same pull request

A fresh check asked when only the trunk moved rebuilt every image, though
the reuse key said nothing it is built from changed: a controller check
took about 12 minutes instead of 5.5. The check now keeps a build kept
under its key when a verdict of the build seat names that key and every
digest, names it as the build's own check so a walk takes it, and the
cleanup keeps it while any check names it (novox/hq issue 703).
This commit is contained in:
2026-10-14 09:41:39 +02:00
parent 04730b54a8
commit 1666747a22
11 changed files with 328 additions and 22 deletions
+25
View File
@@ -214,3 +214,28 @@ func TestAWalksLeaveNamesTheBuildsItsPullRequestsVerdictsMade(t *testing.T) {
t.Fatalf("verdicts that could not be read named %+v", got.Builds)
}
}
// A check is handed the builds the seat's verdicts name for the modules it builds, read once, and none when they
// cannot be read (novox/hq issue 703).
func TestACheckIsHandedTheBuildsTheVerdictsNameForItsModules(t *testing.T) {
was := checkedBuildsOfModules
t.Cleanup(func() { checkedBuildsOfModules = was })
var asked [][]string
named := []link.CheckedBuild{{Pull: link.PullRef{Owner: "novox", Repo: "shop", Number: 7}, Check: "build-1",
Built: link.CheckBuilt{Module: "app", Key: "r1:1"}}}
checkedBuildsOfModules = func(_ context.Context, modules []string) ([]link.CheckedBuild, error) {
asked = append(asked, modules)
return named, nil
}
builds := []link.CheckBuild{{Module: "app"}, {Module: "web", Skip: "the merge deletes it"}}
if got := namedForTheCheck(t.Context(), builds); !reflect.DeepEqual(got, named) ||
!reflect.DeepEqual(asked, [][]string{{"app"}}) {
t.Fatalf("the check is handed %+v, read %v", got, asked)
}
checkedBuildsOfModules = func(context.Context, []string) ([]link.CheckedBuild, error) {
return nil, errors.New("no bus")
}
if got := namedForTheCheck(t.Context(), builds); got != nil {
t.Fatalf("verdicts that could not be read named %+v", got)
}
}