fix: 管道注册表自动修复——新组件自动登记占位
未注册脚本不再只报警——体检自动在pipeline_registry.json中 添加占位记录(verified=false, gap=自动发现待确认)。 Dad不需要做任何事,系统自愈。
This commit is contained in:
@@ -646,7 +646,27 @@ def run_check(item):
|
||||
|
||||
if unregistered:
|
||||
ok = False
|
||||
detail = f"{len(gaps)}条未验证 + {len(unregistered)}个组件未注册管道"
|
||||
detail = f"{len(gaps)}条待验证 + {len(unregistered)}个新组件未注册"
|
||||
# 自动修复:把未注册的脚本加入注册表(占位)
|
||||
try:
|
||||
for s in unregistered:
|
||||
reg["pipelines"].append({
|
||||
"id": f"auto-{s}",
|
||||
"name": f"{s}(自动发现)",
|
||||
"source": f"{s}.py (自动发现)",
|
||||
"consumer": "未知(需确认)",
|
||||
"end_user": "未知(需确认)",
|
||||
"verified": False,
|
||||
"verified_at": None,
|
||||
"gap": "自动发现的组件,数据流待确认",
|
||||
"fix": "手动编辑pipeline_registry.json完善此项",
|
||||
"deadline": "发现后3天内"
|
||||
})
|
||||
open(str(DATA / "pipeline_registry.json"), 'w').write(
|
||||
j2.dumps(reg, ensure_ascii=False, indent=2))
|
||||
detail += f" → 已自动添加{len(unregistered)}条占位记录"
|
||||
except Exception:
|
||||
pass
|
||||
elif gaps:
|
||||
ok = False
|
||||
detail = f"{len(gaps)}条管道未验证: {', '.join(gaps[:5])}"
|
||||
|
||||
Reference in New Issue
Block a user