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.
This commit is contained in:
sam committed 2026-09-19 01:53:52 +10:00
1 parent 3da93b8076
commit 231c067c1e
1 file changed
+6 -3
+6 -3
View File
@@ -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