Repository navigation
fix(xr): live reload survives a dropped connection and refreshes data sources safely - #69
Merged
Merged
Conversation
… sources safely - live_sse_fileXR.js: one connectLiveReload() binds every handler; the old reconnect opened a bare EventSource with no handlers, so after one network error the scene stopped following re-analyses (audit CHARTS-10 / LIFECYCLE-10). The browser's own retry is left alone; a source it gave up on is reopened with back-off (1 s doubling to 30 s). Connection state is published as codexr-live-reload-status. - Cache busting reads both babia-queryjson forms, keeps existing query parameters (?revision=), skips chart slices and inline-data sources (they were pointed at '?t=…', i.e. the page itself), and strips a leaked 'url:' prefix (CHARTS-11). - analysisModeRuntime refreshNormalDataSources reads the raw declaration form, which used to turn the url into 'url: url: ./data.json' (LIFECYCLE-7). - live_sse_fileDOM.js: no reload loop on errors; reconnect with back-off and reload once when the connection is back. Tests: liveReloadClient.test.cjs (fake EventSource: reconnect, back-off, stale-source, cache-bust shapes, offline export, DOM client) and a raw-declaration refresh test. Headless check with a generated scene: after the server drops the SSE client, a 12-row re-analysis now reaches the chart (before: it stayed on the previous 20 rows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014FkKtAtQus8TVjhG9bhytC
…nto claude/project-thread-kvvyg6-sse # Conflicts: # apps/vscode-extension/CHANGELOG.md
4 tasks done
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.
Requested by Adrián · project thread
Summary
Story S2 of the XR review epic: audit findings CHARTS-10 (blocker), CHARTS-11, LIFECYCLE-7 and LIFECYCLE-10 (
docs/xr-audit/, PR #67).EventSourceerror,live_sse_fileXR.jsused to close the connection that had the handlers and open a barenew EventSource('/events')with none. From then on the scene ignored everydataRefresh/analysis-updatedand kept showing stale metrics until a page reload. Now oneconnectLiveReload()binds every handler. The browser's own retry (readyState CONNECTING) is left alone, and a source the browser gave up on (CLOSED, e.g. a 404) is reopened with back-off from 1 s doubling to 30 s. Events from a replaced source are ignored. The state is published as thecodexr-live-reload-statusevent; the visible indicator is left for S7.babia-queryjsonforms (object, raw declaration), keeps existing query parameters such as a comparison's?revision=, and skips the row-budgeted chart slices and inline-data sources. Those slices used to be pointed at?t=…, which fetched the page itself as JSON. A leakedurl:prefix is stripped.url: url: ./data.json.refreshNormalDataSourcesin the analysis-mode runtime read the raw declaration string as the URL before A-Frame initialised the component. Once that corruption happened, no later refresh could repair it. It is now parsed and healed./eventsanswers 404). It reconnects with back-off and reloads once when the connection comes back.[1.2.1]→ Fixed.Test plan
npm test: 1072/1072.test/analysis/liveReloadClient.test.cjs(fakeEventSourceand timers): reconnect keeps handlers, browser retry untouched, back-off 1→30 s and reset on open, stale source ignored, cache-bust over six URL shapes, offline export never connects, DOM client has no reload loop and reloads once on recovery.dependencyGraph.test.cjs: normal refresh from the raw declaration and from an already-corrupted URL.?t=….Generated by Claude Code