diff --git a/cmd/mesh-controller/checks_test.go b/cmd/mesh-controller/checks_test.go index 4d62e4dc..8ea4242a 100644 --- a/cmd/mesh-controller/checks_test.go +++ b/cmd/mesh-controller/checks_test.go @@ -278,3 +278,13 @@ func TestADirectVerdictNamesTheTrunkTheForgeAnnounced(t *testing.T) { t.Fatalf("a forge that said no base head gave the trunk %q", c.Trunk) } } + +// A head checked again through mesh-delivery (`delivery check --members`, a recheck) reaches the same direct verdict: +// it names the base head the forge last announced, kept on the member, or the merge tool would refuse it for ever. +func TestARecheckedHeadsDirectVerdictNamesItsTrunk(t *testing.T) { + m := orderMember{ID: "novox/mesh-tools-go@1a2b3c4d5e6f", Repository: "novox/mesh-tools-go", Base: "main", + Head: "1a2b3c4d5e6f7a8b9c0d", Number: 3, BaseSHA: "7a8b9c0d1e2f3a4b5c6d7e8f9a0b1c2d3e4f5a6b"} + if c := directVerdict(m.pull(), link.ChangePlan{}); c.Trunk != "7a8b9c0d1e2f" { + t.Fatalf("a rechecked head's direct verdict names trunk %q", c.Trunk) + } +} diff --git a/cmd/mesh-controller/delivery.go b/cmd/mesh-controller/delivery.go index 235f6a51..615386c0 100644 --- a/cmd/mesh-controller/delivery.go +++ b/cmd/mesh-controller/delivery.go @@ -580,6 +580,9 @@ type orderMember struct { CloneURL string `json:"clone_url,omitempty"` // After are the repositories its pull request says it goes after (`after: `). After []string `json:"after,omitempty"` + // BaseSHA is the base branch's head the forge last announced the head with (novox/hq ADR 0323): the trunk commit + // a verdict no build judges names when the head is checked again through mesh-delivery. + BaseSHA string `json:"base_sha,omitempty"` } // pull is the member as the forge announced it. @@ -589,7 +592,7 @@ func (m orderMember) pull() link.PullUpdated { if base == "" { base = "main" } - return link.PullUpdated{Owner: owner, Repo: repo, Number: m.Number, Base: base, Commit: m.Head, + return link.PullUpdated{Owner: owner, Repo: repo, Number: m.Number, Base: base, Commit: m.Head, BaseSHA: m.BaseSHA, CloneURL: m.CloneURL, Paths: m.Paths, PathsTruncated: m.PathsTruncated, Removed: m.Removed, ModuleDirs: m.ModuleDirs, ModuleDirsSaid: m.ModuleDirsSaid} } diff --git a/internal/link/events.go b/internal/link/events.go index cd5c1b1d..ab2a511e 100644 --- a/internal/link/events.go +++ b/internal/link/events.go @@ -221,17 +221,17 @@ type SourceMoved struct { // PullUpdated is what the forge announces when an open pull request's head moves โ€” opened, or pushed // to (novox/hq to-be 45 ยง9): what the controller asks the build seat to check before it merges. type PullUpdated struct { - Owner string `json:"owner"` - Repo string `json:"repo"` - Number int `json:"number"` - Title string `json:"title,omitempty"` - Base string `json:"base"` - Head string `json:"head"` - Commit string `json:"head_sha"` + Owner string `json:"owner"` + Repo string `json:"repo"` + Number int `json:"number"` + Title string `json:"title,omitempty"` + Base string `json:"base"` + Head string `json:"head"` + Commit string `json:"head_sha"` // BaseSHA is the base branch's head when the forge announced the head (novox/hq ADR 0323): the trunk commit a // verdict the controller gives without the build seat โ€” a change that runs no build โ€” is judged against. Empty // from a forge module from before it. - BaseSHA string `json:"base_sha,omitempty"` + BaseSHA string `json:"base_sha,omitempty"` CloneURL string `json:"clone_url"` HTMLURL string `json:"html_url,omitempty"` // Paths are the files the pull request changes; PathsTruncated says there were more.