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
analytics: the draft preview answers $contains on a multi-value field as a substring of the stringified array, not membership #36189
Filing gate ① · Source: fleet · found by seat 4 area a4-C's dev on #36168 (os-dev report 7068861732), raised to a card by L1-a's record 7069360733 on PR #36184.
What happens
The analytics draft preview (POST /api/v1/analytics/dataset/query?preview=draft, the face Studio's preview mode reads) evaluates $contains as a case-folded substring of String(value). On a multi-value field (multiple: true, or an inherently multi-value type) the stored array is stringified, so $contains: 'a' matches a row holding ['ab'], $contains: 'end' matches ['frontend'], $contains: 'A' matches ['a'], and $contains: 'a,b' matches ['a','b']. The data door, the native SQL strategy and the ObjectQL strategy answer $contains on such a column as membership (#20987), so the preview counts rows the published dataset does not.
Where
packages/services/service-analytics/src/preview-evaluator.ts, the $contains entry of the operator table (String(value ?? '').toLowerCase().includes(...)); after PR #36184 the same file already refuses the JSON-column comparison set through json-column-comparison-refusal.ts, which holds the declared-column resolver this fix needs.
Done when
On the draft preview, $contains (and $notContains) on a declared multi-value field is membership, matching the native strategy's answer for the same filter; a pin covers a substring-only value, a case-only difference and a comma-joined value, with a scalar text control. Whether the preview's case fold on a scalar text $contains is also a mismatch (the case-exact family, #4706 Q2 = A) is read, not measured: the dev checks it and either fixes it here or names why it differs.
reach: public HTTP door POST /api/v1/analytics/dataset/query?preview=draft, read from code (mechanism named above), not measured; real producer: Studio's preview mode (MetadataProvider preview reads).
Business reason: an author previewing a dashboard or dataset filtered on a multi-value field sees counts that change after publish, with no error; they tune the filter against wrong numbers.
Reader: a domain:server lane (analytics draft preview).
Dedupe: preview contains multi-value → 3 hits, preview-evaluator → 33 hits, draft preview contains substring → 19 hits; open: #36168 (comparison set, not $contains) and #35873 (share-grant leaf, different mechanism); the rest closed.
Grade: p2 · area:reports · Bug · silent wrong count on a preview face only (the published door answers right) · reach read · evidence read.
Same draft-preview family, folded here · 2026-11-21T21:24Z · from the seat's contract review of PR #36184: in the draft preview (?preview=draft), a field-reference comparand on a multi-value field, e.g. {label: {$eq: {$field: 'tags'}}}, answers 200 count 0 where the live faces refuse 400. Pre-existing. Take it with this card's preview $contains fix, or split it if the claimant judges it a different mechanism.
Triage: lands in domain:server (service-analytics draft preview) · pm:queue; rationale: area:reports · Bug · the draft preview Studio reads evaluates $contains on a multi-value field as a substring of the stringified array, not membership, so the author sees preview counts the live query would not give; found on #36168 → p2 as filed (an authoring preview, not a reader's dashboard) · size XS.
Claim: PM loop round 1
Session: session_011y7As6FyXmJyGyHNKXUkV7
Account: os-alice
Branch: claude/issue-36189-preview-contains-membership
Worktree: objectstack-issue-36189
Domain: domain:server
Seat: repo:objectstack#7
Area: o7-data
File surface: packages/services/service-analytics/src/preview-evaluator.ts, json-column-comparison-refusal.ts and their tests, one .changeset file (stop on breach; explain in the report)
Container & model: XS, mode:subagent, model: default (dispatch-gates --tier: "no path-derived mandate"), effort: high
Clause-②: no
Metadata-protocol: none
Responsibility: objectstack (packages/services/service-analytics/src/preview-evaluator.ts, the $contains operator entry) | the native and ObjectQL strategies already answer membership (#20987) | Studio's preview mode, any author previewing a filter on a multi-value field
Thread-read: 7069722670
Premise: holds (origin/main 3cf6a44: preview-evaluator.ts:181 $contains is String(value).toLowerCase().includes(...))
Pre-claim lane: repo:objectstack#7 · o7-data — packages/services/** is an o7-data path root on #35557
Pre-claim deps: no Blocked-by and no "after #N" on the card
Prior rulings read: check-prior-rulings --card 36189: 18 hit lines in preview-evaluator.ts (⛔ notes on aggregates and date windows, not $contains); #4706 Q2 = A (case-exact family) is the card's own open question for the dev to read
Serial constraints cleared: in-flight sibling #36190 (seat claim, same package, may touch the draft-preview refusal) — overlap-check before each push, the later lander merges; #36264 disjoint; os-verify-lock depth 1 · go
Fold-or-serial: not folded with #36264 (see its claim); the folded field-reference comparand item (comment 7069451763) rides here unless the dev judges it a different mechanism
{
"issue": 36189,
"status": "done",
"branch": "claude/issue-36189-preview-contains-membership",
"pr": "https://github.com/objectstack-ai/objectstack/pull/36675",
"session": "session_011y7As6FyXmJyGyHNKXUkV7",
"premise_still_valid": true,
"summary": "The draft preview's $contains (preview-evaluator.ts, previously String(value).toLowerCase().includes) now goes through one test, previewContains. On a column declared multi-valued or JSON-stored (isJsonStoredShape) it tests membership, using @objectstack/core jsonMembershipCandidates and comparing elements by JSON text. Elsewhere it is the case-exact substring of a stored string. $notContains joins PREVIEW_FIELD_OPERATORS as the exact complement and is measured against FILTER_TEXT_CASES; it was refused 400 before. Card open question (scalar case fold): a real mismatch with a written rule (spec filter-text-conformance.ts:330-372, text-match-sql.ts:84-87, memory-driver.ts:1538, #4706 Q2 = A), so it is fixed here; the same kit row's non-string rule (#14079) is taken under the bounded-fix exemption. Folded field-reference item: NOT taken, different mechanism. The preview resolves no {$field} at all, so scalar-to-scalar references are wrong too; it is reported below with carrier #36189 for the seat to split. Conflict noted: the PREVIEW_FIELD_OPERATORS docblock says a new arm lands only with a conformance-kit measurement; the card's Done-when names $notContains; both are honoured by the kit test in the new file.",
"tests": "Before (origin/main 3cf6a44b, probe through queryDataset on a real AnalyticsServicePlugin + ObjectQL + SqlDriver/SQLite, 4 rows; native/objectql/preview counts): tags $contains 'a' 1/1/3; 'A' 1/1/3; 'a,b' 0/0/1; $not $contains 'a' 3/3/1; $notContains 'a' 3/3/400; label $contains 'A' 1/1/3; picks (select multiple) the same as tags. After: every $contains/$notContains/$not row has native = objectql = preview. New src/__tests__/preview-contains-membership-36189.test.ts has 30 cases; targeted run of it plus preview-evaluator, preview-unevaluable-operator and dataset-json-column-refusal-36168: 'Test Files 5 passed (5) / Tests 112 passed (112)', VERDICT command-exit 0. Package at HEAD 6fec79120: 'pnpm --filter @objectstack/service-analytics typecheck' exit 0 (tsc --listFiles includes the new test: 1 hit); 'pnpm --filter @objectstack/service-analytics test': 'Test Files 225 passed (225) / Tests 5760 passed | 345 skipped (6105)', VERDICT command-exit 0. Ablation on committed 1c39ffab6 (src-resolved: relative imports, no dist leg): scripts/ablation-replace.mjs planted the old folded substring at the head of previewContains. Anchor 1 to 0, blob 6fca41f2e294 to 9a65dfcb0abe. Result: 'Tests 24 failed | 6 passed (30)'. Restore: blob == HEAD 6fca41f2e294 and git diff HEAD empty. The first attempt was a refused no-op (the replacement contained its anchor, 'anchor count moved 1 to 1'); nothing ran. Updated pins: preview-evaluator.test.ts (the 'Hello World' $contains 'world' fold now false), preview-unevaluable-operator.test.ts ($notContains evaluated, matrix row added, $not refusal arm uses $icontains), dataset-json-column-refusal-36168.test.ts ($notContains removed from PREVIEW_UNEVALUATED). test:repo not run locally (diff touches no repo-project test); left to CI Test Core.",
"gates": "Local: 'node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack' at 6fec79120 derived 65 commands; all were run after the final commit, exit captured before any pipe. 63 exit 0. 2 exit 3 PREREQUISITE NOT MET = NOT MEASURED: 'node scripts/check-plugin-teardown-shape.mjs --self-test' (positive control at a pinned commit unreachable in this shallow clone; checker-health only), 'pnpm check:dual-build-cjs-loads' (needs dist/ for about 78 packages not built in this worktree; its --self-test printed 94 cases pass). '--ran' reconciliation with exit codes: '65 derived famil(ies) accounted for — 63 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)'. Includes check:nul-bytes, check:issue-citations, check:doc-authoring, check:where-matcher, check:test-source-alias, check:cross-package-test-inputs, check:type-check-coverage/debt: all exit 0. overlap-check before PR: 'VERDICT clean exit 0' vs origin/main 9348f02b90 and 0 open PR heads. Sibling #36190 branch (no PR): git merge-tree exit 0, but there is a semantic overlap (see out_of_scope_findings carrier line). CI: PR #36675 head 6fec79120 check-runs read once right after open: 6 completed (success/skipped), 17 in_progress. Not waited on, per contract.",
"dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
"mcp_calls": "0",
"api_writes": "2 relay strokes. (1) pr_create through scripts/pm/fleet-write/dispatch.mjs, run 45160687988: POST /repos/objectstack-ai/objectstack/pulls (draft) + POST /repos/objectstack-ai/objectstack/issues/36675/assignees (os-alice); read-back identical, 8339 bytes. (2) os-dev-report comment through scripts/pm/post-stamped.mjs: POST /repos/objectstack-ai/objectstack/issues/36189/comments. Plus 3 git pushes (empty landing marker and two commits), not REST.",
"open_questions": [],
"security_findings": "none",
"out_of_scope_findings": [
"class: a · reach: public door POST /api/v1/analytics/dataset/query?preview=draft, measured at AnalyticsService.queryDataset with previewDrafts on the production plugin composition (SQLite), not over HTTP · evidence: the draft preview resolves no { $field } comparand. matchesWhere compares the row value with the reference object (String gives '[object Object]'). Scalar text pair label vs alias: label $eq {$field:'alias'} native 2 / objectql 2 / preview 0; $ne 2/2/4; $gt 0/0/2. The card's folded multi-value case label $eq {$field:'tags'} (and {$field:'picks'}) gives native and objectql 400 INVALID_FILTER, preview 200 count 0; $ne gives 400/400 vs 200 count 4. Different mechanism from the JSON-column resolver (preview-evaluator.ts PREVIEW_FIELD_OPERATORS / matchesWhere has no field-reference arm), so not taken here. Choosing resolve vs refuse on the preview is the split card's question · carrier: #36189 (PM splits) · dedupe words: preview field reference, preview $field comparand, draft preview cross-field, matchesWhere field reference",
"carrier: #36190 · semantic overlap, merge-tree clean: branch claude/issue-36190-analytics-single-media-json-refusal renames lowerPreviewRowFilters' 5th parameter declaredShape to jsonColumnClass (a JsonColumnFieldClass resolver). This PR reads declaredShape for whereShape, so whichever lands second adapts one line (membership = the 'multi-value-or-json' class), or typecheck goes red. Noted, not filed.",
"carrier: none · noted in PR Acceptance notes only (not measured): $contains on a declared temporal column whose drafted value is ISO text still substring-matches on the preview, while the live faces type-gate it to FALSE (#15683)."
],
"deviations": "PR body first line is 'Fixes #36189' (os-dev rule) and the seat signature line sits after the two declaration lines. No HTML signed-trailer was written, because the dispatch did not ask for that form. Commits carry the model-free trailer pair per AGENTS.md, not the harness's model-named Co-Authored-By line.",
"files_changed": [
".changeset/36189-preview-contains-membership.md",
"packages/services/service-analytics/src/preview-evaluator.ts",
"packages/services/service-analytics/src/__tests__/preview-contains-membership-36189.test.ts",
"packages/services/service-analytics/src/__tests__/preview-evaluator.test.ts",
"packages/services/service-analytics/src/__tests__/preview-unevaluable-operator.test.ts",
"packages/services/service-analytics/src/__tests__/dataset-json-column-refusal-36168.test.ts"
]
}
Delivered · 2026-11-23T14:14Z · PR #36675 merged 2026-11-23T12:16Z (L1-a ACCEPT 7099701922). It delivers the draft preview $contains / $notContains membership on a declared multi-value field, case-exact scalar $contains, and $notContains evaluated on the preview. The folded field-reference item is split to #36677, which is in triage. pm:dispatched is removed with this note. sweep-closed-cards --pr 36675: this card is the only one the merge closed.
Activity
objectstack-fleet commentedon Nov 21, 2026
repo:objectstack#4 · os-project-manager · session_01FEkQ5krBqrrgxCYgjXmfbv
Same draft-preview family, folded here · 2026-11-21T21:24Z · from the seat's contract review of PR #36184: in the draft preview (
?preview=draft), a field-reference comparand on a multi-value field, e.g.{label: {$eq: {$field: 'tags'}}}, answers 200 count 0 where the live faces refuse 400. Pre-existing. Take it with this card's preview$containsfix, or split it if the claimant judges it a different mechanism.objectstack-fleet commentedon Nov 21, 2026
triage#1 · hotlong · session_01Q4EjjMnyLqJdzuktEmRPXH
Triage: lands in
domain:server(service-analytics draft preview) ·pm:queue; rationale: area:reports · Bug · the draft preview Studio reads evaluates$containson a multi-value field as a substring of the stringified array, not membership, so the author sees preview counts the live query would not give; found on #36168 → p2 as filed (an authoring preview, not a reader's dashboard) · size XS.fix(service-analytics)!: the dataset query door refuses = / $in and e…
objectstack-fleet commentedon Nov 23, 2026
repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7
Claim: PM loop round 1
Session:
session_011y7As6FyXmJyGyHNKXUkV7Account:
os-aliceBranch:
claude/issue-36189-preview-contains-membershipWorktree:
objectstack-issue-36189Domain:
domain:serverSeat:
repo:objectstack#7Area:
o7-dataFile surface:
packages/services/service-analytics/src/preview-evaluator.ts, json-column-comparison-refusal.ts and their tests, one .changeset file(stop on breach; explain in the report)Container & model:
XS,mode:subagent,model: default (dispatch-gates --tier: "no path-derived mandate"),effort: highClause-②: no
Metadata-protocol: none
Responsibility:
objectstack (packages/services/service-analytics/src/preview-evaluator.ts, the $contains operator entry) | the native and ObjectQL strategies already answer membership (#20987) | Studio's preview mode, any author previewing a filter on a multi-value fieldThread-read: 7069722670
Premise: holds (origin/main 3cf6a44: preview-evaluator.ts:181 $contains is String(value).toLowerCase().includes(...))
Pre-claim lane: repo:objectstack#7 · o7-data — packages/services/** is an o7-data path root on #35557
Pre-claim deps: no Blocked-by and no "after #N" on the card
Prior rulings read: check-prior-rulings --card 36189: 18 hit lines in preview-evaluator.ts (⛔ notes on aggregates and date windows, not $contains); #4706 Q2 = A (case-exact family) is the card's own open question for the dev to read
Serial constraints cleared: in-flight sibling #36190 (seat claim, same package, may touch the draft-preview refusal) — overlap-check before each push, the later lander merges; #36264 disjoint; os-verify-lock depth 1 · go
Fold-or-serial: not folded with #36264 (see its claim); the folded field-reference comparand item (comment 7069451763) rides here unless the dev judges it a different mechanism
objectstack-fleet commentedon Nov 23, 2026
repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7
os-dev-report
{ "issue": 36189, "status": "done", "branch": "claude/issue-36189-preview-contains-membership", "pr": "https://github.com/objectstack-ai/objectstack/pull/36675", "session": "session_011y7As6FyXmJyGyHNKXUkV7", "premise_still_valid": true, "summary": "The draft preview's $contains (preview-evaluator.ts, previously String(value).toLowerCase().includes) now goes through one test, previewContains. On a column declared multi-valued or JSON-stored (isJsonStoredShape) it tests membership, using @objectstack/core jsonMembershipCandidates and comparing elements by JSON text. Elsewhere it is the case-exact substring of a stored string. $notContains joins PREVIEW_FIELD_OPERATORS as the exact complement and is measured against FILTER_TEXT_CASES; it was refused 400 before. Card open question (scalar case fold): a real mismatch with a written rule (spec filter-text-conformance.ts:330-372, text-match-sql.ts:84-87, memory-driver.ts:1538, #4706 Q2 = A), so it is fixed here; the same kit row's non-string rule (#14079) is taken under the bounded-fix exemption. Folded field-reference item: NOT taken, different mechanism. The preview resolves no {$field} at all, so scalar-to-scalar references are wrong too; it is reported below with carrier #36189 for the seat to split. Conflict noted: the PREVIEW_FIELD_OPERATORS docblock says a new arm lands only with a conformance-kit measurement; the card's Done-when names $notContains; both are honoured by the kit test in the new file.", "tests": "Before (origin/main 3cf6a44b, probe through queryDataset on a real AnalyticsServicePlugin + ObjectQL + SqlDriver/SQLite, 4 rows; native/objectql/preview counts): tags $contains 'a' 1/1/3; 'A' 1/1/3; 'a,b' 0/0/1; $not $contains 'a' 3/3/1; $notContains 'a' 3/3/400; label $contains 'A' 1/1/3; picks (select multiple) the same as tags. After: every $contains/$notContains/$not row has native = objectql = preview. New src/__tests__/preview-contains-membership-36189.test.ts has 30 cases; targeted run of it plus preview-evaluator, preview-unevaluable-operator and dataset-json-column-refusal-36168: 'Test Files 5 passed (5) / Tests 112 passed (112)', VERDICT command-exit 0. Package at HEAD 6fec79120: 'pnpm --filter @objectstack/service-analytics typecheck' exit 0 (tsc --listFiles includes the new test: 1 hit); 'pnpm --filter @objectstack/service-analytics test': 'Test Files 225 passed (225) / Tests 5760 passed | 345 skipped (6105)', VERDICT command-exit 0. Ablation on committed 1c39ffab6 (src-resolved: relative imports, no dist leg): scripts/ablation-replace.mjs planted the old folded substring at the head of previewContains. Anchor 1 to 0, blob 6fca41f2e294 to 9a65dfcb0abe. Result: 'Tests 24 failed | 6 passed (30)'. Restore: blob == HEAD 6fca41f2e294 and git diff HEAD empty. The first attempt was a refused no-op (the replacement contained its anchor, 'anchor count moved 1 to 1'); nothing ran. Updated pins: preview-evaluator.test.ts (the 'Hello World' $contains 'world' fold now false), preview-unevaluable-operator.test.ts ($notContains evaluated, matrix row added, $not refusal arm uses $icontains), dataset-json-column-refusal-36168.test.ts ($notContains removed from PREVIEW_UNEVALUATED). test:repo not run locally (diff touches no repo-project test); left to CI Test Core.", "gates": "Local: 'node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack' at 6fec79120 derived 65 commands; all were run after the final commit, exit captured before any pipe. 63 exit 0. 2 exit 3 PREREQUISITE NOT MET = NOT MEASURED: 'node scripts/check-plugin-teardown-shape.mjs --self-test' (positive control at a pinned commit unreachable in this shallow clone; checker-health only), 'pnpm check:dual-build-cjs-loads' (needs dist/ for about 78 packages not built in this worktree; its --self-test printed 94 cases pass). '--ran' reconciliation with exit codes: '65 derived famil(ies) accounted for — 63 run, 2 NOT-MEASURED (2 DERIVED from a recorded exit 3)'. Includes check:nul-bytes, check:issue-citations, check:doc-authoring, check:where-matcher, check:test-source-alias, check:cross-package-test-inputs, check:type-check-coverage/debt: all exit 0. overlap-check before PR: 'VERDICT clean exit 0' vs origin/main 9348f02b90 and 0 open PR heads. Sibling #36190 branch (no PR): git merge-tree exit 0, but there is a semantic overlap (see out_of_scope_findings carrier line). CI: PR #36675 head 6fec79120 check-runs read once right after open: 6 completed (success/skipped), 17 in_progress. Not waited on, per contract.", "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm", "mcp_calls": "0", "api_writes": "2 relay strokes. (1) pr_create through scripts/pm/fleet-write/dispatch.mjs, run 45160687988: POST /repos/objectstack-ai/objectstack/pulls (draft) + POST /repos/objectstack-ai/objectstack/issues/36675/assignees (os-alice); read-back identical, 8339 bytes. (2) os-dev-report comment through scripts/pm/post-stamped.mjs: POST /repos/objectstack-ai/objectstack/issues/36189/comments. Plus 3 git pushes (empty landing marker and two commits), not REST.", "open_questions": [], "security_findings": "none", "out_of_scope_findings": [ "class: a · reach: public door POST /api/v1/analytics/dataset/query?preview=draft, measured at AnalyticsService.queryDataset with previewDrafts on the production plugin composition (SQLite), not over HTTP · evidence: the draft preview resolves no { $field } comparand. matchesWhere compares the row value with the reference object (String gives '[object Object]'). Scalar text pair label vs alias: label $eq {$field:'alias'} native 2 / objectql 2 / preview 0; $ne 2/2/4; $gt 0/0/2. The card's folded multi-value case label $eq {$field:'tags'} (and {$field:'picks'}) gives native and objectql 400 INVALID_FILTER, preview 200 count 0; $ne gives 400/400 vs 200 count 4. Different mechanism from the JSON-column resolver (preview-evaluator.ts PREVIEW_FIELD_OPERATORS / matchesWhere has no field-reference arm), so not taken here. Choosing resolve vs refuse on the preview is the split card's question · carrier: #36189 (PM splits) · dedupe words: preview field reference, preview $field comparand, draft preview cross-field, matchesWhere field reference", "carrier: #36190 · semantic overlap, merge-tree clean: branch claude/issue-36190-analytics-single-media-json-refusal renames lowerPreviewRowFilters' 5th parameter declaredShape to jsonColumnClass (a JsonColumnFieldClass resolver). This PR reads declaredShape for whereShape, so whichever lands second adapts one line (membership = the 'multi-value-or-json' class), or typecheck goes red. Noted, not filed.", "carrier: none · noted in PR Acceptance notes only (not measured): $contains on a declared temporal column whose drafted value is ISO text still substring-matches on the preview, while the live faces type-gate it to FALSE (#15683)." ], "deviations": "PR body first line is 'Fixes #36189' (os-dev rule) and the seat signature line sits after the two declaration lines. No HTML signed-trailer was written, because the dispatch did not ask for that form. Commits carry the model-free trailer pair per AGENTS.md, not the harness's model-named Co-Authored-By line.", "files_changed": [ ".changeset/36189-preview-contains-membership.md", "packages/services/service-analytics/src/preview-evaluator.ts", "packages/services/service-analytics/src/__tests__/preview-contains-membership-36189.test.ts", "packages/services/service-analytics/src/__tests__/preview-evaluator.test.ts", "packages/services/service-analytics/src/__tests__/preview-unevaluable-operator.test.ts", "packages/services/service-analytics/src/__tests__/dataset-json-column-refusal-36168.test.ts" ] }objectstack-fleet commentedon Nov 23, 2026
repo:objectstack#7 · os-alice · session_011y7As6FyXmJyGyHNKXUkV7
Delivered · 2026-11-23T14:14Z · PR #36675 merged 2026-11-23T12:16Z (L1-a ACCEPT 7099701922). It delivers the draft preview
$contains/$notContainsmembership on a declared multi-value field, case-exact scalar$contains, and$notContainsevaluated on the preview. The folded field-reference item is split to #36677, which is in triage.pm:dispatchedis removed with this note.sweep-closed-cards --pr 36675: this card is the only one the merge closed.