fix: 管道注册表自发现+未登记组件报警
- 自动发现:对比重要脚本列表和管道注册表 - 漏登记的不但要手动注册,体检会报"N个组件未注册管道" - 逼着新增组件时把数据流定义进pipeline_registry.json
This commit is contained in:
@@ -611,13 +611,39 @@ def run_check(item):
|
||||
elif check_spec == "pipeline:registry_audit":
|
||||
ok = True
|
||||
gaps = []
|
||||
unregistered = []
|
||||
try:
|
||||
import json as j2
|
||||
reg = j2.loads(open(str(DATA / "pipeline_registry.json")).read())
|
||||
for p in reg.get("pipelines", []):
|
||||
if not p.get("verified"):
|
||||
gaps.append(p["name"])
|
||||
if gaps:
|
||||
|
||||
# 自动发现:对比cron脚本列表和注册表,漏登的报警
|
||||
known_sources = set()
|
||||
for p in reg.get("pipelines", []):
|
||||
src = p.get("source", "")
|
||||
for s in ["morning_health_check", "intraday_health_check", "strategy_review",
|
||||
"xiaoguo_scanner", "xiaoguo_signal_consumer", "data_governance",
|
||||
"price_monitor", "stale_push_wlin", "per_stock_reassess",
|
||||
"macro_context_collector", "divergence_detector", "macro_signal_consumer",
|
||||
"self_todo_executor", "strategy_evaluator", "hk_rate"]:
|
||||
if s in src:
|
||||
known_sources.add(s)
|
||||
# 检查是否有重要脚本未出现在任何管道定义中
|
||||
all_scripts = ["morning_health_check", "intraday_health_check", "strategy_review",
|
||||
"xiaoguo_scanner", "xiaoguo_signal_consumer", "data_governance",
|
||||
"price_monitor", "stale_push_wlin", "per_stock_reassess",
|
||||
"macro_context_collector", "divergence_detector", "macro_signal_consumer",
|
||||
"self_todo_executor", "strategy_evaluator"]
|
||||
for s in all_scripts:
|
||||
if s not in known_sources:
|
||||
unregistered.append(s)
|
||||
|
||||
if unregistered:
|
||||
ok = False
|
||||
detail = f"{len(gaps)}条未验证 + {len(unregistered)}个组件未注册管道"
|
||||
elif gaps:
|
||||
ok = False
|
||||
detail = f"{len(gaps)}条管道未验证: {', '.join(gaps[:5])}"
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user