No merge is dropped, and the merge window lives on the bus (issues 973 step 2, 921) #367

Merged
mesh-tools merged 12 commits from feat/merge-window-on-the-bus into main 2026-10-17 10:54:05 +00:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit 5702187695 - Show all commits
+6 -5
View File
@@ -668,12 +668,13 @@ func (s *Server) sourceMoved(ctx context.Context, m Control) {
return
}
err := s.upgrader.SourceMoved(ctx, moved)
// Left unsettled when the controller is ending, whatever error that gave (the plans' hold returns a bare
// context.Canceled): the bus hands it to whatever consumes next, and taking it would lose the merge.
if err != nil && ctx.Err() != nil {
return
}
if err != nil && errors.Is(err, ErrTryAgain) {
// Left unsettled when the controller is ending (the bus hands it to whatever consumes next, as decide
// does) and when the bus will not hold it: taking it would lose the merge.
if ctx.Err() != nil {
return
}
// Also left unsettled when the bus will not hold it.
delay := MergeRedeliverAfter(m.HeldFor())
if held := m.Hold(delay); held != nil {
s.log.Printf("%s/%s moved to %.8s and could not be held (%v): %v; left for the bus to hand over again",
+2 -1
View File
@@ -143,8 +143,9 @@ func TestAMergeIsLeftUnsettledWhenTheControllerEndsOrTheHoldFails(t *testing.T)
merged := SourceMoved{Owner: "novox", Repo: "one", Base: "main", Commit: "abcdef0123"}
try := errors.Join(ErrTryAgain, errors.New("another controller is working the plans"))
// The plans' hold returns a bare context.Canceled when the controller is replaced, not ErrTryAgain.
s, in := serving()
s.upgrader = upgradesWith{err: try}
s.upgrader = upgradesWith{err: context.Canceled}
to := &settled{}
ended, end := context.WithCancel(context.Background())
end()