enginereads: the event heard is kept in the node's statement (issue 1975 note 6)
mesh/delivery merged: source.main moved to novox/mesh-contracts@0e12819cc727
mesh/delivery-group group fix/engine-reads-and-compositions merged: every member is merged
mesh/check checking 04c6a1eead98 on 0e12819cc727 | novox/mesh-contracts#8 in group fix/engine-reads-and-compositions

Builds: issue 1975 note 6 (the lead's review round 1; no design line). The engine 'not yet' half is dropped there.

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 11:00:33 +01:00
parent e575659187
commit 04c6a1eead
2 changed files with 40 additions and 0 deletions
@@ -246,6 +246,22 @@ func TestAStatementOlderThanAHeardEventDoesNotStand(t *testing.T) {
t.Errorf("after the event's ask: %v, %d calls", s.ManifestReads, calls)
}
// The event heard is in the node's statement as the part keeps it, and a part that starts again holds it.
var kept []byte
keeper := &Keeper{Sync: true, Put: func(_ string, v []byte) error { kept = v; return nil }, Call: func(string, string, any) (json.RawMessage, error) {
return answer(`"seat:a"`, early), nil
}}
keeper.HeardChanged(event)
keeper.AskNode("ace", "x")
if st, err := Decode(kept); err != nil || st.Heard == nil || len(st.Heard.ManifestReads) != 2 {
t.Errorf("the kept statement shows the event heard as %+v, %v", st.Heard, err)
}
restarted := &Keeper{Sync: true}
restarted.Heard("ace", kept, false)
if got := restarted.Reads([]string{"ace"})["ace"]; len(got) != 2 {
t.Errorf("a part started again reads %v, want the event's", got)
}
// An engine that answers the old statement to every ask: the event's reads stand, the asks are bounded.
calls = 0
stuck := &Keeper{Sync: true, Call: func(string, string, any) (json.RawMessage, error) {