feat(channels): 陌生人私聊正常聊天(跳概率门)+ 强制流控 6条/分与回合槽位 + 安静时段不再硬静默 + 受限车道边界行前置
- 陌生人私聊:不再走「值不值得回」的概率门,唯一闸门 = 每发送者 6 条/分滑窗 + 同会话 1 个在跑回合 - 被限流只登记不回,且留带 source 的可见告警(不静默) - 安静时段在回复侧只作信号(规则层不再静默),群聊取消夜间静默 - 锁定流控常量:FlowDirectDefault 加字面量钉桩测试(放大它 = 静默关流控,且会让额度循环跑百万轮)
This commit is contained in:
1 parent
c6f5c3fea0
commit
7ae4298871
10 files changed
+654
-118
No files matched your search
@@ -104,7 +104,8 @@ func TestFlowGate_OwnerPrivateBypassesGate(t *testing.T) {
|
||||
|
||||
// TestFlowGate_GateOptionsDefaults 钉住「配置→限制」的解析规则,
|
||||
// 它保证旧的 CHANNELS_JSON 账号向后兼容:键缺失 → 关闭,0 → 保护性
|
||||
// 默认值,负值 → 关闭,正值 → 固定为该值。
|
||||
// 默认值,负值 → 关闭,正值 → 固定为该值。**私聊(陌生人)限流是例外**:
|
||||
// 它不读配置键,恒取保护性默认(裁决③:陌生人必须有流控)。
|
||||
func TestFlowGate_GateOptionsDefaults(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -135,6 +136,12 @@ func TestFlowGate_GateOptionsDefaults(t *testing.T) {
|
||||
if opts.MaxMessages != c.max {
|
||||
t.Fatalf("MaxMessages = %d, want %d", opts.MaxMessages, c.max)
|
||||
}
|
||||
// 陌生人私聊的强制流控不随账号配置开关:无论群聊/上限怎么配,
|
||||
// 私聊限流恒为保护性默认(主人 2026-10-05 裁决③)。
|
||||
if opts.DirectMsgPerMin != adapter.FlowDirectDefault {
|
||||
t.Fatalf("DirectMsgPerMin = %d, want the protective default %d",
|
||||
opts.DirectMsgPerMin, adapter.FlowDirectDefault)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user