Repro: unconstrained liveArray never receives membership events from query subscriptions - #44
Closed
jimmy-phantom wants to merge 1 commit into
Closed
Repro: unconstrained liveArray never receives membership events from query subscriptions#44jimmy-phantom wants to merge 1 commit into
jimmy-phantom wants to merge 1 commit into
Conversation
…rship events Pins current behavior of the live list pattern (REST list query with an unconstrained sorted liveArray plus config.subscribe): field updates to existing rows merge and re-sort, but create/update for unseen ids never insert and delete never removes. The default event-source constraint registers under the result root entity key while query subscriptions stamp events with the query key, so routing never matches. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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
Adds a passing test that pins current behavior of the "live list" pattern: a REST list query whose result is a sorted, unconstrained
liveArray, withgetConfig().subscribepushingupdateevents for upserted rows anddeleteevents ({ id, data: id }) for removals.updateon existing row's fieldsupdatechanging a sort fieldupdatefor unseen idcreatefor unseen iddeletefor existing rowSo only rows present at fetch time ever update; membership never changes.
Why
An unconstrained liveArray registers under the default constraint
[[EVENT_SOURCE_FIELD, parent.key]], where parent is the query result's root entity (createLiveCollectioninLiveCollection.ts). Query subscriptions stamp events with__eventSource = queryKey(reconcileSubscriptioninQueryResult.ts). The two keys are derived differently and never agree, soConstraintMatcher.routeEventnever delivers membership events to the binding.Field updates still work because they flow through the entity merge path in
applyMutationEvent, which does not depend on constraint routing.Behavior is identical in the published 0.2.1 dist and current source. The existing suite doesn't catch this: the only unconstrained-liveArray test asserts initial parse only, and every membership test uses explicit
constraints.Notes
The test asserts the current broken behavior (with the broken cases marked
BROKENin comments) so it runs green as documentation. Once the routing is fixed, flipping those assertions turns it into the regression test.🤖 Generated with Claude Code