Open
Conversation
Add active_conditions support to the sync protocol as a backward-compatible change, preparing for OR/NOT in WHERE clauses. Elixir client (from #3791): - Tags become {position, hash} tuples with slash-delimited wire format - active_conditions tracking and DNF visibility evaluation - disjunct_positions derived once per shape, shared across keys Server (minimal changes for simple case): - Add active_conditions field to NewRecord/UpdatedRecord/DeletedRecord - Include active_conditions in JSON headers when present - Compute active_conditions: [true, ...] for shapes with subqueries - Include active_conditions in snapshot SQL queries - Read Electric-Protocol-Version header from HTTP requests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3966 +/- ##
==========================================
+ Coverage 75.75% 77.31% +1.56%
==========================================
Files 11 37 +26
Lines 693 1671 +978
Branches 174 173 -1
==========================================
+ Hits 525 1292 +767
- Misses 167 378 +211
Partials 1 1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Summary
Introduces the
active_conditionswire format as a backward-compatible protocol addition, extracted from #3791. This allows clients to be updated to the new protocol before the server adds complex OR/NOT subquery support.Part of the work toward supporting arbitrary boolean expressions in WHERE clauses (#3791).
Changes
Elixir Client (taken from #3791)
{position, hash}tuples with slash-delimited wire format (e.g."hash_a/hash_b","hash_a/","/hash_b")active_conditionstracking: Headers now includeactive_conditions: [boolean()]indicating which disjuncts are satisfieddisjunct_positions: Derived once from the first tagged message and reused for all subsequent messages in the shapeServer (minimal changes for current simple case)
active_conditionsfield toNewRecord,UpdatedRecord,DeletedRecordstructsactive_conditionsin JSON response headers when present (viaput_if_true)active_conditions: [true, ...](always all-true in the simple single-subquery case)active_conditionsin snapshot SQL queries alongside tagsElectric-Protocol-Versionheader from HTTP requests into params schemaTest updates
Compatibility
active_conditionsin headers but ignore it (unknown field). No regression.active_conditionsfor DNF visibility. For the simple case (single subquery), behavior is identical to v1 but through the new code path.Test Plan
Generated with Claude Code