fix: T-04 复审闭环——P2-1 test_chat 夹具补 _risk_repo 打桩(防越权双写写脏演示 MySQL)/P3 归属码改为显式集合+前缀兜底/truncated 判定多取 1 条防恰好 500 误报, 321 绿

This commit is contained in:
2026-09-07 09:51:38 +08:00
parent 40a9ee21a6
commit 1216d26083
3 changed files with 15 additions and 4 deletions
+5 -2
View File
@@ -78,8 +78,11 @@ def query_holdings(
显式提示截断,避免静默给出偏小口径。
"""
repo = core_ro or CoreReadOnlyRepository()
rows = repo.list_holdings(customer_id, limit=HOLDING_FETCH_LIMIT)
truncated = len(rows) >= HOLDING_FETCH_LIMIT
# 多取 1 条用于判定是否真被截断(恰好 500 笔不误报)
rows = repo.list_holdings(customer_id, limit=HOLDING_FETCH_LIMIT + 1)
truncated = len(rows) > HOLDING_FETCH_LIMIT
if truncated:
rows = rows[:HOLDING_FETCH_LIMIT]
total = sum((r.get("market_value") or 0) for r in rows)
return {
"total_count": len(rows),