[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 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01C9zwUaHucUgrdxvK8FvjYT
This commit is contained in:
ciregenz
2026-09-04 12:17:12 -07:00
co-authored by Claude Fable 5.1
parent 8f8cadea79
commit efba6ea26a
2 changed files with 12 additions and 0 deletions
+2
View File
@@ -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()
+10
View File
@@ -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):