CAT-MS1, CAT-MS2: offered and closed carry the operator-channel definition's fields (id, asker, headline, channels; id, asker, how); the page reads them

The test of the five ends holds every key of a body to the seat definition's holder events, so the router and the contract cannot drift.

Issue 1968.

Claude-Session: https://claude.ai/code/session_01JG73KJNrH5EgFXMKKYSrig
This commit is contained in:
2026-11-04 12:35:35 +01:00
parent 0d86833123
commit 91cd016f65
4 changed files with 16 additions and 12 deletions
+2 -2
View File
@@ -1445,7 +1445,7 @@ func (h *Holder) sayOffered(key string, rec AskRecord) {
on = append(on, k)
}
sort.Strings(on)
if err := h.Emit("offered", map[string]any{"key": key, "asker": rec.Asker, "headline": rec.Ask.Headline, "offered_on": on, "at": h.Now()}); err != nil {
if err := h.Emit("offered", map[string]any{"id": rec.Ask.ID, "asker": rec.Asker, "headline": rec.Ask.Headline, "channels": on}); err != nil {
h.Logf("[messenger] that the ask %s was offered could not be said: %v", key, err)
}
}
@@ -1466,7 +1466,7 @@ func (h *Holder) sayClosed(key string, rec AskRecord, outcome asks.Outcome, word
h.mu.Lock()
delete(h.offeredSaid, key)
h.mu.Unlock()
if err := h.Emit("closed", map[string]any{"key": key, "asker": rec.Asker, "headline": rec.Ask.Headline, "how": how, "at": h.Now()}); err != nil {
if err := h.Emit("closed", map[string]any{"id": rec.Ask.ID, "asker": rec.Asker, "how": how}); err != nil {
h.Logf("[messenger] that the ask %s ended could not be said: %v", key, err)
}
}
@@ -30,7 +30,7 @@ func TestTheRouterSaysWhenAnAskIsOfferedAndWhenItEnds(t *testing.T) {
ends := func() (out []string) {
for _, s := range got {
if s.event == "closed" {
out = append(out, s.body["key"].(string)+"="+s.body["how"].(string))
out = append(out, s.body["asker"].(string)+"."+s.body["id"].(string)+"="+s.body["how"].(string))
}
}
return
@@ -38,7 +38,7 @@ func TestTheRouterSaysWhenAnAskIsOfferedAndWhenItEnds(t *testing.T) {
// Answered.
submit(t, h, "mesh-delivery", heldAsk(c, "d-1"))
settle(h, c)
if len(got) != 1 || got[0].event != "offered" || got[0].body["key"] != "mesh-delivery.d-1" || got[0].body["asker"] != "mesh-delivery" {
if len(got) != 1 || got[0].event != "offered" || got[0].body["id"] != "d-1" || got[0].body["asker"] != "mesh-delivery" {
t.Fatalf("%+v", got)
}
release := ticketFor(tg.sends[0], "Release")
@@ -82,6 +82,9 @@ func TestTheRouterSaysWhenAnAskIsOfferedAndWhenItEnds(t *testing.T) {
offered++
}
for k := range s.body {
if k != "id" && k != "asker" && k != "headline" && k != "channels" && k != "how" {
t.Errorf("%s carries %s, which the seat's contract does not have", s.event, k)
}
if k == "options" || k == "tickets" || k == "token" || k == "proofs" || k == "warrant" {
t.Errorf("%s carries %s", s.event, k)
}