From a119de7d86d64ba02895fc69b1c93a9d78bf37f1 Mon Sep 17 00:00:00 2001 From: "Matt Johnson (via Claude)" Date: Wed, 10 Jun 2026 05:57:58 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20ws=20health=5Fupdate=20=E2=80=94=20add?= =?UTF-8?q?=20coverage=20pillar=20+=20gate=20broadcast=20on=20valid=20comp?= =?UTF-8?q?uted=20score?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Coverage pillar was added to mesh_routes.py in 15f2b6c but missed in the WebSocket serializer, sending undefined for coverage on every WS push. Also gates the initial health_update broadcast on composite > 0 and infra_total > 0 to prevent partially-initialized HealthScore from overwriting good REST-fetched data on the frontend. Co-Authored-By: Claude Opus 4.6 --- meshai/dashboard/ws.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/meshai/dashboard/ws.py b/meshai/dashboard/ws.py index baedd54..ff7923a 100644 --- a/meshai/dashboard/ws.py +++ b/meshai/dashboard/ws.py @@ -69,6 +69,7 @@ def _serialize_health(mesh_health) -> dict: "pillars": { "infrastructure": round(score.infrastructure, 1), "utilization": round(score.utilization, 1), + "coverage": round(score.coverage, 1), "behavior": round(score.behavior, 1), "power": round(score.power, 1), }, @@ -100,10 +101,12 @@ async def ws_endpoint(websocket: WebSocket): # Send initial state snapshot on connect health_engine = getattr(app_state, "health_engine", None) if health_engine and health_engine.mesh_health: - await websocket.send_json({ - "type": "health_update", - "data": _serialize_health(health_engine.mesh_health) - }) + score = health_engine.mesh_health.score + if score.composite > 0 and score.infra_total > 0: + await websocket.send_json({ + "type": "health_update", + "data": _serialize_health(health_engine.mesh_health) + }) # Keep connection alive, receive client keepalive pings while True: