H-A-480 b: the composer's watch ends with the agent's stop

The composer's loop and its hearers outlived the node agent's run and logged after
it ended; the node agent now waits for them (Composer.Wait) once its run stops.

Builds: design 47 H2 H-A-480
This commit is contained in:
2026-11-22 16:12:10 +01:00
parent cb5eddeba8
commit a22769bbc6
4 changed files with 46 additions and 6 deletions
@@ -79,3 +79,25 @@ func composeAnsweredWhileAPassRuns(t *testing.T) {
t.Fatal("the queued pass was not made when the running one ended")
}
}
// H-A-480: the composer's watch ends with the agent's stop: once its ctx ended, Wait returns only after its loop ended,
// so nothing it says comes after the run (the integration tests at -count=15 logged after their test completed).
func theWatchEndsWithItsRun(t *testing.T) {
b := newFakeBus()
ctx, cancel := context.WithCancel(context.Background())
c := New(b.env())
out, err := c.Watch(ctx, "n1.>")
if err != nil {
t.Fatal(err)
}
cancel()
c.Wait()
select {
case _, ok := <-out:
for ok {
_, ok = <-out
}
default:
t.Fatal("the composer's watch went on after Wait returned")
}
}