合入遗留收口分支 nr8/l(问数据心跳不落库与事件日志清理、续跑重新核对身份、事件触发批量查询与去抖边界、子图编号与驳回出口等),W2-b 在此之上做多进程协调

This commit is contained in:
ThearchyHelios
2026-10-19 10:46:34 +08:00
67 changed files with 2386 additions and 172 deletions
+6 -2
View File
@@ -157,7 +157,10 @@ async def record(session: AsyncSession, source: Any, change: NewChange, detected
found.last_seen_at = now
found.seen_count = int(found.seen_count or 0) + 1
if found.status == "open":
found.affects, found.before, found.after = change.affects, change.before, change.after
# 影响按这一次刷新;表结构变了之后口径试算的情况(ledger/recall 记的 probes)不是探查算的,留着
probes = (found.affects or {}).get("probes") if isinstance(found.affects, dict) else None
found.affects = {**(change.affects or {}), "probes": probes} if probes else change.affects
found.before, found.after = change.before, change.after
if SEVERITY_RANK[change.severity] > SEVERITY_RANK.get(found.severity, 0):
found.severity = change.severity
return found, False
@@ -228,7 +231,8 @@ def change_out(row: SourceChange) -> dict[str, Any]:
"severity": row.severity, "summary": summary(row), "detected_at": _iso(row.detected_at),
"last_seen_at": _iso(row.last_seen_at), "seen_count": row.seen_count or 1,
"detected_by": dict(row.detected_by or {}), "basis": row.basis, "before": row.before, "after": row.after,
"affects": row.affects or {"catalog": [], "templates": [], "rules_touched": False},
# 缺的几项补上空的:只记了口径试算情况(ledger/recall 的 probes)的那种没有 catalog、templates
"affects": {"catalog": [], "templates": [], "rules_touched": False, **(row.affects or {})},
"struct_version_before": row.struct_version_before, "struct_version_after": row.struct_version_after,
"status": row.status, "resolution": row.resolution,
}