From efba6ea26a92028947c7c4d0e9c84c32bd643264 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Fri, 4 Sep 2026 12:17:12 -0700 Subject: [PATCH] [eric] telemetry: every diagnostic envelope carries app_version; Alex's -11 crashes had to be dated by which fields they carried Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_01C9zwUaHucUgrdxvK8FvjYT --- backend/apps/service/client.py | 2 ++ backend/tests/test_service.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/backend/apps/service/client.py b/backend/apps/service/client.py index 951a79b9..fc537fde 100644 --- a/backend/apps/service/client.py +++ b/backend/apps/service/client.py @@ -400,6 +400,8 @@ def submit_diagnostic(diagnostic: dict) -> None: # is deliberately capturing, so only the sink-less case is blocked. if os.environ.get("PYTEST_CURRENT_TEST") and test_sink is None: return + # The build that wrote an envelope is the first thing a field read needs, and it used to be inferred from which fields were present. + diagnostic.setdefault("app_version", APP_VERSION) try: from backend.apps.service.ring_buffer import snapshot diagnostic["recent_log"] = snapshot() diff --git a/backend/tests/test_service.py b/backend/tests/test_service.py index bc9085fb..b7dc4f91 100644 --- a/backend/tests/test_service.py +++ b/backend/tests/test_service.py @@ -214,6 +214,16 @@ def test_legacy_submit_diagnostic(sink): assert len(sink) == 1 +def test_every_diagnostic_carries_the_app_version(sink): + # Alex's -11 crashes (2026-09-04) had to be dated to a build by which envelope FIELDS they carried; the version rides every envelope now. + from backend.apps.service.client import submit_diagnostic + from backend.apps.service.version import APP_VERSION + submit_diagnostic({"kind": "model_error"}) + _, body = sink[0] + assert body["d"]["diagnostic"]["app_version"] == APP_VERSION + assert APP_VERSION and APP_VERSION != "unknown" + + # --- spool ------------------------------------------------------------------- def test_buffer_enqueue_and_drain(tmp_path):