Repository navigation
fix(analytics)!: refuse = / $in / $ne on a single-value media column the driver stores as JSON, on the native dataset face and the draft preview - #36771
Conversation
…umn the driver stores as JSON Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…, three faces Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…the sql-driver facade at its line ceiling Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…e-face answer Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…meter and add the stored class beside it Keeps the 5th parameter's name and type, so a sibling call site that passes a declared-shape resolver compiles unchanged; the storing driver's JSON-column class arrives as a 6th optional parameter and the two are combined by comparisonColumnClass. Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
… the sibling branch's import hunk Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…alytics-single-media-json-refusal
📓 Docs Drift CheckThis PR changes 3 package(s): 9 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 7 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 24 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 121f3531c893b2387613283bee20aea0f4a4b388 && git checkout 121f3531c893b2387613283bee20aea0f4a4b388
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin bbc7e037f3af837d4d1302177df5f434f2c239c0 fe18f1094781cc748bc6fd15aa3ff417ab547030 && git checkout -B drift-repro bbc7e037f3af837d4d1302177df5f434f2c239c0 && git merge --no-ff fe18f1094781cc748bc6fd15aa3ff417ab547030
node scripts/docs-audit/affected-docs.mjs --json bbc7e037f3af837d4d1302177df5f434f2c239c0
|
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV Contract-review-claim: session_011y7As6YDLR8TJVDpdXzJyV · head d07e680 · 2026-11-23T19:38Z |
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV Contract reviewServed-tier: Inputs read: card #36190 body and its five comments (triage 7069730609, claim 7096730827, progress 7103673343 and 7111288014, os-dev-report 7111805621; no ruling and no earlier record on the card), PR #36771 body and its 10-file list, the net diff ① Derived judgments
② Semver levelClause-②: no (narrowing) — on the PR body and on the changeset body, as the card's Done-when orders;
N1 (nit) — the changeset frontmatter names ③ Boundary flags
④ Design judgmentThe question is whether this narrowing takes a declared capability away at the consumer, or makes the spec's own refusal real. It is the second.
N2 (nit) — the moved-deployment arm ("Not moved … a deployment whose media columns have moved") is stated in the changeset and holds by reading, but no test in this suite drives the dataset door over a driver with N3 (nit) — stale prose in No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV 维护者速读
席位核对 — REWORK · head d07e680 · card #36190L2 record at this head: comment 7112462731 (PASS, Checklist
REWORK items (prose only)
Owed after the fix
Accepted deviations
Out of scope, disposition
|
…urfaces, add driver-turso Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…, drop a repeated shape check, join the split import Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
…nswered, not refused, on every face Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV Contract-review-claim: session_011y7As6YDLR8TJVDpdXzJyV · head fe18f10 · 2026-11-24T05:17Z |
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV Contract reviewServed-tier: Delta record on the PASS record for N1: closed ① Derived judgments
② Semver levelClause-②: yes (narrowing) — on the PR body and on the changeset body, one spelling on both. The change of value from The level stays ③ Boundary flags
④ Design judgmentThe narrowing reviewed at
N4 (nit) — the PR body's test section says 17 tests for the new file, but the command block under it still prints No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-alice · session_011y7As6YDLR8TJVDpdXzJyV 维护者速读
席位核对 — ACCEPT · head fe18f10 · card #36190L2 record at this head: comment 7122847516 (PASS, REWORK items
Checklist
Accepted deviations
Out of scope, disposition
|
|
repo:objectstack#7 · os-alice · session_011y7As5bdhV5T4N9vpjmZzH 维护者速读
Review request — declared narrowing (
|
Fixes #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 exportedAnalyticsServiceConfig(@objectstack/service-analyticsroot) gains the optional keyjsonColumnFieldClass; narrowed: the native dataset face and the draft preview newly answer400 INVALID_FILTERfor a scalar comparison on a single-value media column the driver stores as JSON, which they answered200with a wrong count beforeMetadata-protocol: none
Skills-docs: none — no published skill documents the dataset door's filter vocabulary per storage class; the operator contract the skills describe (
$containsis membership on a JSON column) is unchanged, and the prescription for this class lives in the refusal text itself (the media-column move)维护者速读
/api/v1/data查询)已有的拒绝把剩下两张面补齐,四张面同一句话。What changes
A single-value
image/file/avatar/video/audiofield 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 isimage, not JSON-stored. #36168's dataset refusal reads the declared shape only (isJsonStoredShape, themultiplepopulation), so the native dataset face compiled the comparison against the stored JSON string and answered200with a wrong count, and the draft preview answered its own.SqlDriver.jsonColumnFieldClassbecomes 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 questiondriver-turso's remote transport already asks through it.DatasetScopedStrategyContext.jsonColumnFieldClassis the analytics-side hook (strategies/types.ts), wired byAnalyticsServicePluginfrom the driver that stores the object through the existinggetDriverForObjectseam, exactly assqlDialectanddateBucketSqlare. Only the two classes the refusal words are passed on; every tier that cannot answer staysundefined, which leaves the column unjudged.json-column-comparison-refusal.ts(analytics: the dataset query door answers 200 / count 0 for = or $in on a JSON (multiple) column, where the data door refuses 400 #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$containsmembership 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-tursorecords the now-public member inREMOTE_FACE_ANSWERSasinherited(that ledger isRecord<keyof SqlDriver, …>, so a new public member reds its typecheck until its remote answer is decided): the remote face already answers from this registry throughsetJsonColumnResolver.One conclusion per compile face, as asked:
POST /api/v1/data/:object/query,driver-sql'swhere)sql-driver-filter-helpers.ts'sassertOperatorAppliesToColumnasksjsonColumnFieldClassand refuses400 INVALID_FILTER; re-verified on currentmain, unchanged by this PR.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.NativeSQLStrategy.buildFilterClause)400 INVALID_FILTERbefore anything binds; previously200with a wrong count.?preview=draft,preview-evaluator.ts)where, before any row is read, so an empty seed draft is refused too; previously200with 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;
NativeSQLStrategyis pinned onsqlite/postgres/mysql/mssqlby #36168's own suite and nothing here is dialect-conditional.Tests
First measured at
d07e6802(the head this PR opened at, after mergingorigin/mainonce #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 atfe18f109.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 throughqueryDataseton the production composition (a realAnalyticsServicePluginover a realObjectQL+SqlDriveron SQLite, media columns not moved), on all three faces of the door.pic: imageanddoc: file, for$eq, implicit equality,$inand$ne:codeINVALID_FILTERandstatus400 on the native face, the ObjectQL face and the draft preview, the field named, and$containsNOT prescribed. One message across faces where they name one spelling (the equality pair is the known asymmetry: the ObjectQL leaf reachesdriver-sqlas the bare spelling).filterlikewise, in one sentence on all three faces.jsonColumnOperatorRefusalText(…, 'single-value-media')'s diagnostic and not themulti-value-or-jsonone.fileColumnsMoved: true): the driver reads neither media column as JSON, and{ pic: 'file_1' },$eqand$inanswer the one matching row on all three faces, forimageandfile. This pins that the refusal reads the storing driver's class, not the declared type.textcolumn answer the right counts on every face. Presence control:$nullon the media column still answers 2. Storage control: the driver reads both columns assingle-value-media.The gate families
node scripts/pm/dispatch-gates.mjs --commandsderives for this diff: 79, each run atd07e6802with its exit code recorded before any pipe; 78 exit 0, andpnpm check:type-check-debtexit 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'sLint & Repo Gates.--ranreconciliation: 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), throughscripts/ablation-replace.mjsso the mutation is proven on disk: dropping the single-value-media arm ofcomparisonColumnClass(anchor hit 1 → 0, blob0e02e7239009→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 andgit diff HEADis empty.Acceptance notes
Sibling PR fix(service-analytics): draft preview answers $contains on a multi-value field as membership #36675 (draft preview
$containsmembership), now onmain. It readslowerPreviewRowFilters' fifth parameterdeclaredShape. This branch first renamed and retyped that parameter; it now keepsdeclaredShapeexactly as it was (name and type) and takes the storing driver's class as a sixth optional parameter,storedJsonClass, combined bycomparisonColumnClass. The branch was merged withorigin/mainafter fix(service-analytics): draft preview answers $contains on a multi-value field as membership #36675 landed: the merge was clean,lowerPreviewRowFilterscarries both changes, and the package's suite and typecheck above ran on the merged tree. No call site had to adapt.sql-driver.tsis 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.$containson 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 atfe18f109on this PR's fixture (storedpicis the JSON string"file_1"/"file_2", two rows null), through the same production composition the tests use: the data door's enginefind(whatPOST /api/v1/data/:object/querycalls) and the dataset door'squeryDataset(whatPOST /api/v1/analytics/dataset/querycalls), on each face.pic: { $contains: … }find)'file_1''file''"file_1"'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 (whereContainsMembershipSqlreads only the declared shape), and the preview text-matches the bare drafted id. Every answer is200. Outside analytics: the native dataset face answers 200 with wrong counts for = / $in / $ne on a single-value image or file field (stored as JSON) where the data door refuses 400 #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):
packages/services/service-analytics/src/json-column-comparison-refusal.ts— the risk hunk iscomparisonColumnClass: it must keep the declared-shape arm first, so the existingmulti-value-or-jsonpopulation is byte-identical in verdict and in words.packages/services/service-analytics/src/plugin.ts— the risk hunk isjsonColumnFieldClass: 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.packages/drivers/driver-turso/src/turso-driver.ts— the risk hunk is the newREMOTE_FACE_ANSWERSrow:inheritedmust be true of the remote face (it is: the remote transport is handed this very method).Two-minute verification, one command:
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.tsExpect 17 + the #36168 suite's tests all passing: the new class is refused and the old population's words did not move.
Generated by Claude Code