Skip to content

fix(dashboard): report undecodable 200 API bodies as degraded - #960

Open
Limm-web wants to merge 1 commit into
Scottcjn:mainfrom
Limm-web:fix/dashboard-decode-failure-degraded
Open

Limm-web wants to merge 1 commit into
Scottcjn:mainfrom
Limm-web:fix/dashboard-decode-failure-degraded

Conversation

@Limm-web

@Limm-web Limm-web commented Oct 4, 2026

Copy link
Copy Markdown

What Changed

In fetch_beacon_snapshot, a 200 response whose body failed resp.json() was replaced with {} before the outer failure handling ran, so _normalize_api_rows({}) returned [] and the snapshot kept ok=True, errors=[] with zero counts — indistinguishable from a genuinely healthy empty network. The sidebar then rendered status: OK.

  • beacon_skill/dashboard.py: a JSON decode failure on a 200 now flows into the same partial-failure path as HTTP/transport errors (ok=False, an endpoint-specific error appended, that endpoint's count 0), while valid endpoints still contribute their rows.

This is distinct from the inclusive-inbox polling and the already-fixed API base URL.

Testing / Evidence

tests/test_dashboard.py:

# before (pinned b696070): malformed contracts 200 + healthy agents -> ok=True, errors=[]
# after:                    ok=False, errors=["contracts: invalid JSON body (...)"], agents_count unchanged (1)
# control: valid-empty 200 -> ok=True, errors=[]  (still healthy)
pytest tests/test_dashboard.py -q -> 9 passed

Checklist

  • Bug fix (non-breaking)
  • Regression tests added
  • Valid endpoints preserved (no over-degradation)

Fixes #959


AI assistance disclosure: this fix, its regression test, and the report above were prepared with AI assistance; all claims were reproduced locally against the pinned source before submission.

Wallet: RTC472c6fdc74ed1d43b5c80349c32d5399e7dca92f

fetch_beacon_snapshot replaced a body that failed json() with {} before the
outer failure handling, so a 200 whose body could not be decoded left
ok=True, errors=[] and zero counts — indistinguishable from a healthy empty
network, and the sidebar showed OK. Propagate the decode failure into the
established partial-failure/error path (ok=False, endpoint error appended,
count 0) while keeping valid endpoints intact.

Fixes Scottcjn#959

Test: tests/test_dashboard.py (undecodable 200 -> degraded + valid endpoint
survives; valid-empty control still ok).
@Limm-web
Limm-web requested a review from Scottcjn as a code owner October 4, 2026 16:44
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown

Welcome to beacon-skill! Thanks for your first pull request.

Quick checklist:

  • Tests pass (pytest tests/)
  • New code includes SPDX license header
  • Focused on a single change

Bounty tiers: Micro (1-10 RTC) | Standard (20-50) | Major (75-100)

A maintainer will review your PR soon!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S PR: 11-50 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard reports API OK when HTTP200 bodies cannot be decoded as JSON

1 participant