From ed8aa8347556f7eb2d05dc2a8d13dda243b440c5 Mon Sep 17 00:00:00 2001 From: jochen Date: Sat, 21 Nov 2026 22:46:55 +0100 Subject: [PATCH] End the composer's loop before its settings are restored fix-a-bug-met-twice, the same kind as the shadows: the composer's loop of TestTheNodeComposesItsWantsFromTheBus ran on, until the deferred cancel, past the cleanup that restores composeAgain, laterAgain, passSaysEvery and slowAfter, which its passes read. The test now cancels it and waits for its out to close first. -race -count=50: 50 of 50, no race. Suspected, not fixed: the flake "the composer handed n1.tool.7777..., and nothing changed" (trunk line 691, 1 of 60 at review, 0 of 200 here), I think a compose-again pass handing a composition late after the issue 1966 step. Builds: design 47 H H-A-312 --- internal/selfcompose/selfcompose_test.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/selfcompose/selfcompose_test.go b/internal/selfcompose/selfcompose_test.go index 8fc5ddeb..c2632498 100644 --- a/internal/selfcompose/selfcompose_test.go +++ b/internal/selfcompose/selfcompose_test.go @@ -280,6 +280,14 @@ func TestTheNodeComposesItsWantsFromTheBus(t *testing.T) { if err != nil { t.Fatal(err) } + // The composer's loop has ended (its out closed) before the test's cleanup restores composeAgain, laterAgain, + // passSaysEvery and slowAfter, which its passes read (fix-a-bug-met-twice: a goroutine outliving the setting it reads, + // as the shadows below). + defer func() { + cancel() + for range out { + } + }() // oldie is placed and no want names it (a module at a build of the old form, nats on novox): the node runs it inside // its own composition, and composes it there again, even before the agent has applied anything (Running empty). oldie := `{"module":"oldie","version":"1","capabilities":["systemd"],"resources":[{"id":"service","type":"service","unit":"oldie.service","state":"running","boot":"enabled"}]}`