feat: 数据流四态分类(healthy/write_only/read_only/orphan)+僵尸表清理
This commit is contained in:
+14
-3
@@ -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文件
|
||||
|
||||
Reference in New Issue
Block a user