Skip to content

fix: hand off older query graphs to live subscriptions - #241

Open
patrickleet wants to merge 2 commits into
feat/literal-text-filterfrom
fix/live-snapshot-graphs
Open

fix: hand off older query graphs to live subscriptions#241
patrickleet wants to merge 2 commits into
feat/literal-text-filterfrom
fix/live-snapshot-graphs

Conversation

@patrickleet

Copy link
Copy Markdown
Collaborator

Why

A live query could remain empty after successful SSR hydration even while the server delivered new rows. If one of those rows referenced a relationship already seeded by another query (for example, a layout), the replica rejected the entire incoming graph as incomparable. The subscription stayed active and reported no query error, leaving the page stuck until reload.

What changes

Record a local subscription-start fence. Snapshot delivery may take over relationships owned by queries that preceded that subscription. It still cannot overwrite an independently active live stream or query ownership acquired after it started. Server causal vectors, record clocks, authorization fences, and disposal fencing remain unchanged.

For example, a page can start with an empty list, then receive a newly created item referencing an owner already loaded by its layout. The item now appears through the existing subscription without polling or reloading.

Validation

  • Reproduced the empty-list failure in an isolated protocol test before the fix.
  • JavaScript build passes.
  • All 377 JavaScript tests pass, including 46 protocol tests.
  • Regression coverage includes initial insertion, relationship change, removal, rejection of later query ownership, and the existing incomparable-live-stream protections.

No user-facing UI copy is added. Documentation describes the handoff and its limits.

Stacked on #240 so it uses the same tested v5 runtime baseline; this PR contains only the subscription handoff fix.

@coderabbitai

coderabbitai Bot commented Sep 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 890fce69-b313-4560-823f-de53bd278d4a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant