Files
mesh-catalog/modules/mesh-mail/cmd/mesh-mail/copies_test.go
T
jochen b0e4a12c88
mesh/merge-gate head b0e4a12c8840 merged into trunk 21a499ba5976 — pass: builds mesh-mail → novox; no bus step; every machine composes with the change as i…
mesh/repo-check head b0e4a12c8840 merged into trunk 21a499ba5976 — pass: its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-…
mesh/delivery delivered
mail_send's ask: judge messenger's real words, carry the content rule at run time, match display-name recipients (issue 868, review round 1)
Review round 1: the test judged Headline+Explanation+Details, but messenger refuses an ask as a whole on
Headline, Explanation, OnExpiry and each option's Label and Does alone (asks.go's TakeAsk); Details is
filtered line by line instead (holder.go's sayOn). send.go's Ask() now builds that exact judged text and
checks it with messenger's real content rule, carried at run time as content_rule.go (messenger's
content.go, renamed, byte-identical, pinned by copies_test.go) rather than only in a test copy. When a
subject or first line the masking does not catch (an IP, a hardware address, a path-shaped reference, a
hex hash, ...) would still refuse the whole ask, the Explanation drops the subject and first lines and
points at Details instead, so the ask always reaches the operator. A recipient written with a display
name ('Name <addr>') is now matched against the operator's own accounts, and masked, by its address alone
(net/mail.ParseAddress).
2026-10-16 02:04:32 +02:00

34 lines
1.4 KiB
Go

package main
// content_rule.go is messenger's own content rule (modules/messenger/cmd/messenger/content.go, novox/hq ADR
// 0253 §3), copied here verbatim — byte for byte, only the file renamed, since Go allows nothing else to
// differ (novox/hq issue 868, review round 1). mesh-mail carries it at run time, not only in its tests: the
// ask it builds is checked against the real rule before it is published (send.go), so a subject or a first
// line the masking does not catch (an IP, a hardware address, a path-shaped reference, a hex hash, …) falls
// back to a safe explanation rather than refusing the whole ask. Messenger's content rule stays messenger's:
// this is a pinned copy, never a dependency on it, the way modules/networkmanager/cmd/uplink-tools/copies_test.go
// pins its copy of uplink.go.
import (
"bytes"
"os"
"path/filepath"
"testing"
)
func TestContentRuleCopyMatchesMessengers(t *testing.T) {
src := filepath.Join("..", "..", "..", "messenger", "cmd", "messenger", "content.go")
theirs, err := os.ReadFile(src)
if err != nil {
t.Skipf("messenger's content.go is not beside this module (%v); nothing to pin against", err)
}
mine, err := os.ReadFile("content_rule.go")
if err != nil {
t.Fatal(err)
}
if !bytes.Equal(mine, theirs) {
t.Error("mesh-mail's copy of messenger's content.go (content_rule.go) differs from " + src +
": change this copy to match messenger's content rule, verbatim, whenever it changes")
}
}