diff --git a/cmd/mesh-controller/check_builds_test.go b/cmd/mesh-controller/check_builds_test.go index 3dc2b516..1a093834 100644 --- a/cmd/mesh-controller/check_builds_test.go +++ b/cmd/mesh-controller/check_builds_test.go @@ -262,3 +262,18 @@ func forgetWalkVerdicts() { defer walkVerdicts.Unlock() walkVerdicts.read = map[string]verdictsRead{} } + +// A walk's merged heads are the forge's word for each merge; a merge announced without its head, or a pull request +// merged at two heads in one walk, has none, and its walk takes no check's build (novox/hq issue 703). +func TestAWalksMergedHeadsAreTheForgesWord(t *testing.T) { + merge := func(number int, head string) inventory.PlanMerge { + return inventory.PlanMerge{Repository: "novox/shop", Number: number, Head: head} + } + p := &inventory.Plan{Delivery: &inventory.PlanDelivery{Merges: []inventory.PlanMerge{ + merge(7, "aaaaaaaaaaaa1"), merge(8, ""), merge(9, "bbbbbbbbbbbb"), merge(9, "cccccccccccc")}}} + heads := mergedHeadsOf(p) + shop := func(n int) link.PullRef { return link.PullRef{Owner: "novox", Repo: "shop", Number: n} } + if heads[shop(7)] != "aaaaaaaaaaaa1" || heads[shop(8)] != "" || heads[shop(9)] != "" { + t.Fatalf("merged heads %v", heads) + } +} diff --git a/internal/builder/reuse.go b/internal/builder/reuse.go index 1f8e01c1..5ff2446e 100644 --- a/internal/builder/reuse.go +++ b/internal/builder/reuse.go @@ -616,6 +616,8 @@ func unnamed(named []NamedBuild, module, key string, found CheckBuild) string { return "" } } - return "a build is kept under this key, and no check verdict of the walk's pull requests names it with its " + - "digests: not taken" + // A build of another pull request, or of a head the forge did not merge, is in no verdict the walk is handed + // (novox/hq issue 703): said with the check that made it, whose head names which head it was. + return "a build is kept under this key, by " + found.Said() + ", and no check verdict of the walk's pull requests " + + "at the head the forge merged names it with its digests: not taken" } diff --git a/internal/builder/reuse_test.go b/internal/builder/reuse_test.go index 785c2615..ff5a0451 100644 --- a/internal/builder/reuse_test.go +++ b/internal/builder/reuse_test.go @@ -216,7 +216,8 @@ func TestARecordNoVerdictNamesIsRefusedAndBuilt(t *testing.T) { if got.Reused != nil || len(scratch.took) > 0 || !dockerBuilt(r) { t.Fatalf("a record no verdict names was taken: %+v, copied %v", got.Reused, scratch.took) } - if !strings.Contains(got.Why, "no check verdict of the walk's pull requests names it") { + if !strings.Contains(got.Why, "no check verdict of the walk's pull requests at the head the forge merged names it") || + !strings.Contains(got.Why, "at head abcdefabcdef") { t.Fatalf("the walk says %q", got.Why) } })