#115 Tile 1: rewire perception card to dotty-behaviour#117
Merged
Conversation
Exposes the existing PerceptionState.get_recent() ring buffer over HTTP so the bridge dashboard's perception card can fetch it. Used by the perception-rewire follow-up commit on bridge.py. Returns newest-first, capped by the `limit` query param (default 50) and bounded above by PERCEPTION_RECENT_MAX. Unknown device_id yields an empty list rather than 404 — matches the dashboard's tolerance for "no events seen yet for this device". Refs #115 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Tile 1 of #115. Replaces the empty-dict / empty-list stubs the #113 cutover left in place with live HTTP fetches against dotty-behaviour: - _dashboard_perception_state_getter → GET /api/perception/state - _dashboard_perception_recent_getter → GET /api/perception/recent/{id} Wrapped via _dotty_behaviour_get() with three load-bearing properties: - 1.5s request timeout — dashboard render must never block on a slow or dead dotty-behaviour. - 2.0s per-process result cache — HTMX polls + SSE nudges fan one refresh into multiple getter calls; the cache keeps dotty-behaviour quiet without changing the visible cadence. - Circuit breaker — any timeout / connection / HTTP / JSON error logs a warning and returns the empty fallback so the dashboard degrades to "no data" instead of 500-ing. Base URL is read from DOTTY_BEHAVIOUR_URL (default http://localhost:8090). The bridge container runs network_mode: host alongside dotty-behaviour so the default is correct in production; the env var is there for future flexibility (e.g. running the dashboard against a remote behaviour instance). Other stub getters (vision_cache, audio_cache, scene_synthesis_cache, state, last_user_line, sound_balance, vision_failures) are unchanged — those are Tiles 2-6 of #115. Bridge tests: 64 → 69 passing (+5: state/recent happy paths, timeout + connection-error degradation, cache TTL). Refs #115 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Tile 1 of #115. Rewires the dashboard's perception card from the empty-dict / empty-list stubs that #113 left behind to live HTTP fetches against
dotty-behaviour.GET /api/perception/recent/{device_id}exposing the existingPerceptionState.get_recent()ring buffer (newest-first, capped bylimitand bounded byPERCEPTION_RECENT_MAX)._dashboard_perception_state_getterand_dashboard_perception_recent_gettervia a new_dotty_behaviour_get()helper.Design (cache / timeout / circuit breaker)
The helper has three load-bearing properties for dashboard stability:
dotty-behaviourMUST NOT block the dashboard render.Base URL is read from
DOTTY_BEHAVIOUR_URL(defaulthttp://localhost:8090). The bridge container runsnetwork_mode: hostalongsidedotty-behaviour, so the default is production-correct; the env var is for future flexibility (e.g. remote behaviour host).The other dashboard stubs (
vision_cache,audio_cache,scene_synthesis_cache,state,last_user_line,sound_balance,vision_failures) are untouched — those land in Tiles 2-6.Verification
dotty-behavioursuite: 198 → 201 passing (+3: recent happy path, limit + ordering, unknown-device empty list).python -c "import bridge"→ clean.python -c "from bridge.dashboard import *"→ clean.Test plan
/uiand confirm the perception card renders live face/sound/state data fordev-1.dotty-behaviourmid-session and confirm the dashboard still renders (empty card, warning in bridge log) within ~1.5 s instead of hanging.Refs #115 — 5 more tiles to go, do not close.
🤖 Generated with Claude Code