Multi-client time travel debugger for lamdera live#104
Draft
CharlonTank wants to merge 1 commit into
Draft
Conversation
- Unified event timeline: every client broadcasts its state mutations (frontend msgs, backend msgs, ToBackend/ToFrontend) with the resulting wire-encoded model over the live websocket, so every tab can inspect every client's FrontendModel plus the BackendModel at any recorded instant - Master-tab scrubbing: selecting a past frame makes every connected client (other profiles, incognito windows and devices included) display its own state at that instant; debounced so fast slider drags only broadcast the final position, and clients that did not exist yet show their init state - Global restore: fork the whole system (all frontends + backend) back to a chosen point in the timeline - Detached popup viewer: real window.open popup that takes over from the inline panel, receives the full history on open via its opener, and hands back to the inline panel when closed; it has no websocket so it never counts as an app client - Fix embedded-asset staleness: extra-source-files + addDependentFile + dev-build.sh content stamp so editing live.js or the runtime harness actually rebuilds the embedded copies instead of 'Up to date' - test/scenario-time-travel: demo app with a backend-synced counter and a purely local counter to exercise both event paths, plus onConnect sync producing real BackendMsg events
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.
What
A full-stack, multi-client time travel debugger built into
lamdera live, opened from the devbar ("Time Travel").Recording is O(1) per event (frames hold references to the immutable models;
Debug.toStringonly runs lazily for rendered rows/sections), history is capped at 1000 frames.Implementation notes
extra/LocalDev/runtime-src/Lamdera/TimeTravel.elmmodule + integration inLive.elm(record points at the four state mutations, bus handling, viewer mode).extra/live.js: websocket bus relay (base64 for bytes), popup open/close lifecycle, opener→viewer postMessage relay, history dump.extra-source-files+addDependentFile+dev-build.shcontent stamp): editinglive.jsor the runtime harness now actually rebuilds the embedded copies — plaincabal buildused to say "Up to date" and silently ship stale assets.test/scenario-time-travel/: demo app (backend-synced counter + purely local counter + onConnect sync) exercising all five event kinds.How to test
Open a couple of tabs plus an incognito window, click both counters around, then hover the devbar → "Time Travel": scrub the slider (all windows follow), pop the panel out, restore to a past frame.
Verified with Playwright end-to-end suites covering single-tab (26 checks) and multi-client incl. incognito context, popup lifecycle, fast-scrub stress and global restore (27 checks).