From 29dc84a38b88956dca4469a6de21cd6b137a1b62 Mon Sep 17 00:00:00 2001 From: jochen Date: Thu, 5 Nov 2026 14:56:40 +0100 Subject: [PATCH] =?UTF-8?q?operatorchannelclient:=20the=20bench=20subjects?= =?UTF-8?q?=20and=20words=20the=20router=20and=20the=20channels=20share=20?= =?UTF-8?q?(B5d;=20ADR=200634=20=C2=A71;=20issue=201966)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Claude-Session: https://claude.ai/code/session_01NcbgfFSnn24M3GcqttoU7i --- .../go/clients/operatorchannelclient/bench.go | 46 +++++++++++++++++++ .../operatorchannelclient/bench_test.go | 18 ++++++++ 2 files changed, 64 insertions(+) create mode 100644 operator-and-conversation/go/clients/operatorchannelclient/bench.go diff --git a/operator-and-conversation/go/clients/operatorchannelclient/bench.go b/operator-and-conversation/go/clients/operatorchannelclient/bench.go new file mode 100644 index 0000000..28fe858 --- /dev/null +++ b/operator-and-conversation/go/clients/operatorchannelclient/bench.go @@ -0,0 +1,46 @@ +package operatorchannelclient + +// The subjects and words of the two kinded benches a channel holds, `channel` (to show and say) and `intake` (to say +// what was chosen, and to ask a proof): the router and every channel share them (novox/hq ADR 0259 §3, ADR 0634 §1). +// The shapes carried are the seat's types (Message, Choice, LinkAsked, Failed, Standing, Code, ProofAnswer). + +// The benches. +const ( + // ChannelSeat is the kinded bench a channel holds to show and say: its accepts carry the kind. + ChannelSeat = "channel" + // IntakeSeat is the kinded bench a channel holds to say what was chosen: its events and proofs carry the kind. + IntakeSeat = "intake" +) + +// The work a channel takes, on ChannelSubject. +const ( + Show = "show" // a message offering answers + Edit = "edit" // a message shown before, replaced + Send = "send" // a message offering nothing +) + +// ChannelSubject is where the router sends a channel of a kind its work. +func ChannelSubject(verb, kind string) string { + return "mesh.seat." + ChannelSeat + ".accept." + verb + "." + kind +} + +// What a channel says, on IntakeSubject. +const ( + Chosen = "choice" // a button tapped + Link = "link" // somebody asked to be linked as the operator + FailedWhat = "failed" // a message it could not deliver + StandingWhat = "standing" // what it says of itself +) + +// IntakeSubject is where a channel of a kind says what arrived. +func IntakeSubject(what, kind string) string { + return "mesh.seat." + IntakeSeat + ".event." + what + "." + kind +} + +// CodeProof is the one proof verb: a code the operator typed, carried by request and reply, never kept. +const CodeProof = "code" + +// ProofSubject is where a channel of a kind asks a proof. +func ProofSubject(verb, kind string) string { + return "mesh.seat." + IntakeSeat + ".proof." + verb + "." + kind +} diff --git a/operator-and-conversation/go/clients/operatorchannelclient/bench_test.go b/operator-and-conversation/go/clients/operatorchannelclient/bench_test.go index f8a7512..d720639 100644 --- a/operator-and-conversation/go/clients/operatorchannelclient/bench_test.go +++ b/operator-and-conversation/go/clients/operatorchannelclient/bench_test.go @@ -56,3 +56,21 @@ func jsonEqual(a, b any) bool { y, _ := json.Marshal(b) return bytes.Equal(x, y) } + +// TestTheBenchSubjectsAreTheChannelsOwn: the subjects and words are mesh-sdk channel's, character for character. +func TestTheBenchSubjectsAreTheChannelsOwn(t *testing.T) { + for _, c := range [][2]string{ + {ChannelSubject(Show, "telegram"), channel.ChannelSubject(channel.Show, "telegram")}, + {ChannelSubject(Edit, "desk"), channel.ChannelSubject(channel.Edit, "desk")}, + {ChannelSubject(Send, "desk"), channel.ChannelSubject(channel.Send, "desk")}, + {IntakeSubject(Chosen, "telegram"), channel.IntakeSubject(channel.Chosen, "telegram")}, + {IntakeSubject(Link, "telegram"), channel.IntakeSubject(channel.Link, "telegram")}, + {IntakeSubject(FailedWhat, "desk"), channel.IntakeSubject(channel.FailedWhat, "desk")}, + {IntakeSubject(StandingWhat, "desk"), channel.IntakeSubject(channel.StandingWhat, "desk")}, + {ProofSubject(CodeProof, "telegram"), channel.ProofSubject(channel.CodeProof, "telegram")}, + } { + if c[0] != c[1] { + t.Errorf("subject %q, want %q", c[0], c[1]) + } + } +}