diff --git a/scripts/intraday_health_check.py b/scripts/intraday_health_check.py index b66f35c..c0c4e02 100644 --- a/scripts/intraday_health_check.py +++ b/scripts/intraday_health_check.py @@ -118,6 +118,22 @@ def check_signal_pipeline(): pass log(unproc < 30, f"信号堆积: {unproc}条未处理(需<30)") + # 宏观风险状态检查 + try: + risk_path = DATA / "macro_risk_state.json" + if risk_path.exists(): + risk = json.loads(risk_path.read_text()) + level = risk.get("level", "none") + reason = risk.get("reason", "") + if level == "high": + log(False, f"🔴 宏观风险HIGH: {reason[:80]}") + elif level == "medium": + log(True, f"⚠️ 宏观风险MEDIUM: {reason[:80]}") + else: + log(True, "无宏观风险状态文件(可能未生成)") + except: + pass + def write_todos(): if not ISSUES: diff --git a/scripts/morning_health_check.py b/scripts/morning_health_check.py index f2f09dc..594cd4a 100755 --- a/scripts/morning_health_check.py +++ b/scripts/morning_health_check.py @@ -604,11 +604,27 @@ def run_check(item): elif check_spec == "meta:checklist_completeness": ok, detail = check_meta_checklist_completeness() elif check_spec == "pipeline:xiaoguo_signal_flow": - # 综合检查:小果有数据→被我处理 today_xiaoguo, d1 = check_db_table_count("signal_news", "created_at", None, "today", 0) unproc, d2 = check_db_table_count("signal_news", None, None, "unprocessed", 30) ok = today_xiaoguo or unproc detail = f"today_xiaoguo={d1}, unprocessed={d2}" + elif check_spec == "pipeline:registry_audit": + ok = True + gaps = [] + 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: + ok = False + detail = f"{len(gaps)}条管道未验证: {', '.join(gaps[:5])}" + else: + detail = f"全部{len(reg['pipelines'])}条管道正常" + except Exception as e: + ok = True + detail = f"注册表不可读({str(e)[:60]})" else: ok = False detail = f"unknown_check:{check_spec}"