Skip to content

fix(service-analytics): draft preview answers $contains on a multi-value field as membership - #36675

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36189-preview-contains-membership
Nov 23, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/issue-36189-preview-contains-membership

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #36189
Clause-②: no
Metadata-protocol: none

repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7

维护者速读

  • 用户能看到什么变化:作者在 Studio 里预览草稿数据集或仪表盘时,按多值字段(标签、多选)筛选「包含」,预览的计数现在和发布后一致;文本字段的「包含」也改为区分大小写,和发布后一致;「不包含」在预览里不再报错,而是给出和发布后相同的结果。
  • 为什么做:报表预览专题里的一个错数问题,替预览草稿数据的作者解决「发布前后数字对不上」。
  • 出错会怎样:只影响草稿预览的计数,发布后的数据集不变;可以直接撤回本次合并。
  • 要你做什么:无。

What changes

The draft preview (POST /api/v1/analytics/dataset/query?preview=draft, Studio's preview mode) evaluated $contains as String(value).toLowerCase().includes(…) on every column. packages/services/service-analytics/src/preview-evaluator.ts:

  • previewContains (new) is the one test behind the $contains pair.
    • On a column the host declares multi-valued or JSON-stored (isJsonStoredShape, the population the native where compile and the analytics: the dataset query door answers 200 / count 0 for = or $in on a JSON (multiple) column, where the data door refuses 400 #36168 JSON-column refusal read), the test is MEMBERSHIP. Some element of the drafted array must equal one of the members @objectstack/core's jsonMembershipCandidates names, compared by JSON text, which is what the SQLite construct compares. So '1' names the string '1' or the number 1, and a nested array, an object or a non-array value holds no member, as on every SQL face.
    • On any other column the test is the case-EXACT substring of a stored string.
  • $notContains joins PREVIEW_FIELD_OPERATORS as the exact complement. It was refused INVALID_FILTER / 400 on every column. A row with no value reaches it inside the shared lowering's NULL escape and is answered by $null there. The table's docblock requires a new arm to be measured against the shared conformance kits. It is measured against FILTER_TEXT_CASES in the new test file (below).
  • matchesWhere takes an optional shapeOf. lowerPreviewRowFilters passes the declared shape it already receives, read through the member-to-column map, the same way the JSON-column refusal reads it. The call site in analytics-service.ts is unchanged.

The card's open question (scalar case fold): fixed here, because the live rule is written down. The rule is case-exact (#4706 Q2 = A). It is in packages/spec/src/data/filter-text-conformance.ts:330-372 (the $contains family rows), packages/services/service-analytics/src/text-match-sql.ts:84-87, and packages/drivers/driver-memory/src/memory-driver.ts:1538. Measured before: label $contains 'A' answered native 1, ObjectQL 1, preview 3. The same kit rows also rule that a stored non-string never contains a substring (#14079). The preview searched String(5), so the scalar arm now reads only a stored string. This takes the bounded-fix exemption: same predicate, same defect class (the preview disagreeing with the live faces on this operator), and the shape is pinned by the kit row.

The folded item (a { $field } comparand on a multi-value field): not taken. It is a different mechanism. The preview resolves no field reference at all: it compares the row value against the reference object. So the scalar case is wrong too. Measured on the same composition: label $eq {$field: alias} answers native 2 and preview 0; $ne answers 2 and 4; $gt answers 0 and 2. The multi-value case (label $eq {$field: tags}: live 400, preview 200 count 0) is one instance of that. It is not the JSON-column resolver, so the seat split it to card #36677.

Tests

  • New src/__tests__/preview-contains-membership-36189.test.ts, 30 cases.
    • Three faces through queryDataset on the production composition (real AnalyticsServicePlugin, engine and SQLite SqlDriver, one pending seed draft). On tags and a select declared multiple: true, it covers a substring-only value, a case-only difference and a comma-joined value under $contains, $notContains, $not and $or. Each asserts native = ObjectQL = preview = the declared count. The scalar text control asserts the case-exact substring, equal on every face.
    • At the matcher: number, boolean, nested-array, object and non-array members, and the type-blind fallback for a field the host cannot name.
    • FILTER_TEXT_CASES: every kit row whose operators the preview evaluates. A pinned roster of six named rows makes sure the selection is not empty.
  • Updated, because they pinned the old behaviour:
    • preview-evaluator.test.ts: the 'Hello World' $contains 'world' fold now asserts false, with a 'World' hit beside it.
    • preview-unevaluable-operator.test.ts: $notContains moves to the evaluated set, with a both-direction row in its matrix. The $not refusal arm now uses $icontains.
    • dataset-json-column-refusal-36168.test.ts: $notContains leaves PREVIEW_UNEVALUATED, so its JSON-column control row is now also asserted on the preview.
  • Package run at 6fec79120: pnpm --filter @objectstack/service-analytics typecheck exit 0, and pnpm --filter @objectstack/service-analytics test gave Test Files 225 passed (225), Tests 5760 passed | 345 skipped (6105). VERDICT command-exit 0.
Before / after, three faces (counts over the 4-row fixture)
filter                         native  objectql  preview(before)  preview(after)
tags  $contains 'a'               1        1          3               1
tags  $contains 'A'               1        1          3               1
tags  $contains 'a,b'             0        0          1               0
tags  $notContains 'a'            3        3      400 refused         3
$not tags $contains 'a'           3        3          1               3
picks (select multiple) same as tags on every row
label $contains 'a'               2        2          3               2
label $contains 'A'               1        1          3               1
label $notContains 'a'            2        2      400 refused         2
Ablation (one shot, not kept)

On committed 1c39ffab6, node scripts/ablation-replace.mjs planted the old folded-substring line at the head of previewContains. The anchor if (isJsonStoredShape(shape)) { went from 1 to 0 hits and the blob from 6fca41f2e294 to 9a65dfcb0abe. The new test file then gave Tests 24 failed | 6 passed (30). The six that stayed green are the unfiltered control, the kit-roster pin, the _-literal kit row, the whole-member 'ab' rows and the undeclared-field fallback, none of which tells the two readings apart. Restore: the blob matches HEAD 6fca41f2e294 and git diff HEAD is empty. The first attempt was a no-op: the replacement text contained its own anchor, so the tool refused it (anchor count moved 1 -> 1) and ran nothing.

Acceptance notes

Verification

Two minutes: pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/preview-contains-membership-36189.test.ts. Expect Tests 30 passed (30).

Read first, by risk:

  1. preview-evaluator.ts previewContains: membership versus the case-exact substring, and the non-string guard.
  2. preview-evaluator.ts lowerPreviewRowFilters: whereShape reads the member's column, as the refusal does.
  3. preview-unevaluable-operator.test.ts: the vocabulary change.

Generated by Claude Code

…lue field as membership

The draft preview evaluated $contains as a case-folded substring of
String(value) on every column, so on a declared multi-valued or JSON-stored
field it searched the drafted list's string form. It now asks membership
there (the members jsonMembershipCandidates names, compared by JSON text, as
every SQL face binds them) and the case-exact substring of a stored string
elsewhere (FILTER_TEXT_CASES, #4706 Q2 = A). $notContains joins the
preview's table as the exact complement, measured against the shared text kit.

Claude-Session: https://claude.ai/code/session_011y7As6FyXmJyGyHNKXUkV7
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

6 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 68 of 251 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 6a731859def47e2c8cefcab4d635a1c45c60c2c1 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 68ed732aeada2eb9058a69ca0c585156a82b29ad — the merge of head 6fec79120dd0271006ea88066dbfd366d6389caa into base 6a731859def47e2c8cefcab4d635a1c45c60c2c1, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 68ed732aeada2eb9058a69ca0c585156a82b29ad && git checkout 68ed732aeada2eb9058a69ca0c585156a82b29ad
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 6a731859def47e2c8cefcab4d635a1c45c60c2c1 6fec79120dd0271006ea88066dbfd366d6389caa && git checkout -B drift-repro 6a731859def47e2c8cefcab4d635a1c45c60c2c1 && git merge --no-ff 6fec79120dd0271006ea88066dbfd366d6389caa

node scripts/docs-audit/affected-docs.mjs --json 6a731859def47e2c8cefcab4d635a1c45c60c2c1

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV

维护者速读

席位核对

Verdict: ACCEPT · head 6fec79120dd0271006ea88066dbfd366d6389caa · card #36189 · L2: not owed (no published schema, no governed path, no Clause-②: yes, no narrowing arm; see the Clause-② reading below)

Reviewed against GitHub at this head (diff, card body, l1-face.mjs --pr 36675 exit 0, pr-state.mjs), not against the report.

Checklist

  • Shape: open, draft, base main, first line Fixes #36189; no closing keyword binds another card. Fixes is right: Done-when is delivered (membership for $contains / $notContains on a declared multi-value field equal to the native strategy; pins for a substring-only value, a case-only difference, a comma-joined value, and a scalar text control). The card's open question on the scalar case fold was read and fixed here, as the card allowed.
  • Scope: 6 files, all in packages/services/service-analytics (1 source, 4 tests, 1 changeset); no release path; the one published package has its patch changeset.
  • Changeset sentences read against the diff: the old reading (String(value ?? '').toLowerCase().includes(…) on every column) is the removed line; membership on a JSON-stored or multi-valued shape via isJsonStoredShape + core's jsonMembershipCandidates ('1' names the string or the number, per packages/core/src/utils/json-membership-sql.ts); a nested list, an object or a non-array holds no member (pinned); case-exact substring of a stored string only, a stored number never contains (#14079, FILTER_TEXT_CASES); $notContains as the exact complement now evaluated; $icontains still refused (pinned in preview-unevaluable-operator.test.ts). All hold.
  • Benefit past the boundary: measured end to end, not on a double. The new pin runs queryDataset through a real AnalyticsServicePlugin + ObjectQL + SQLite on three faces (native, ObjectQL, preview) and asserts the three counts equal per filter; the report's before-table on origin/main shows the mismatch (tags $contains 'a' 1/1/3, $notContains 'a' 3/3/400). Ablation planted the old folded substring: pins red, restored to the HEAD blob.
  • Gates at this head: Lint & Repo Gates success, TypeScript Type Check success; all checks 37 success, 16 expected skip, 0 failed, 0 pending.

Clause-② reading (seat's point 1 and 2)

Accepted deviations and landing items

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7

Landing · 2026-11-23T11:40Z · head 6fec79120d (unchanged since the ACCEPT) · verdict: L1-a ACCEPT 7099701922, no L2 owed.

Probe Reading
check-governed-merges --pr 36675 NOT governed · 388 changed lines (+370 / −18) ≤ 3000
pr-state --pr 36675 39 success · 18 expected skip · 0 unexpected skip · 0 failed · 0 pending · mergeable_state clean
narrowing leg the PR's one changeset (.changeset/36189-preview-contains-membership.md, added) declares Clause-②: no with no (narrowing) arm; no ! in the title
landing-k --pr 36675 K = 1 < 15

Landing item from the ACCEPT is done: the PR body's folded-item line now names #36677, the card the field-reference comparand was split to (body edit only, the head did not move).
State change: ready for review, auto-merge armed. On MERGED, Fixes #36189 closes the card and pm:dispatched comes off. The overlap with #36190 (declaredShape → jsonColumnClass) is carried by whichever of the two lands second.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 23, 2026 11:41
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into main with commit 03dbbe4 Nov 23, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-36189-preview-contains-membership branch November 23, 2026 12:16
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…olumn the driver stores as JSON, on the native dataset face and the draft preview (objectstack-ai#36771)

Fixes objectstack-ai#36190

Clause-②: yes (narrowing) — widened: `SqlDriver.jsonColumnFieldClass`
(`@objectstack/driver-sql`) is now public, and so on every class that
extends it (`TursoDriver`, `SqliteWasmDriver`), and the exported
`AnalyticsServiceConfig` (`@objectstack/service-analytics` root) gains
the optional key `jsonColumnFieldClass`; narrowed: the native dataset
face and the draft preview newly answer `400 INVALID_FILTER` for a
scalar comparison on a single-value media column the driver stores as
JSON, which they answered `200` with a wrong count before
Metadata-protocol: none
Skills-docs: none — no published skill documents the dataset door's
filter vocabulary per storage class; the operator contract the skills
describe (`$contains` is membership on a JSON column) is unchanged, and
the prescription for this class lives in the refusal text itself (the
media-column move)

## 维护者速读

- 用户能看到什么变化:在报表/看板里按附件字段(图片、文件)筛选时,数据集查询现在明确报错
400,不再静静给出错误的条数;其他字段的筛选照旧。
- 为什么做:属于「问数与报表口径一致」这条线,替数据门(`/api/v1/data` 查询)已有的拒绝把剩下两张面补齐,四张面同一句话。
- 出错会怎样:只会多出一条拒绝消息,不写任何数据;若判断过宽,受影响的只是这类筛选条件,回退该 PR 即可恢复。
- 要你做什么:确认「附件字段不能按值筛选,只能问有没有值」这个口径可以直接对外(消息里同时给出迁移命令);其余无。

## What changes

A single-value `image` / `file` / `avatar` / `video` / `audio` field is
stored as a JSON column on every deployment still inside the ADR-0104
dual-encoding window, and no declaration says so — the declared shape is
`image`, not JSON-stored. objectstack-ai#36168's dataset refusal reads the declared
shape only (`isJsonStoredShape`, the `multiple` population), so the
native dataset face compiled the comparison against the stored JSON
string and answered `200` with a wrong count, and the draft preview
answered its own.

- `SqlDriver.jsonColumnFieldClass` becomes **public**
(`packages/drivers/driver-sql/src/sql-driver.ts`, no body change):
whether a media column is JSON is this deployment's storage state, which
the analytics host cannot read from any declaration. This is the hook
the card said the analytics host did not have; it is read-only, records
nothing, and is the same question `driver-turso`'s remote transport
already asks through it.
- `DatasetScopedStrategyContext.jsonColumnFieldClass` is the
analytics-side hook (`strategies/types.ts`), wired by
`AnalyticsServicePlugin` from the driver that stores the object through
the existing `getDriverForObject` seam, exactly as `sqlDialect` and
`dateBucketSql` are. Only the two classes the refusal words are passed
on; every tier that cannot answer stays `undefined`, which leaves the
column unjudged.
- `json-column-comparison-refusal.ts` (objectstack-ai#36168's module) grows one
population function, `comparisonColumnClass`: the declared JSON shape is
`'multi-value-or-json'` as before, else the storing driver's
`'single-value-media'`, else not judged. Both faces of that module read
it, so the refusal is worded by the column's class — the media-column
move for this class, not the `$contains` membership repair, which finds
no member in a single JSON string.
- `NativeSQLStrategy`'s unknown-dialect decline reads the same
population, so a datasource whose dialect the host cannot name keeps
being handed to the ObjectQL strategy and its engine.
- `driver-turso` records the now-public member in `REMOTE_FACE_ANSWERS`
as `inherited` (that ledger is `Record<keyof SqlDriver, …>`, so a new
public member reds its typecheck until its remote answer is decided):
the remote face already answers from this registry through
`setJsonColumnResolver`.

**One conclusion per compile face**, as asked:

| Face | Conclusion |
|---|---|
| Data door (`POST /api/v1/data/:object/query`, `driver-sql`'s `where`)
| **Already compliant** — `sql-driver-filter-helpers.ts`'s
`assertOperatorAppliesToColumn` asks `jsonColumnFieldClass` and refuses
`400 INVALID_FILTER`; re-verified on current `main`, unchanged by this
PR. |
| ObjectQL face of the dataset door | **Already compliant** — it hands
the leaf to the engine and `driver-sql`, which refuses; pinned here on
all four filters, and its message is held equal to the native face's
where both name one spelling. |
| Native dataset face (`NativeSQLStrategy.buildFilterClause`) |
**Changed** — refuses `400 INVALID_FILTER` before anything binds;
previously `200` with a wrong count. |
| Draft preview (`?preview=draft`, `preview-evaluator.ts`) | **Changed**
— refuses once over the lowered `where`, before any row is read, so an
empty seed draft is refused too; previously `200` with its own count. |

Out of scope, deliberately: the card's "other dialects to be measured by
the claimant" — the refusal is judged on the declared/stored class and
never on the dialect, so it fires on every dialect; `NativeSQLStrategy`
is pinned on `sqlite` / `postgres` / `mysql` / `mssql` by objectstack-ai#36168's own
suite and nothing here is dialect-conditional.

## Tests

First measured at `d07e6802` (the head this PR opened at, after merging
`origin/main` once objectstack-ai#36675 landed). The dogfood battery is from that
head. The rework round since then changed the changeset, comments, one
import, one redundant check and the test file, and the package suite,
typecheck and gate union were re-run at `fe18f109`.

New:
`packages/services/service-analytics/src/__tests__/dataset-single-value-media-refusal-36190.test.ts`
— 17 tests (14 in the refusal suite, 3 in a moved-deployment control
suite), driven through `queryDataset` on the production composition (a
real `AnalyticsServicePlugin` over a real `ObjectQL` + `SqlDriver` on
SQLite, media columns not moved), on all three faces of the door.

- Pins on `pic: image` and `doc: file`, for `$eq`, implicit equality,
`$in` and `$ne`: `code` `INVALID_FILTER` **and** `status` 400 on the
native face, the ObjectQL face and the draft preview, the field named,
and `$contains` NOT prescribed. One message across faces where they name
one spelling (the equality pair is the known asymmetry: the ObjectQL
leaf reaches `driver-sql` as the bare spelling).
- The dataset's own `filter` likewise, in one sentence on all three
faces.
- The words are this class's: the message equals
`jsonColumnOperatorRefusalText(…, 'single-value-media')`'s diagnostic
and not the `multi-value-or-json` one.
- Moved-deployment control (`fileColumnsMoved: true`): the driver reads
neither media column as JSON, and `{ pic: 'file_1' }`, `$eq` and `$in`
answer the one matching row on all three faces, for `image` and `file`.
This pins that the refusal reads the storing driver's class, not the
declared type.
- Scalar control: the same four operators on a `text` column answer the
right counts on every face. Presence control: `$null` on the media
column still answers 2. Storage control: the driver reads both columns
as `single-value-media`.

```text
pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/dataset-single-value-media-refusal-36190.test.ts
  Test Files  1 passed (1)       Tests  14 passed (14)
pnpm --filter @objectstack/service-analytics test    (at fe18f10)
  Test Files  226 passed (226)   Tests  5777 passed | 345 skipped (6122)
pnpm --filter @objectstack/service-analytics typecheck   exit 0
pnpm --filter @objectstack/driver-sql typecheck          exit 0
pnpm --filter @objectstack/driver-turso typecheck        exit 0
pnpm --filter @objectstack/driver-turso exec vitest run src/turso-remote-inherited-members.test.ts src/turso-local-remote-single-value-media-refusal-parity.test.ts
  Test Files  2 passed (2)       Tests  118 passed (118)
pnpm --filter @objectstack/dogfood test   (closure built first, under the verify lock; VERDICT command-exit 0)
  Test Files  487 passed | 3 skipped (490)   Tests  4125 passed | 68 skipped (4193)
```

The gate families `node scripts/pm/dispatch-gates.mjs --commands`
derives for this diff: 79, each run at `d07e6802` with its exit code
recorded before any pipe; 78 exit 0, and `pnpm check:type-check-debt`
exit 3 (PREREQUISITE NOT MET: its closure build did not get a turn on
the shared verify lock while this branch's own battery held it), so it
is NOT MEASURED locally and is read from CI's `Lint & Repo Gates`.
`--ran` reconciliation: 79 accounted, 78 run, 1 NOT-MEASURED.

**Ablation** (one-off, at `34268214`, not left in the tree; the
population function it mutates is unchanged since), through
`scripts/ablation-replace.mjs` so the mutation is proven on disk:
dropping the single-value-media arm of `comparisonColumnClass` (anchor
hit 1 → 0, blob `0e02e7239009` → `40f4ddee27aa`) turns **10 of the 14**
tests red and leaves the 4 controls green — the expected direction, and
the controls are what keeps the refusal from reading as "refuse
everything". Restored and verified by the tool: blob equals HEAD's and
`git diff HEAD` is empty.

## Acceptance notes

- **Sibling PR objectstack-ai#36675 (draft preview `$contains` membership), now on
`main`.** It reads `lowerPreviewRowFilters`' fifth parameter
`declaredShape`. This branch first renamed and retyped that parameter;
it now keeps `declaredShape` exactly as it was (name and type) and takes
the storing driver's class as a sixth optional parameter,
`storedJsonClass`, combined by `comparisonColumnClass`. The branch was
merged with `origin/main` after objectstack-ai#36675 landed: the merge was clean,
`lowerPreviewRowFilters` carries both changes, and the package's suite
and typecheck above ran on the merged tree. No call site had to adapt.

- `sql-driver.ts` is a registered facade file at a line ceiling of 10071
(raising it is maintainer-only), and it sat at 10069. The rationale for
the visibility change therefore lives on the analytics-side hook's
docblock, with a two-line pointer in the facade; the file now sits
exactly at 10071.
- **`$contains` on a single-value media column: three answers for one
filter (measured, not changed here).** This is the one cross-face
disagreement left on this class. I measured it at `fe18f109` on this
PR's fixture (stored `pic` is the JSON string `"file_1"` / `"file_2"`,
two rows null), through the same production composition the tests use:
the data door's engine `find` (what `POST /api/v1/data/:object/query`
calls) and the dataset door's `queryDataset` (what `POST
/api/v1/analytics/dataset/query` calls), on each face.

| `pic: { $contains: … }` | Data door (`find`) | Dataset, native |
Dataset, ObjectQL | Draft preview |
  |---|---|---|---|---|
  | `'file_1'` | 0 rows | count 1 | count 0 | count 1 |
  | `'file'` | 0 rows | count 2 | count 0 | count 2 |
  | `'"file_1"'` | 0 rows | count 1 | count 0 | count 0 |

The data door and the ObjectQL face run `driver-sql`'s JSON membership,
which finds no member in a single JSON string. The native face falls to
text-match over the stored JSON text (`whereContainsMembershipSql` reads
only the declared shape), and the preview text-matches the bare drafted
id. Every answer is `200`. Outside objectstack-ai#36190's Done-when; the seat holds
the reading for filing.
- Contract-review nits: N1 (changeset names `driver-turso`; the release
text now says the member is public and what a subclass owes) and N3
(module prose for both classes, a repeated shape check dropped, the
split import joined) are done on this head. N2 (a moved-deployment pin)
is done too, as the control suite above.

## Verification

Read first, in risk order (3 files):

1.
`packages/services/service-analytics/src/json-column-comparison-refusal.ts`
— the risk hunk is `comparisonColumnClass`: it must keep the
declared-shape arm first, so the existing `multi-value-or-json`
population is byte-identical in verdict and in words.
2. `packages/services/service-analytics/src/plugin.ts` — the risk hunk
is `jsonColumnFieldClass`: it must pass on only the two known classes
and swallow every tier that cannot answer, or a host without a SQL
driver starts being judged.
3. `packages/drivers/driver-turso/src/turso-driver.ts` — the risk hunk
is the new `REMOTE_FACE_ANSWERS` row: `inherited` must be true of the
remote face (it is: the remote transport is handed this very method).

Two-minute verification, one command:

```bash
pnpm --filter @objectstack/service-analytics exec vitest run --maxWorkers=2 src/__tests__/dataset-single-value-media-refusal-36190.test.ts src/__tests__/dataset-json-column-refusal-36168.test.ts
```

Expect 17 + the objectstack-ai#36168 suite's tests all passing: the new class is
refused and the old population's words did not move.

---
_Generated by [Claude
Code](https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH)_

<!-- signed: repo:objectstack#7 · os-alice ·
session_011y7As5bdhV5T4N9vpjmZzH -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

analytics: the draft preview answers $contains on a multi-value field as a substring of the stringified array, not membership

2 participants