You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1065660
Browse filesBrowse the repository at this point in the historyBrowse files
test(driver-memory,driver-sql): pin $contains membership on every memory face; one seam; docblock and sweep
- memory-20874-contains-membership.test.ts: driver-sql's #17590 fixture row
for row, plus the stored shapes SQLite decides (scalar, object, nested
array, null/boolean/fractional members), through find() in both spellings,
count(), the analytics query and its SQL echo executed on sql.js, and the
nested-relation lowering's driver input.
- driver-sql #17590 suite: a multi-valued lookup column and the u1/u10 case.
- driver-memory: one public seam, filterContainsTest; the analytics echo
reads its member set off the test the $match exit runs.
- spec: the $contains docblock's stale driver-memory status and dead tracker
link are replaced with the measured status.
- the rest suite header and the pending #20802 changeset no longer state the
in-memory gap.
Claude-Session: https://claude.ai/code/session_01Ujdtvqs7ree7WyQmEDwEnG
Co-authored-by: Claude <noreply@anthropic.com>
|`{ owner: { region: "APAC" } }` (no owner matches) |`INVALID_FILTER` / 400 | no rows |
27
27
28
-
On the in-memory driver, a multi-valued relation's `$contains` still matches a stored id by substring per element, so there an id that is a substring of another stored id (`u1` inside `u10`) also matches; SQLite and PostgreSQL match the element.
28
+
SQLite, PostgreSQL and the in-memory driver match the element of a multi-valued relation, so an id that is a substring of another stored id (`u1` inside `u10`) does not match it.
fix(driver-memory): `$contains` / `$notContains` on a multi-valued or JSON-stored field answer by membership, as the SQL drivers do
6
+
7
+
Clause-②: no
8
+
9
+
On a field whose declaration makes it JSON-stored (`multiple: true` on a `lookup`, `user`, `select`, `radio`, `file` or `image` field, a `multiselect`, `checkboxes` or `tags` field, or a structured type such as `json`), the in-memory driver now answers `{ field: { $contains: v } }` by whole-element membership: some element of the stored array equals `v`. It used to match each element by substring, so `u1` matched a row storing `['u10']` and `'red'` matched a row storing `['redwood']`. A number member answered nothing: `{ nums: { $contains: '1' } }` missed `[1, 2]`. `$notContains` is the exact complement, and a row with no value still satisfies it. A scalar text column keeps the case-exact substring test.
10
+
11
+
`driver-sql` gives the same answer on SQLite, PostgreSQL and MySQL; the two drivers were measured over the same fixture. The answer holds on every face of this driver:
12
+
13
+
-`find()` and `count()`, in both filter spellings;
14
+
- the nested-relation filter on a multi-valued relation, which the engine lowers to one `$contains` per related id;
15
+
-`MemoryAnalyticsService`'s query, and its SQL echo, which now renders SQLite's `json_each` membership construct for such a column.
16
+
17
+
The comparand is still a string. A number or boolean member is named by its text: `'1'` matches the stored number `1` (and `'1.50'` the number `1.5`), `'true'` matches the boolean `true`, and `'null'` matches a `null` member. A field the driver holds no declaration for, such as a field on an object never passed through `syncSchema`, keeps the substring reading.
18
+
19
+
New: `InMemoryDriver.filterContainsTest(object, field, value)` returns the one test every face above lowers `$contains` to. It is a narrow seam for the analytics face, beside `filterSubstringPattern` and `filterComparandStorageForm`. The added public method is why this entry is `minor`.
20
+
21
+
**If your tests relied on the old answer:** on the in-memory driver, a filter that matched an id by prefix or a tag by substring now returns only the member rows. That is what SQL already returned in production. Write `$contains` with the whole member value.
0 commit comments