feat: 数据流四态分类(healthy/write_only/read_only/orphan)+僵尸表清理

This commit is contained in:
知微
2026-07-08 19:43:04 +08:00
parent 9e3c2ef170
commit 84a147b6f2
2 changed files with 24 additions and 7 deletions
+14 -3
View File
@@ -394,7 +394,17 @@ def build_report():
has_output = len(readers) > 0
# 排除系统表
is_system = tname.startswith("sqlite_") or tname.startswith("_")
orphan = (not has_input or not has_output) and not is_system and cnt > 0
if is_system:
continue
# 数据流状态:healthy / write_only / read_only / orphan
if has_input and has_output:
flow_status = "healthy"
elif has_input and not has_output:
flow_status = "write_only"
elif not has_input and has_output:
flow_status = "read_only"
else:
flow_status = "orphan"
entities.append({
"name": tname,
"desc": TABLES_DESC.get(tname, ""),
@@ -403,8 +413,9 @@ def build_report():
"writers": writers[:10],
"has_input": has_input,
"has_output": has_output,
"orphan": orphan,
"warn": orphan or (cnt == 0 and tname not in ("capital_flow_cache","")),
"orphan": flow_status in ("orphan", "read_only", "write_only"),
"flow_status": flow_status,
"warn": flow_status != "healthy",
})
# JSON文件