Repository navigation
prototype(runtime): reactive query loop across two browsers - #343
Closed
allisonmahmood wants to merge 1 commit into
Closed
allisonmahmood wants to merge 1 commit into
allisonmahmood wants to merge 1 commit into
Conversation
Prototype, not for merge. Part of #313. A subscription is a tier 1 read op re-run through Runtime.dispatch under the stream's own admission whenever the table it names is written. The after-commit hook sits in dispatch after the mutation's record returns success and carries keys only. One SSE stream per document from the shell broker, forwarded to the frame as a subscription event; must-resync on reconnect; company Postgres subscriptions refuse loudly. The Playwright spec runs every hard case and prints measured numbers: pnpm test:prototype-reactive. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This was referenced Sep 22, 2026
1 task 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.
Prototype, not for merge. Part of #313.
The reactive-query model on the Tier 2 map has only been argued on paper: a subscription is a read the patch already knows, re-run through the runtime's one dispatch point under the subscriber's own binding whenever a table it names is written. This throwaway loop builds exactly that on the dev stack so the hard cases can be measured instead of guessed.
What is here: an in-process after-commit wake in
Runtime.dispatch(keys only,table:<patch>/<name>), one SSE stream per open document from the shell broker forwarded to the frame as asubscriptionevent,patchy.tables.<t>.list.subscribe(args, onSnapshot)on the client with refcount, grace window and a per-subscription revision, trailing-debounce coalescing with one re-run in flight and a separate ceiling, must-resync on reconnect, and a loud refusal forpostgres.*. Every file is markedPROTOTYPE for #313.Measured on this machine (Chromium,
pnpm test:prototype-reactive, 8 cases in 2.0 minutes):access_denied, 0 snapshots leaked; an expired session stops it withsession_expired121 ms after the next write.must-resyncthen a fresh snapshot, 0 duplicates dropped client-side; a 10 s offline window delivered the missed write exactly once on return.postgres.*subscription:invalid_requestwith a clear message, never a downgrade.Try it
Dev stack, by hand:
pnpm dev, sign in, and publish any tier 1 patch whose client callspatchy.tables.<t>.list.subscribe({}, render)(the fixture attest/browser-tier1/reactive-prototype-client.tsis a complete example).resyncing, thenup-to-date.Every hard case with numbers, one command:
pnpm test:prototype-reactive(offline Playwright, isolated server and Postgres, two browser contexts as two users).Built by Claude Fable 5.1 via Claude Code (subagent)
🤖 Generated with Claude Code