fix: CC追问防压制——confirmed块让位+禁令例外扩围+伪回显示例
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -953,6 +953,21 @@ def test_contact_completion_note_serial_priority():
|
||||
assert "邮箱也留一个呗" in note and marks == ["_email_asked"]
|
||||
|
||||
|
||||
def test_reminder_cc_round_confirmed_block_yields_to_cc_note():
|
||||
"""生产验收场景①修复: CC 追问轮 confirmed 块让位——同轮两个"逐字使用这句"
|
||||
竞争时 GLM 稳定服从更显眼的 NO_CONTACT_ALREADY 确认句,压制国家代码追问。"""
|
||||
raw = {"联系方式": {"whatsapp": "0501234567"}} # 裸号 → CC 追问轮
|
||||
text = ConversationManager._build_context_reminder(raw, "yes", [])
|
||||
assert "Could you send the full number with the country code" in text # CC 句在场
|
||||
assert "Got it — our manager will reach out" not in text # 确认句让位(逐字建议消失)
|
||||
assert "本轮不要使用确认句" in text # 让位语义钉死
|
||||
# 反向钉死边界: 同画像换带前缀号(非 CC 轮) → 确认句回归
|
||||
raw2 = {"联系方式": {"whatsapp": "+966501234567"}}
|
||||
text2 = ConversationManager._build_context_reminder(raw2, "yes", [])
|
||||
assert "Got it — our manager will reach out" in text2
|
||||
assert "本轮不要使用确认句" not in text2
|
||||
|
||||
|
||||
def test_contact_completion_two_round_serial_and_persistence(async_db, monkeypatch):
|
||||
"""spec §6-6 计数持久化集成: 裸号两轮——第一轮 cc 追问注入且 _cc_asked 落库;
|
||||
第二轮客户没配合(号码仍裸),按 §4.3b 串行规则转邮箱轻补并落 _email_asked。
|
||||
@@ -974,6 +989,7 @@ def test_contact_completion_two_round_serial_and_persistence(async_db, monkeypat
|
||||
# 第一轮正向断言: cc 追问句原文确实拼进了 reminder(非仅写计数)
|
||||
assert "Could you send the full number with the country code" in ai.contexts[0]
|
||||
assert "email address would help too" not in ai.contexts[0] # 串行: cc 优先
|
||||
assert "Got it — our manager will reach out" not in ai.contexts[0] # 确认句让位(端到端)
|
||||
profile = asyncio.run(manager._get_profile(conv.id))
|
||||
assert (profile.raw_info or {}).get("_cc_asked") is True # 计数已落库
|
||||
# 第二轮: 号码仍裸 → cc 不再问,串行规则转邮箱轻补(_cc_asked 已消耗)
|
||||
|
||||
@@ -43,3 +43,21 @@ def test_system_md_contains_verbatim_note_bodies():
|
||||
for note in (_CC_NOTE_EN, _CC_NOTE_ZH, _EMAIL_NOTE_EN, _EMAIL_NOTE_ZH):
|
||||
body = _note_body(note)
|
||||
assert body in src, body[:40]
|
||||
|
||||
|
||||
def test_system_md_cc_reask_exception_in_all_five_prohibitions():
|
||||
"""生产验收场景①修复: 五处禁令例外全部扩围——号码缺国家代码时可请客户
|
||||
重发完整号一次。CC 追问是对已在手渠道的重发请求,原先只豁免缺失渠道,
|
||||
GLM 会视其为禁令压制对象(裸号追问两轮一致被压制即此根因)。"""
|
||||
src = _read_system_md()
|
||||
# 五节(语言规则/红线/对话流程/提醒配合/注意)逐一扩围,措辞锚点各落一次
|
||||
assert src.count("重发完整号一次") >= 5
|
||||
|
||||
|
||||
def test_system_md_pseudo_echo_bad_example():
|
||||
"""生产验收 r2 实测伪回显: AI 把 +966 5x xxx xxxx 掩码样例当客户号码回显
|
||||
("Got your number +966 5x xxx xxxx")——好差示例补组钉死禁止。"""
|
||||
src = _read_system_md()
|
||||
assert "Got your number +966 5x xxx xxxx" in src # 差例逐字在场
|
||||
assert "那不是客户的号码" in src # 差例定性
|
||||
assert "掩码样例当号码回显" in src # 好例禁令
|
||||
|
||||
Reference in New Issue
Block a user