feat(electric-db-collection): DNF/active_conditions support#1270
feat(electric-db-collection): DNF/active_conditions support#1270
Conversation
🦋 Changeset detectedLatest commit: d637d0f The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
More templates
@tanstack/angular-db
@tanstack/browser-db-sqlite-persistence
@tanstack/capacitor-db-sqlite-persistence
@tanstack/cloudflare-durable-objects-db-sqlite-persistence
@tanstack/db
@tanstack/db-ivm
@tanstack/db-sqlite-persistence-core
@tanstack/electric-db-collection
@tanstack/electron-db-sqlite-persistence
@tanstack/expo-db-sqlite-persistence
@tanstack/node-db-sqlite-persistence
@tanstack/offline-transactions
@tanstack/powersync-db-collection
@tanstack/query-db-collection
@tanstack/react-db
@tanstack/react-native-db-sqlite-persistence
@tanstack/rxdb-db-collection
@tanstack/solid-db
@tanstack/svelte-db
@tanstack/tauri-db-sqlite-persistence
@tanstack/trailbase-db-collection
@tanstack/vue-db
commit: |
|
Size Change: -4 B (0%) Total Size: 113 kB 📦 View Changed
ℹ️ View Unchanged
|
|
Size Change: 0 B Total Size: 4.23 kB ℹ️ View Unchanged
|
Adds 4 new test cases covering DNF scenarios: multi-disjunct partial/full deactivation, active_conditions overwrite on re-send, simple shapes without active_conditions, and mixed rows with/without active_conditions. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Important Preview package dependency: This PR currently uses a preview build of Before merging this PR, replace the preview URL with the published version (e.g. |
0d94d47 to
532e779
Compare
robacourt
left a comment
There was a problem hiding this comment.
LGTM. I've also run the oracle tests against it and they pass!
robacourt
left a comment
There was a problem hiding this comment.
We need a way for the server to reject old clients. We should increase the electric-protocol-version
…rbitrary boolean WHERE clauses Support the new Electric server wire protocol (PR electric-sql/electric#3791): - Change tag delimiter from `|` to `/`, replace `_` wildcards with empty segments (NON_PARTICIPATING positions) - Add `active_conditions` header support for DNF visibility evaluation - Shapes with subquery dependencies use DNF: a row is visible if ANY disjunct has ALL its positions satisfied in active_conditions - Simple shapes (no subquery dependencies) retain existing behavior: row deleted when tag set becomes empty - Derive disjunct_positions once per shape (not per-row like the Elixir client) since the DNF structure is fixed by the WHERE clause Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…attern to MovePattern - Rename MoveOutPattern to MovePattern in tag-index.ts and electric.ts - Add isMoveInMessage() type guard - Add processMoveInEvent(): re-activates conditions for matching rows (silent operation, no messages emitted to collection) - Refactor move-out in DNF mode to preserve tag index entries for visible rows, so move-in can find them to re-activate positions - Handle move-in in message loop and progressive mode atomic swap Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add tests ported from the Elixir client's tag_tracker_test.exs: - Move-in activates correct positions - Move-out → move-in → move-out full lifecycle cycle - Deleted rows not resurrected by move-in (tag index cleaned up) - Orphaned tag index entries don't cause phantom deletes - Deleted row cleans up ALL tag index entries - Multiple patterns deactivating same row in one call - Unit tests for parseTag, rowVisible, and deriveDisjunctPositions Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Switch to the preview package from electric-sql/electric#4043 so that move-in event types are available without unsafe casts in tests. NOTE: replace the preview URL with the released version before merging. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
a8ae8b7 to
b556178
Compare
Summary
|to/and replaces_wildcards with empty segments (NON_PARTICIPATINGpositions)active_conditionsheader support: shapes with subquery dependencies use DNF evaluation (row visible if ANY disjunct has ALL its positions satisfied), simple shapes retain existing empty-tag-set deletion behaviordisjunct_positionsonce per shape (global) rather than per-row, since the DNF structure is fixed by the WHERE clauseTest plan
/delimiter and empty-segment syntax🤖 Generated with Claude Code