fix: 终审修复——墙执行侧接租户管道(端到端回归锁)+seed补email组+措辞与死依赖清理
C-1(必须修): 墙的执行侧没接租户管道——runtime.compiled_wall 全库只有 AIService 的 $DEFLECTION_POOL 一处消费,conversation.py 执行侧全走模块级 DEFAULT_WALL(jiancai 出厂),auto 租户会话实际跑的是 jc 墙。修复: - manager 构造时 self._wall = runtime.compiled_wall(与 AIService 同源); - 6 处过滤调用(violates_boundary/no_contact_value/asks_contact 的句内 与 pending 尾巴两路)、CC 墙模板/替换句、no_contact 收尾选择、 pivot/deflection、兜底句、contact_ask 触发日志判定全部传 wall=self._wall; - _build_context_reminder/_contact_completion_note/_cc_confirm_note/ _cc_script/_cc_wall_template/_lang_note_for 加 wall=None 尾参 (None = 模块级默认墙,旧测试直调语义不变;流式侧 _contact_completion_note 双胞调用同传 wall,写回与注入不漂移); - 模块级 DEFAULT_WALL 视图常量(BOUNDARY_TRIGGER_RE/_CC_*/_EMAIL_NOTE_* 等) 保留——boundary_filter 出厂默认与旧测试锚定,boundary_filter 模块级 DEFAULT_WALL 照旧,conversation 会话流内一律租户墙; - 端到端回归锁 tests/test_wall_execution_tenant.py(两租户真 runtime + 脚本化假 AI): jc 独有 [€£] pattern 句在 jiancai 拦截替换(收尾=jc pivots 池)/auto 放行逐字流出;同一邮箱违规句两租户各自精确收到自己 no_contact["web"](12 hours vs replies fast!);contact_ask 提醒注入 各自墙文案互不渗漏。已验证模拟旧 DEFAULT_WALL 行为时三测全败。 I-1: 两租户 seed 补 email 组(以 brand_values.json 实际值为准: auto=notify_email 环境值,jiancai=品牌邮箱——其 notify_email 记录是 notify@example.com 占位): auto {sender_name: XYH, notify_emails: [18339827479@163.com]}, jiancai {sender_name: HESUPIPE, notify_emails: [hesu@hesuu.com]};seed 存裸名,From 头渲染时外层再包【】。补测 test_seed_tenants_ship_email_group: env NOTIFY_EMAIL patch 成异值证明 seed 槽胜出。 M-1/M-2: README/CLAUDE.md "platform.db 热加载"改为"文件级 registry_reload 热加载(Phase 2 升级为 platform.db)";requirements.txt 删 alembic (全库零引用,grep 实证唯一命中即该行)。 M-3/M-4(挂账): CLAUDE.md Phase 2 清理单补两项——/health 分级健康 (Phase 4 部署批次)、PromptProvider.from_dir FileNotFoundError 带路径上下文。 全量回归: 463 passed(459 基线 + 4 新增),根目录与 tests/ 子目录同数。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -103,6 +103,24 @@ def test_send_lead_email_uses_tenant_sender_and_recipients(monkeypatch):
|
||||
assert str(captured["msg"]["To"]) == "x@t.com, y@t.com"
|
||||
|
||||
|
||||
def test_seed_tenants_ship_email_group(monkeypatch):
|
||||
"""I-1(终审): 两租户 seed 自带 email 组——resolve_email_settings 各自
|
||||
返回正确收件人/发件名(auto: XYH→163 信箱; jiancai: HESUPIPE→hesuu.com),
|
||||
不再依赖 env NOTIFY_EMAIL 平台兜底(patch 成异值证明 seed 槽胜出)。
|
||||
收件人取值依据 brand_values.json: auto=notify_email 环境实际值,
|
||||
jiancai=品牌邮箱(notify_email 记录的是 notify@example.com 占位)。
|
||||
From 头渲染时外层再包【】(send_* 的 msg["From"] 拼法),seed 存裸名。"""
|
||||
monkeypatch.setattr(settings, "NOTIFY_EMAIL", "env-notify@x.com")
|
||||
from tests.conftest import build_auto_runtime
|
||||
au = email_service.resolve_email_settings(build_auto_runtime().config.data)
|
||||
jc_r = email_service.resolve_email_settings(
|
||||
build_jiancai_runtime().config.data)
|
||||
assert au["sender_name"] == "XYH"
|
||||
assert au["notify_emails"] == ["18339827479@163.com"]
|
||||
assert jc_r["sender_name"] == "HESUPIPE"
|
||||
assert jc_r["notify_emails"] == ["hesu@hesuu.com"]
|
||||
|
||||
|
||||
# ---- push ----------------------------------------------------------------
|
||||
|
||||
def _patch_push_env(monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user