This commit is contained in:
larssand
2026-07-02 11:01:27 +02:00
parent a8c00c35b2
commit 8be716b0b9
3 changed files with 32 additions and 9 deletions

View File

@@ -76,6 +76,8 @@ def _stream_coverage(runtime_values: dict[str, object], stream_profiles: dict[st
total_fields = len(readiness)
status = status_by_id.get(stream_id, {})
enabled = next((bool(item.get("enabled")) for item in configured if str(item.get("id", "")) == stream_id), False)
events_fetched = int(status.get("events_fetched", 0) or 0)
health = "not_enabled" if not enabled else "partial_fetch" if status.get("partial") else "missing_profile" if not profile else "no_events" if events_fetched == 0 else "learning" if total_fields and ready_fields < total_fields else "ready" if total_fields else "profile_needs_fields"
rows.append({
"stream_id": stream_id,
"stream_name": _stream_name(stream_id, stream_titles, profile),
@@ -87,7 +89,7 @@ def _stream_coverage(runtime_values: dict[str, object], stream_profiles: dict[st
"ready_fields": ready_fields,
"total_fields": total_fields,
"readiness": f"{ready_fields}/{total_fields}" if total_fields else "0/0",
"events_fetched": int(status.get("events_fetched", 0) or 0),
"events_fetched": events_fetched,
"aggregate_events": int(status.get("aggregate_events", 0) or 0),
"aggregate_status": str(status.get("aggregate_status", "")),
"aggregate_schema_properties": ", ".join(str(item) for item in status.get("aggregate_schema_properties", []) if item),
@@ -97,7 +99,8 @@ def _stream_coverage(runtime_values: dict[str, object], stream_profiles: dict[st
"raw_error": str(status.get("error", "")),
"aggregate_error": str(status.get("aggregate_error", "")),
"error": str(status.get("aggregate_error", "") or status.get("error", "")),
"health": "not_enabled" if not enabled else "partial_fetch" if status.get("partial") else "missing_profile" if not profile else "no_events" if int(status.get("events_fetched", 0) or 0) == 0 else "learning" if total_fields and ready_fields < total_fields else "ready" if total_fields else "profile_needs_fields",
"health": health,
"health_detail": "No raw events returned for this stream in the current MCP poll window." if enabled and events_fetched == 0 else "",
})
return rows
@@ -465,6 +468,11 @@ def write_refreshing_status(output: str) -> None:
"status": "refreshing",
"previous_status": previous_mcp.get("status", "") if isinstance(previous_mcp, dict) else "",
"previous_error": previous_mcp.get("error", "") if isinstance(previous_mcp, dict) else "",
"previous_events_fetched": previous_mcp.get("events_fetched", 0) if isinstance(previous_mcp, dict) else 0,
"previous_raw_events_fetched": previous_mcp.get("raw_events_fetched", 0) if isinstance(previous_mcp, dict) else 0,
"previous_aggregate_events": previous_mcp.get("aggregate_events", 0) if isinstance(previous_mcp, dict) else 0,
"previous_fetch_mode": previous_mcp.get("fetch_mode", "") if isinstance(previous_mcp, dict) else "",
"previous_coverage_status": previous_mcp.get("coverage_status", "") if isinstance(previous_mcp, dict) else "",
}
current["status_cache"] = {"served_from_cache": False, "reason": "refreshing"}
write_status(current, output)