From 39bc711683c019185ae098e76da4aa4e739ab2b5 Mon Sep 17 00:00:00 2001 From: stroblme Date: Sun, 23 Aug 2026 06:24:58 +0200 Subject: [PATCH] Send the portal the failure count its own tile shows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The portal card's "Failures 24h" had read 0 since failures_24h left HealthSummary: that commit noted nothing read the field, which was true of this repo and not of the portal in index/, where health is an opaque JSON blob with no schema to catch the removal. Restored on the connector rather than in /summary — no screen here reads it, and it is folded from /observability/flows?hours=24, the same endpoint and window the app's Home tile sums, so the two cannot drift apart again. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_016ZeGnqVsf5VHQqvz4HdUhN --- backend/fluksio/cloud/connector.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/backend/fluksio/cloud/connector.py b/backend/fluksio/cloud/connector.py index ab1ee0d..2152e19 100644 --- a/backend/fluksio/cloud/connector.py +++ b/backend/fluksio/cloud/connector.py @@ -255,19 +255,32 @@ class CloudConnector: Fetched through the same in-process transport as everything else, with a short-lived local token: the observability API is authenticated, and this process is entitled to mint one for the enrolling user. + + ``failures_24h`` is added here rather than by ``/summary``: it is the + portal's tile and nothing on this installation reads it, and summing + the same rollups over the same window the app's own Home tile sums + keeps the two from drifting apart the way they already did once. """ from fluksio.core import security token = security.create_access_token(config.local_user_id, timedelta(minutes=5)) + headers = {"Authorization": f"Bearer {token}"} try: async with self._client() as client: response = await client.get( - "/api/v1/observability/summary", - headers={"Authorization": f"Bearer {token}"}, + "/api/v1/observability/summary", headers=headers ) - if response.status_code == 200: + if response.status_code != 200: + return None summary: dict[str, Any] = response.json() - return summary + rollups = await client.get( + "/api/v1/observability/flows", + params={"hours": 24}, + headers=headers, + ) + if rollups.status_code == 200: + summary["failures_24h"] = sum(row["errors"] for row in rollups.json()) + return summary except Exception: logger.debug("Could not collect a health summary for the portal") return None