| index 2eb2aa930..1558fff88 100644 |
| --- a/internal/rollout/holdran_test.go |
| +++ b/internal/rollout/holdran_test.go |
| @@ -616,7 +616,13 @@ func TestAnInstallOntoTheGoodBuildMakesTheRollbackReadDueAtOnce(t *testing.T) { |
| h.pass() // the newer desire supersedes the attempt |
| h.advance(5 * time.Second) |
| close(gate) |
| - waitFor(t, "h's attempt to finish", func() bool { return !h.m.attemptRunning("h") }) |
| + // The attempt's done() frees the slot and sets the marker, then |
| + // makes the read due once it has let go of the scheduler's lock: |
| + // a pass in between does not read (CI 2026-10-27, "after the pass |
| + // the marker stands"). So the wait is for both. |
| + waitFor(t, "h's attempt to finish and make the pointer read due", func() bool { |
| + return !h.m.attemptRunning("h") && h.m.pointerReadIsDue(appKey{"bab", "blog"}) |
| + }) |
| got, ok := h.book.HoldRanOn("h") |
| if !ok || !got.same(markV2) || !got.At.Equal(start) { |
| t.Fatalf("marker = %+v, %v: want v2's, stamped at the attempt's dispatch %v", got, ok, start) |
| @@ -787,12 +793,35 @@ func TestAMoveOntoTheInstalledGoodBuildWaitsForASignedRollback(t *testing.T) { |
| |
| // `carlos rollback` signs v1; the pointer pass clears the marker, |
| // and the next derivation moves h onto v1. |
| + // |
| + // The second gated attempt's done() pokes the scheduler after its |
| + // slot is free, so a derivation can run at any moment from here. |
| + // The clock goes first to the pointer read's due time, which is |
| + // still inside the host's abandon deferral: a derivation then |
| + // admits nothing, and the pass clears the marker. Only then does |
| + // the clock leave the deferral. Advancing straight past both let |
| + // that derivation run between the advance and the pass, be gated |
| + // a third time and defer the host for another abandonDeferral |
| + // (CI 2026-10-26, "timed out waiting for the move onto v1"). |
| + // pointer() is signed at the gated attempt's time, so it is newer |
| + // than the marker either way. |
| + // Times from the first pass, which read the pointers; the second |
| + // gated attempt deferred h until abandonDeferral after it ran. |
| + deferredUntil := abandonDeferral + time.Second + abandonDeferral |
| + if pointerReadEvery >= deferredUntil { |
| + t.Fatalf("pointerReadEvery %s no longer falls inside the deferral ending at %s; re-derive this timeline", pointerReadEvery, deferredUntil) |
| + } |
| h.pointer("stable", "v1", h.clock()) |
| - h.advance(pointerReadEvery) |
| + h.advance(pointerReadEvery - (abandonDeferral + time.Second)) |
| h.pass() |
| if got, ok := h.book.HoldRanOn("h"); ok { |
| t.Fatalf("marker %+v survived the signed rollback", got) |
| } |
| + if n := moves(); n != 0 || gatedTimes() != 2 { |
| + t.Fatalf("%d moves and %d gated attempts inside the deferral, want 0 and 2", n, gatedTimes()) |
| + } |
| + h.advance(deferredUntil - pointerReadEvery + time.Second) |
| + h.pass() |
| waitFor(t, "the move onto v1", func() bool { return moves() == 1 }) |
| if calls, _, _ := h.act.snapshot(); len(calls) == 1 && (worker || calls[0].a.Build != "v1") { |
| t.Fatalf("swap %+v: want one onto v1 (and none for a worker)", calls[0].a) |