From 1d1ca05349206995c6f62237b370ee61029f9890 Mon Sep 17 00:00:00 2001 From: jochen Date: Mon, 23 Nov 2026 15:56:32 +0100 Subject: [PATCH] selfcompose: the hand pass is checked by the lock, not a quiet window; cite 721/AC2 Review round 1 of fd7f049e. The test of an ask while a pass runs waited a fixed 50 ms for a pass made by hand not to begin. It now checks, while the loop's pass is held, that the lock of a whole pass is taken (TryLock is false), which needs no wall time and fails at once when compose takes no lock; the pass made by hand must still end once the held pass did. Both tests of the fix cite their criterion, 721/AC2. Issue 721 (note 15, acceptance criterion 721/AC2). --- internal/selfcompose/compose_while_passing_test.go | 10 +++++----- internal/selfcompose/selfcompose_test.go | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/selfcompose/compose_while_passing_test.go b/internal/selfcompose/compose_while_passing_test.go index 96f91949..aa591940 100644 --- a/internal/selfcompose/compose_while_passing_test.go +++ b/internal/selfcompose/compose_while_passing_test.go @@ -75,16 +75,16 @@ func composeAnsweredWhileAPassRuns(t *testing.T) { case <-time.After(2 * time.Second): t.Fatal("the verb compose gave no answer while a pass ran") } - // Issue 721 note 11: a pass made by hand while the loop's runs waits for it to end, and never begins beside it. + // 721/AC2: a pass made by hand while the loop's runs does not begin until that pass ends. While the loop's pass is held, + // the lock of a whole pass is taken (no second pass can begin), and the pass made by hand ends once the held one did. byHand := make(chan struct{}) go func() { defer close(byHand) c.compose(ctx) }() - select { - case <-reached: - t.Error("a pass made by hand began while the loop's pass ran") - case <-time.After(50 * time.Millisecond): + if c.passMu.TryLock() { + c.passMu.Unlock() + t.Error("the loop's pass runs without the lock of a whole pass: a pass made by hand would begin beside it") } close(hold) select { diff --git a/internal/selfcompose/selfcompose_test.go b/internal/selfcompose/selfcompose_test.go index c3a54c67..000adc15 100644 --- a/internal/selfcompose/selfcompose_test.go +++ b/internal/selfcompose/selfcompose_test.go @@ -393,8 +393,8 @@ func testTheNodeComposesItsWantsFromTheBus(t *testing.T) { // Issue 1966 (novox, 2026-11-09): every pass names each wanted module it composed nothing of, or composed from the indexer's // manifest for want of a done build, with why, and a want it did not take; said once; the agent's word that it waits // hands a composition the node believes handed again. - // The passes of this step are made by hand on a copy of what c holds, which runs no loop (issue 721 note 11): beside c's - // loop, a pass it makes when an entry is answered composed tool too, and handed it on out (pipelines main.266, main.459, main.479). + // 721/AC2: the passes of this step are made by hand on a copy of what c holds, which runs no loop: beside c's loop, a pass + // it makes when an entry is answered composed tool too, and handed it on out (pipelines main.266, main.459, main.479). sc := c.scratch() sc.env.Running = nil // composed counts c's passes alone tfp := toolFp