Repository navigation
A relationship is compared by its related IDs: =~ null is an empty set (v1.34.0) - #205
Merged
Merged
Conversation
…t (v1.34.0) - =~/!~ with null (a null parameter, [null]) on a relationship field (to-one entity/EntityReference, to-many List/EntityReferenceList) is an empty set of IDs, as []: =~ matches none, !~ all (was IS NULL / IS NOT NULL); a null in the list is ignored. Memory and SQL. - ==/!= with [] on a relationship is as with null (memory matched none/all). - Fix: `store == ?` with [] resolved [] as an entity ID (memory error). - KeyCondition.isRelationshipKey (cached per entity handler). - Tests: 'Relationship operators: by ID, on every adapter', expectations from a model of each entity's related IDs, over closedStores, stores, owner and userInfo; owner =~ null updated. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #205 +/- ##
==========================================
+ Coverage 95.83% 95.85% +0.01%
==========================================
Files 75 75
Lines 26359 26519 +160
==========================================
+ Hits 25261 25419 +158
- Misses 1098 1100 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…(any field) - x =~ null / x =~ ? with null: none, as x =~ [] (was IS NULL); !~: all. KeyConditionINBase.valuesAsList(null) is []; a single null parameter is an empty set (memory and SQL). - x == [] / != [] (also a parameter []): as == null / != null, for any field (memory matched none/all; SQL already IS NULL / IS NOT NULL). - An explicit null element (=~ [null], [3, null]) still matches a null, except for a relationship (ignored: it never has a null ID). - Tests updated and added: text, numbers, a to-one's and a to-many's fields; unit tests for the SQL and memory encodings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…Ds; photo - SQL _isRelationshipKey: by the field's declared type (as memory), not the DB's foreign keys (User.photo: a String ID without one). - KeyCondition.isRelationshipType / isToManyType: a List of an entity type only (not a List of enums or other classes); used by isRelationshipKey and hasToManyInKeyPath. - An EntityReference/EntityReferenceList parameter is compared by its ID(s) (memory and SQL). - ==/!= with [x] is with x, and a reference with its ID (memory, as SQL): _equalsRightValue (replaces _isEmptyListValue). - Encoder: an entity as a value of a String/int ID column is its ID (was its toString); a primitive value for an entity type is already an ID. - Memory: a to-one stored by another adapter (Photo) keeps its ID when not found (was null: photo == null matched every user). - Tests: photo, EntityReference/EntityReferenceList and Set parameters, == [id], &&/|| combinations; CHANGELOG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- == [v] / != [v] / =~ [v] / !~ [v] literals on a number and a text. - A relationship's == ? / != ? with an entity parameter. - A to-many relationship's count and limit/offset pages: each entity once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nresolved to-one - ==/!= with a list on a list or binary field (List<String>, Uint8List): compared as a whole again (`[x]` as `x` only for other fields); `== []` is still IS NULL. - Memory =~/!~ of a path ending in a reference (owner.userInfo =~ ?): references as parameters by their IDs, as SQL. - Memory: a path through an unresolved to-one (another adapter's entity, a missing row): its ID field is the ID, other fields null (failed). - Tests: list/binary == and != (unit), owner.userInfo with references, != ? with [id]; CHANGELOG: list fields, reference lists with ==, known difference (a String ID for an int ID), Markdown lists. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…null - Encoder: a one-element list is unwrapped first (unless the field is a list or binary), so its enum is its name and its entity its ID (SQL compared their toString). - Memory: == null / != null of a list field: a list is a value, also with a null element (was "any element null"). - Tests: an enum/entity in a one-element == ? list, roles.id == [], roles.type =~ ? with null, stores.number (=~ null, [null], == []), a list field with a null element (unit). - CHANGELOG: the to-one path entry corrected (a missing row; a path through another adapter's entity isn't supported), == with a 2+ values list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Its IDs subquery (id IN ( SELECT ... )) may not keep the table order (PostgreSQL's hash semi-join): without an explicit order, ORDER BY id, as its plain JOIN (and memory) returned it. Found running menu_ici_api's tests on PostgreSQL (spot_module_test: selectEstablishmentsBySharedSpotID). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
db_users on memory, SQLite and PostgreSQL (one container), --repeat 5. Memory and SQLite: the PR within noise of 1.32.1 (1.33.0's SQLite dip on byState/list/count gone); PostgreSQL 1-9% lower, as count (none of the changed code) is: the container's drift. Memory remove/count lower than 2026-10-14 on all three versions: older than these fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Encoder: the entity branch's `[]`/`[x]` unwrap is unreachable since the unwrap at the top (removed). SQL: a relationship's IN with a non-list null is unreachable (=~ null is [], a lone null parameter an empty set; removed). - Tests: an EntityReferenceList parameter on a path ending in a reference (owner.userInfo =~ ?), and a path through an unresolved to-one (its ID field the ID, other fields null). - HISTORY: PostgreSQL A/B alternating 1.32.1 and the PR on one container: within 1.5% (the sequential runs' drop was the container's drift). Co-Authored-By: Claude Opus 5.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.
On a relationship field,
=~/!~now treatnullas an empty set of IDs, and==/!=treat[]likenull. This applies to a to-one (an entity or anEntityReference) and to a to-many (aListof entities or anEntityReferenceList), on every DB adapter.store =~ null,=~ [null],=~ ?withnullIS NULL(no related entity)=~ []store !~ nullIS NOT NULL!~ []store =~ [1, null]IN (1) OR IS NULLIN (1)stores == [],!= []IS NULL/IS NOT NULL; memory: none / all== null/!= null) on bothowner == ?with[]== nullUnchanged:
number =~ nullis stillIS NULL;store.name =~ null,roles.type == null;store == null/store != null.Tests: a new shared DB test,
Relationship operators: by ID, on every adapter, computes the expected results from a model of each entity's related IDs. Each case is also checked through!(...).=~/!~with[],null,[null], an ID,[id],[id1, id2]and[id, null], each as a literal, a?parameter and a?:nameparameter. Entities as parameters too.==/!=withnull,[]and IDs.Address.closedStores(EntityReferenceList),Address.stores(List),Store.owner(entity) andUser.userInfo(EntityReference).Local results: memory (+256) and SQLite (+224) pass, as do the condition, encoder and SQL unit tests. PostgreSQL, MySQL and the full suite run in CI.
🤖 Generated with Claude Code