mesh-delivery: test that an unanswered line clears when its delivery moves on or its pull request closes (issue 441)
mesh/merge-gate pass: builds mesh-delivery → novox; no bus step; every machine composes with the change as it did without (4 of 4 compose)
mesh/repo-check pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
mesh/delivery failed: its walk failed, carrying its own commit: a gate on a first machine (what it carried put back), a build, a machine

The review asked for the clearing paths to be pinned: a recheck or a merge
clears the line before the forge is read again, and a pull request gone from
the open list is no longer said.
This commit is contained in:
2026-10-11 03:03:43 +02:00
parent 5855c41f9d
commit 9bd8903ed2
@@ -173,3 +173,79 @@ func TestAReadyDeliveryWhoseChecksAnsweredIsNotSaid(t *testing.T) {
t.Fatalf("a ready delivery whose checks answered is said: %+v", lines)
}
}
// saidReady is a ready delivery of #215's head whose mesh/repo-check reads pending on the forge, said past the bound.
func saidReady(t *testing.T) (*world, string) {
t.Helper()
w := newWorldOver(t, newMemStore(), newFakeController(), newFakeForge(), time.Date(2026, 10, 11, 0, 43, 0, 0, time.UTC))
id := heldIn(t, w, "pass", Ready)
w.forge.open = openPullsOf(t, readyRepoCheckPending)
w.h.SeeOpenPulls()
w.later(Bounds[Proposed].For + time.Minute)
if lines := w.h.Stalled(); len(lines) != 1 || lines[0].ID != id || lines[0].State != Unanswered {
t.Fatalf("a ready delivery whose check is pending past the bound is not said: %+v", lines)
}
return w, id
}
// unansweredOf are the unanswered lines among what `stalled` says.
func unansweredOf(w *world) []StalledLine {
var out []StalledLine
for _, l := range w.h.Stalled() {
if l.State == Unanswered {
out = append(out, l)
}
}
return out
}
// **A said line clears when its delivery's state changes** (novox/hq issue 441): a recheck proposes it again, under
// the proposed state's own bound, and a merge publishes it, past the pull request. Both clear the line at once —
// before the forge is read again, which may lag — and stay cleared once it is read.
func TestASaidLineClearsWhenItsDeliveryMovesOn(t *testing.T) {
t.Run("a recheck proposes it", func(t *testing.T) {
w, id := saidReady(t)
if _, err := w.h.Recheck(id, "its repo-check status was lost", "a person"); err != nil {
t.Fatal(err)
}
if s := w.state(id); s != Proposed {
t.Fatalf("a recheck left it %s", s)
}
if lines := unansweredOf(w); len(lines) != 0 {
t.Fatalf("a rechecked delivery, proposed again, is still said as unanswered: %+v", lines)
}
w.h.SeeOpenPulls()
if lines := unansweredOf(w); len(lines) != 0 {
t.Fatalf("a rechecked delivery is said again once the forge is read: %+v", lines)
}
})
t.Run("a merge publishes it", func(t *testing.T) {
w, id := saidReady(t)
w.h.WalkMoved(w.ctl.put(aWalk("plan-1", "novox/mesh-controller", merge, true)))
w.h.PullMerged(merged("novox/mesh-controller", 215, readyHeadSHA, merge))
if s := w.state(id); s != Published {
t.Fatalf("a merge left it %s", s)
}
if lines := unansweredOf(w); len(lines) != 0 {
t.Fatalf("a published delivery is still said as unanswered: %+v", lines)
}
w.h.SeeOpenPulls() // the forge's open list lags the merge: the head is still on it
if lines := unansweredOf(w); len(lines) != 0 {
t.Fatalf("a published delivery still on a lagging open list is said: %+v", lines)
}
})
}
// **A said line clears when its pull request leaves the open list** — closed, its event to this owner lost, so the
// delivery is still ready: the forge no longer lists it, and nothing is said of it.
func TestASaidLineClearsWhenItsPullRequestIsNoLongerOpen(t *testing.T) {
w, id := saidReady(t)
w.forge.open = nil
w.h.SeeOpenPulls()
if s := w.state(id); s != Ready {
t.Fatalf("the delivery moved to %s with no event: the case is not the one meant", s)
}
if lines := unansweredOf(w); len(lines) != 0 {
t.Fatalf("a pull request no longer open is still said: %+v", lines)
}
}