carlos / platform Public

zdd-readiness: intent tests join the manager before their temp dir is removed

TestAForeignLayoutHoldCrashReopensHeldDown released its parked Swap in a cleanup that ran just before the TempDir removal, so the attempt's done() raced the removal and wrote the book into a directory being deleted. The cleanup now opens the gate and calls Manager.Close, which joins the attempt.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev b0ab08fe792945c2d40622a57d28656ea6489346 parent f954d77
1 file changed, +10 −1
  • internal/rollout/intent_test.go +10 −1
diff --git a/internal/rollout/intent_test.go b/internal/rollout/intent_test.go
index 5af4d9cdd..d4aaa26a3 100644
--- a/internal/rollout/intent_test.go
+++ b/internal/rollout/intent_test.go
@@ -373,7 +373,16 @@ func TestAForeignLayoutHoldCrashReopensHeldDown(t *testing.T) {
h.stage("v2")
h.act.mode = activator.ModeHold // the foreign row's override
gate := h.act.hold("a")
- t.Cleanup(func() { close(gate) })
+ // The parked attempt's done() writes the failure book and ends its intent
+ // in dir once the gate opens, on a goroutine the test does not own. Cleanups
+ // run last in, first out and onDisk's TempDir is already registered, so
+ // this one opens the gate and joins the manager before dir is removed.
+ t.Cleanup(func() {
+ close(gate)
+ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
+ defer cancel()
+ h.m.Close(ctx)
+ })
h.install("v2", "a")
h.pass()
waitFor(t, "the swap to start", func() bool { _, started, _ := h.act.snapshot(); return len(started) == 1 })