From 231c067c1ea38954ebf799324aece2eff69d2d7f Mon Sep 17 00:00:00 2001 From: Sam Catlow Date: Sat, 19 Sep 2026 01:53:52 +1000 Subject: [PATCH] docs(messaging): correct the Sender field's role-discrimination claim Message.Sender's doc comment asserted "role discrimination uses Role, never this field", which the code contradicts: at the gateway wire boundary Role is deliberately dropped and rebuilt from Sender via RoleForSender, and the wire carries no role field at all. The comment was wrong, not the code. gatewayrpc already documents the design (values.go:28, server.go:152 -- "The wire carries no role; both sides derive from ... messaging.RoleForSender"), and RoleForSender's own comment states the rule. Only the Sender comment disagreed, so it is corrected to say that Role is authoritative in-process while Sender is preserved for the wire reconstruction, history search, and transcript rendering. Resolves .local/issue-tracker messaging-2. Doc-only: no behaviour change. --- internal/domain/messaging/message.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/domain/messaging/message.go b/internal/domain/messaging/message.go index dc57d616b..488f0102a 100644 --- a/internal/domain/messaging/message.go +++ b/internal/domain/messaging/message.go @@ -75,9 +75,12 @@ type Message struct { // Sender is the channel-native display attribution (e.g. a Telegram // username) recorded when the message was written. Like SourceID it - // is external correlation metadata, never the canonical identity: - // role discrimination uses Role, never this field. It is preserved - // so history search and transcript rendering keep working. + // is external correlation metadata, never the canonical identity: the + // canonical Role field is authoritative in-process. At the gateway wire + // boundary (internal/infrastructure/gatewayrpc) Role is deliberately + // dropped and rebuilt from Sender via RoleForSender, so Sender is also + // preserved for that reconstruction and for history search and + // transcript rendering. Sender string // SenderID is the channel-native stable identifier for the party that