The wait-for-the-composer step settles a want again without a real sleep and counts only ghost's own tells (issue 1966)
Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i
This commit is contained in:
@@ -1605,25 +1605,21 @@ func TestTheNodesOwnCompositionIsAppliedWhenItDiffersAndARecordMoveWaitsForAYes(
|
|||||||
eventually(t, "the wait for the composer was not said", func() bool { return saidCount() == 1 })
|
eventually(t, "the wait for the composer was not said", func() bool { return saidCount() == 1 })
|
||||||
// Settled again by another want's change, it is neither said nor told again.
|
// Settled again by another want's change, it is neither said nor told again.
|
||||||
other, oraw, _ := unsigned("ghost", fpOf("8"), file("ghost", "x", "1"))
|
other, oraw, _ := unsigned("ghost", fpOf("8"), file("ghost", "x", "1"))
|
||||||
settledGhost := func() (n int) {
|
|
||||||
b.mu.Lock()
|
|
||||||
defer b.mu.Unlock()
|
|
||||||
for _, m := range b.settled {
|
|
||||||
if m == "ghost" {
|
|
||||||
n++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return n
|
|
||||||
}
|
|
||||||
settledBefore := settledGhost()
|
|
||||||
b.comps.put(other, oraw)
|
b.comps.put(other, oraw)
|
||||||
eventually(t, "ghost was not settled again", func() bool { return settledGhost() > settledBefore })
|
eventually(t, "ghost's other composition was not taken", func() bool {
|
||||||
eventually(t, "the composer was not told", func() bool { toldMu.Lock(); defer toldMu.Unlock(); return len(told) == 1 })
|
b.ag.mu.Lock()
|
||||||
|
defer b.ag.mu.Unlock()
|
||||||
|
_, ok := b.ag.comps[other]
|
||||||
|
return ok
|
||||||
|
})
|
||||||
|
// What is settled after it: web's want moves on, so ghost's settle, queued before it, has run.
|
||||||
|
want("web", fp, "")
|
||||||
|
eventually(t, "the composer was not told once", func() bool { toldMu.Lock(); defer toldMu.Unlock(); return slices.Contains(told, "ghost@"+fpOf("9")) })
|
||||||
if _, err := b.ag.Composition(context.Background(), "ghost", "", false); err == nil || !strings.Contains(err.Error(), "waits for the composer: no manifest in the composer's picture") {
|
if _, err := b.ag.Composition(context.Background(), "ghost", "", false); err == nil || !strings.Contains(err.Error(), "waits for the composer: no manifest in the composer's picture") {
|
||||||
t.Errorf("the composition read of ghost says %v, want why the composer made none", err)
|
t.Errorf("the composition read of ghost says %v, want why the composer made none", err)
|
||||||
}
|
}
|
||||||
toldMu.Lock()
|
toldMu.Lock()
|
||||||
if saidCount() != 1 || len(told) != 1 || told[0] != "ghost@"+fpOf("9") {
|
if n := slices.Index(told, "ghost@"+fpOf("9")); saidCount() != 1 || n < 0 || slices.Contains(told[n+1:], "ghost@"+fpOf("9")) {
|
||||||
t.Errorf("said %d times, told %q; want once and ghost told once", saidCount(), told)
|
t.Errorf("said %d times, told %q; want once and ghost told once", saidCount(), told)
|
||||||
}
|
}
|
||||||
toldMu.Unlock()
|
toldMu.Unlock()
|
||||||
|
|||||||
Reference in New Issue
Block a user