chore(sync): zsy_developcc 全量同步至 qyqy_develop(W26 口径)

- 分支内容对齐 qyqy_develop b6ec3aa,树完全一致(同步后 git diff 为空)
- 覆盖本轮全部交付:客服 Agent 重构(安全路由 / 五出口 / 记忆与画像 / RAG 全链路)
  + 开发文档 62 份编号体系(D1.1 v1.17 索引)
  + 新增 D2.10-客服Agent端到端答辩文档-2026-09-21.html
- 基线:e239eb7(2026-09-17 品牌口径统一快照),本提交为其直接后继
This commit is contained in:
张胜宇
2026-09-21 21:26:30 +08:00
parent e239eb778b
commit 9675df8453
330 changed files with 111939 additions and 8681 deletions
@@ -106,6 +106,7 @@ def profile_row(**overrides: Any) -> dict[str, Any]:
"preferred_asset_class": ["bond_fund"],
"risk_tags": ["balanced"],
"behavior_score": 61,
"customer_tier": "platinum",
"total_asset": "860000.00",
"last_active_at": NOW,
}
@@ -143,6 +144,35 @@ def test_snapshot_is_projectable_by_the_read_path() -> None:
assert projected["assessment_expired"] is False
def test_snapshot_carries_customer_tier_from_its_authority() -> None:
"""客户分层必须进快照,且取数自 `sys_user`(`D3.1` §3.5 / `DEC-19` 的受准只读字段)。
回归背景:`REQUIRED_SNAPSHOT_FIELDS` 曾把 `customer_tier` 排除在外,于是「白名单要它、
写侧没有它」长期分叉 —— 客服侧症状是「我够哪一档?」只能拿风险等级顶包。
"""
snapshot = build_snapshot(profile_row(), assessment_row(), now=NOW)
assert snapshot["customer_tier"] == "platinum"
assert project_profile(snapshot, now=NOW)["customer_tier"] == "platinum"
assert "customer_tier" in REQUIRED_SNAPSHOT_FIELDS
def test_json_null_literal_is_not_a_preference() -> None:
"""JSON 列里的字面量 "null" 是"没有值",不能被当成一个叫 null 的偏好。"""
snapshot = build_snapshot(
profile_row(preferred_asset_class="null"), assessment_row(), now=NOW
)
assert snapshot["preferred_asset_class"] == []
def test_json_string_value_loses_its_serialization_quotes() -> None:
"""JSON 列里的字符串值不能带着序列化外层引号进快照(实测会长成 `"\\"自述:...\\""`)。"""
snapshot = build_snapshot(
profile_row(risk_tags="\"自述:preference:communication=短信通知优先\""),
assessment_row(), now=NOW,
)
assert snapshot["risk_tags"] == ["自述:preference:communication=短信通知优先"]
def test_expired_assessment_is_marked_expired_in_snapshot() -> None:
"""过期测评必须在快照里标成过期(与读取侧"按当前时间重算"同向)。"""
snapshot = build_snapshot(profile_row(), assessment_row(valid_days=-45), now=NOW)