Skip to content

refactor(driver-sql, plugin-security): read the list-comparand split from @objectstack/spec/data - #29660

Merged
objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-ej3tdk
Nov 3, 2026
Merged

objectstack-fleet[bot] merged 2 commits into
mainfrom
claude/project-thread-ej3tdk

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Warren · project thread

Fixes #29611

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:driver-sql 的 sql-driver.ts 与 plugin-security 的 rls-check-stored-form.ts 删掉各自手抄的 LIST_COMPARAND_OPERATORS($in / $nin / $between),改为调用 @objectstack/spec/data 导出的 isListComparandOperator。
  • 为什么改:spec(data): export the list-comparand operator split from @objectstack/spec/data so the flow executor reads it instead of a local copy (#29404) #29419 已把这条运算符拆分收归 spec 一处;这两份副本是剩下的漂移点。spec 的列表运算符一变,SQL 驱动的成员绑定检查和 RLS 存储形态检查会静默跟丢。
  • 风险与回滚:行为不变。改动前已实测两份本地集合与 spec 谓词在 43 个拼写上逐一答案相同;两包现有测试全绿。回滚即撤销本 PR。
  • 先看:packages/plugins/plugin-security/src/rls-check-stored-form.ts(storedOperand 一行替换),packages/drivers/driver-sql/src/sql-driver.ts(assertCompilableComparand 成员循环一行替换,加导入)。
  • 两分钟验证:git grep -n LIST_COMPARAND_OPERATORS -- packages/drivers/driver-sql packages/plugins/plugin-security,预期零命中(退出码 1)。
  • 需要你做的:无,席位落地。

What changes

  • packages/drivers/driver-sql/src/sql-driver.ts: assertCompilableComparand bind-tests each member of a list operator's array only when isListComparandOperator(op) answers true. The module-private LIST_COMPARAND_OPERATORS and its docblock are removed. The docblock's reason (a scalar operator handed an array keeps its own "requires a single comparable value" message) moves into the call-site comment. A new import line from @objectstack/spec/data carries a comment in the file's existing style, and the {@link} in the scalar set's docblock now names the predicate.
  • packages/plugins/plugin-security/src/rls-check-stored-form.ts: storedOperand asks isListComparandOperator(op), added to the existing @objectstack/spec/data import. The module-private copy is removed. The VALUE_COMPARISON_OPERATORS docblock now says the list half is the spec's answer. That set is unchanged: it is a different question (which operators compare with the stored value), and the card does not move it.
  • Changesets: .changeset/29611-driver-sql-list-comparand-predicate.md (@objectstack/driver-sql patch) and .changeset/29611-plugin-security-list-comparand-predicate.md (@objectstack/plugin-security patch), each with both declaration lines.
  • No packages/spec edit. No protocol.ts file is touched.

Tests

  • No test changed. Neither package had a test that only reconciled its copy against the spec, so there was nothing to delete.
  • The existing suites cover both call sites (for example sql-driver-compile-refusal-seam.test.ts for the list-member bind refusal) and stay green.
  • No ablation: the diff changes no tested behaviour, so the equality reading below stands in for one.

Acceptance notes

  • Equality before the swap. On base 4d8095ba, a scratch script read each local set from source and compared it with the built spec predicate over 43 spellings: the 19 operators FieldOperatorsSchema declares, plus 24 others (the infix spellings =, ==, !=, <>, >, >=, <, <=, like, ilike; in, nin, not in, between; $and, $or, $not, $field, $IN; the empty string; and constructor, __proto__, toString, hasOwnProperty). Both sets answered exactly as isListComparandOperator on every spelling, and each holds $in, $nin, $between. The spec export covers every case the local copies handled. The script was not committed.
  • Both packages already depend on @objectstack/spec (workspace:*) and import from @objectstack/spec/data, so no manifest changes.
  • driver-sql keeps its other local operator sets (SCALAR_COMPARAND_OPERATORS with infix spellings, TEXT_PATTERN_OPERATORS, LIKE_PATTERN_OPERATORS). They are driver-specific and outside this card.

Verification

Readings on head 19e661f7, which merges origin/main 3482f3d8 into the change commit a7214859 (base 4d8095ba). Each reading was also taken on a7214859 before the merge, with the same results except where noted.

Tests and typecheck
  • Under the verify lock on 19e661f7: pnpm install --frozen-lockfile, then pnpm exec turbo run build --filter=!@objectstack/docs --concurrency=2, 117/117 tasks, VERDICT command-exit 0.
  • pnpm --filter @objectstack/driver-sql --filter @objectstack/plugin-security typecheck: VERDICT command-exit 0.
  • pnpm --filter @objectstack/plugin-security test: 241 files passed, 5203 tests passed, 45 skipped, VERDICT command-exit 0. (5202 on a7214859; the merge brought a reworked it.each table in default-row-scope-declarations.test.ts, from feat(platform-objects): sys_personal_view, a reader's own named list views, with the owner's delete door (server step) #29575.)
  • pnpm --filter @objectstack/driver-sql test: 236 files passed, 12 skipped; 3847 tests passed, 214 skipped, VERDICT command-exit 0.
  • test:repo is not run locally (no file of that project changed); it is CI's Test Core.
Derived gates and lint
  • node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack on 19e661f7 derived 60 families. All 60 ran, each exit 0, exit codes captured before any pipe. --ran reconciliation: "60 derived, 60 run, 0 NOT-MEASURED, 0 UNRUN", exit 0, no stale-tree warning.
  • On a7214859 the same derivation gave 61 families (the extra one, check:pm-changeset-deadline-census, was retired on main by chore(pm): delete changeset-deadline-census, a report-only tool nothing calls #29577). There, check:dual-build-cjs-loads and check:i18n first exited 3 (PREREQUISITE NOT MET: no dist/ outside this diff's closure). After a full build both exited 0, and the reconciliation read 61 of 61 run. That run also warned the tree was 10 commits behind origin/main, which is why the branch merged main and every reading was taken again.
  • pnpm lint (repo-wide eslint) exit 0 on both heads.

Dogfood battery: not run (no ! in the title and no (narrowing) arm).

Human Minimum

  • 1. Schemas start as Zod; packages/spec holds no runtime logic. (No spec change.)
  • 2. Every name I added uses the casing for its kind. (No new names.)
  • 3. No formatter ran; pnpm lint passes (local run, exit 0).
  • 4. One issue, one branch off an up-to-date main, one pull request.
  • 5. A change that publishes carries a changeset, and both declaration lines are filled in here and in the changeset.
  • 6. packages/spec touched: not touched, nothing to regenerate.
  • 7. No hand edits to content/docs/references/, packages/*/CHANGELOG.md or content/docs/releases/.
  • 8. Title, body and comments are in English.

Generated by Claude Code

…from the spec

Both modules kept a hand copy of the list operators ($in, $nin, $between).
They now call isListComparandOperator from @objectstack/spec/data, the one
source the comparand faces read. The copies equalled the spec set, so
behaviour is unchanged.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JQwxbYnNFzqeb7KM8Lpd7j
@github-actions github-actions Bot added size/s documentation Improvements or additions to documentation tooling labels Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

3 anchor(s) derived from 2 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 60 of 216 client-bound route-ledger rows — the other 156 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 156: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 55 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 101 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 — 26 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 e0187d0fe1c89f1c70d0d2a65024cb6a2e5d4af7 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 73047f30e4a197ba2fe7de3f2482e6722ab0ff57 — the merge of head 19e661f7227e82485711e4be6c28f0fbd022877e into base e0187d0fe1c89f1c70d0d2a65024cb6a2e5d4af7, 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 73047f30e4a197ba2fe7de3f2482e6722ab0ff57 && git checkout 73047f30e4a197ba2fe7de3f2482e6722ab0ff57
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin e0187d0fe1c89f1c70d0d2a65024cb6a2e5d4af7 19e661f7227e82485711e4be6c28f0fbd022877e && git checkout -B drift-repro e0187d0fe1c89f1c70d0d2a65024cb6a2e5d4af7 && git merge --no-ff 19e661f7227e82485711e4be6c28f0fbd022877e

node scripts/docs-audit/affected-docs.mjs --json e0187d0fe1c89f1c70d0d2a65024cb6a2e5d4af7

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#4 · os-warren · session_01JQwxbacSXJQqAztgt4UMrS

席位核对

ACCEPT · domain:server#4 · head 19e661f7227e82485711e4be6c28f0fbd022877e · 2026-11-03T00:56Z · seat review of record at TIER_DEFAULT for the whole PR. No contract review is owed: Clause-②: no on both changesets, no schema, no narrowing, no governed path. Not governed: check-governed-merges --pr 29660 0 of 4 paths, +37/−20.

  1. Shape: draft, base main, Fixes #29611. 4 files: sql-driver.ts (assertCompilableComparand) and rls-check-stored-form.ts (storedOperand) now ask isListComparandOperator from @objectstack/spec/data. Both local LIST_COMPARAND_OPERATORS copies are deleted. One patch changeset each for @objectstack/driver-sql and @objectstack/plugin-security. Inside the claim surface (6590310879). No packages/spec, no protocol.ts.
  2. Premise measured: before the swap, on base 4d8095ba, both copies and the spec predicate were compared over 43 spellings (19 declared operators plus 24 others) and agreed on every one. So the swap moves no filter's compile or refusal, and no test needed to change (dev report 6592171200).
  3. Gates on this head: check-runs pinned to 19e661f7: 48 runs, none failed; mergeable_state clean. Dev local on this head: full build 117/117, typecheck VERDICT 0, plugin-security 5203 and driver-sql 3847 tests passed; dispatch-gates 60 derived / 60 run, exit 0; pnpm lint 0. The dev re-ran everything after merging main, because the first pass warned that the tree was 10 commits stale.
  4. Accepted deviations: sql-driver.ts imports isListComparandOperator in its own import statement from @objectstack/spec/data, beside the file's existing import from the same module. Style only; lint passes. Accepted without a round.
  5. Out of scope: none reported.
  6. Landing: not governed, under 3000 lines, nothing owed above TIER_DEFAULT ⇒ the seat lands it (pr_ready + automerge_enable). At MERGED: landing record on driver-sql / plugin-security: read the list-comparand operator split from @objectstack/spec/data (isListComparandOperator) instead of local LIST_COMPARAND_OPERATORS copies (#29419 follow-up) #29611 (closed by Fixes), pm:dispatched removed.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 3, 2026 00:56
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 3, 2026 00:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 3ff7fb7 Nov 3, 2026
49 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-ej3tdk branch November 3, 2026 01:36
marchtian pushed a commit that referenced this pull request Nov 3, 2026
Output of `node scripts/codemod-split-sql-driver.mjs --write` on
sql-driver.ts at origin/main 2ea6042 (input sha256 9abf7867fd98; #29660
touched it), unedited: 54 method bodies move to 18 section modules and 96 of
the 129 top-level declarations ahead of the class to sql-driver-top-level.ts;
sql-driver.ts 18330 -> 14050 lines. Output tree sha256 ab8990700a0d, the
same on two runs.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017ihL2gLghEqeDKTbDTC7Zd
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/s tooling

Projects

None yet

1 participant