package loop import ( "strings" "testing" ) // 本文件钉住受限(群聊/陌生人)前导片段里的**呈现口径**(审计 2026-10-30 // 的 P0-4,与 channelbridge 的第三方边界 / 公域呈现块同一口径): // // 归属只解决「谁是谁」,不解决「怎么称呼、能说什么私事」。群员被叫 // 「亲爱的」、主人的住址被复述进群,走的正是后一个缺口。因此受限档的 // 角色声明必须同时带两句:不用主人专属的亲昵称呼指代第三方;主人的私事 // 即使出现在记忆里也不外说。 // // 非受限档(多角色 Web 会话)**不带**这两句:那里没有第三方,多角色之间 // 的呈现不需要降档。 func TestAttributionRestrictedPreambleCarriesPrivacyRules(t *testing.T) { t.Parallel() l := groupLoop(t, nil) restricted := messageText(l.roleContextMessage(speakerEnv{restricted: true, current: "xilian"})) for _, want := range []string{ "亲昵称呼", "亲爱的", "住址", "姓名", "作息", "行程", "健康", "家人", "关系", "记忆", } { if !strings.Contains(restricted, want) { t.Fatalf("受限前导片段 = %q, want the presentation rule keyword %q", restricted, want) } } // 归属口径本身不许被这两句挤掉(裁决 06.4.1)。 for _, want := range []string{"发言归属", "第三方人员", "主人本人"} { if !strings.Contains(restricted, want) { t.Fatalf("受限前导片段 = %q, want the attribution rule to survive (%q)", restricted, want) } } multi := messageText(l.roleContextMessage(speakerEnv{restricted: false, current: "xilian"})) if strings.Contains(multi, "住址") || strings.Contains(multi, "亲昵称呼") { t.Fatalf("非受限前导片段 = %q, must not carry the restricted presentation rules", multi) } }