Skip to content

fix(driver-sql)!: a boolean field is stored as a boolean whatever spelling the caller sends - #35718

Merged
os-zhuang merged 4 commits into
mainfrom
claude/sec2-boolean-write-canonical
Nov 20, 2026
Merged

os-zhuang merged 4 commits into
mainfrom
claude/sec2-boolean-write-canonical

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Clause-②: no (narrowing)
Metadata-protocol: none
Skills-docs: none — the published skills teach no write of a boolean field through a driver; the engine's door and authored metadata are unchanged.

维护者速读

  • 用户无感:经界面和接口写入的布尔与开关字段照旧;插件、钩子或脚本直接写这类字段时,真假的各种写法从此一律存成真正的布尔值。
  • 替写插件、钩子和迁移脚本的开发者解决:同一个布尔字段不再因写法不同而存成两种形态,筛选、排序、分组读到的真假始终一致。
  • 绕过引擎直接写库、又传了认不出真假的值(比如“yes”)的代码,会收到校验错误而不是悄悄存进去;本改动可整体撤回。
  • 无。

What changes

A boolean field is stored as a boolean whatever spelling the caller sends.

  • The SQLite write door (formatInput, packages/drivers/driver-sql/src/sql-driver-sqlite-serialisation.ts). For a declared scalar Field.boolean / Field.toggle, it used to bind only a JS boolean and pass every other value through as sent, so a string reached the column as text. It now reads the value through one table, SQLITE_BOOLEAN_TEXT_SPELLINGS:

    • accepted, and bound as the boolean they spell: true / false, the numbers 1 / 0, and the text '1' / '0', 'true' / 'false' and '1.0' / '0.0';
    • refused before any statement is built, with VALIDATION_ERROR / 400 (ADR-0112): every other value, for example 'yes', 'TRUE', ' true', '', 2, NaN, an array or an object. The error message names the field and the object and describes the value's type without echoing it;
    • null still writes NULL, and an absent key is left alone.

    Every SQLite-family write door forms its row here: SqlDriver on SQLite, both faces of TursoDriver (the remote face forms its rows through the same formatInput), and SqliteWasmDriver. That covers create, update, upsert, bulkCreate, bulkUpdate and updateMany.

  • One rule for write and boot convergence (sql-driver-schema-sync.ts). The local boot convergence (SQLITE_LEGACY_BOOLEAN_TEXT and the UPDATE in backfillCanonicalBooleans) now builds its spelling lists from the same table. The SQL it emits is byte-identical to before. The write door and the convergence cannot drift apart: neither accepts a spelling the other does not.

  • Remote TursoDriver.bulkCreate checks every row's storage form before it writes the first row. A refused row refuses the whole batch with nothing written, as the local face's single INSERT already did.

  • The engine's door. It already writes the boolean its validator judged, and these tests pin that. A beforeInsert / beforeUpdate hook that assigns a string runs after that rewrite, so the string reached the driver as sent. It now lands as a boolean through the driver's door.

  • Not changed: Postgres and MySQL; the engine's validation; any schema or export shape. Rows already stored keep their stored form, and nothing is rewritten at boot that was not rewritten before.

Tests

  • packages/drivers/driver-sql/src/sql-driver-boolean-write-spellings.test.ts (30 cases): every accepted spelling through all six doors lands canonical, on a column the driver created (INTEGER) and on a text column retyped to boolean (the text '1' / '0'). Every refused value comes back as { code: 'VALIDATION_ERROR', status: 400 } with nothing written. Negative and positive filters ($ne, $nin, $not, =) answer each row by the boolean it was written as.
  • packages/drivers/driver-turso/src/turso-local-remote-boolean-write-parity.test.ts (28 cases): the same doors on both TursoDriver faces over an embedded libSQL file, raw typeof read back through a separate client, plus a remote bulkCreate batch with one refused row that writes nothing.
  • packages/runtime/src/domains/boolean-written-spelling-row-scope.test.ts (6 cases): the engine, a permission set and REST, on both faces. Three writers send the string 'true': the engine's door, the driver's door, and a beforeInsert hook. A row-level rule written in negative form (restricted != true, !(record.restricted in [true]), record.locked != true) answers each of those rows by the boolean it was written as, on find, count, findOne, and the REST list, get and delete.

Ablation of the new arm (head 821e6832c09). The mutant puts the arm back as it stood at the base: only a JS boolean is bound, and every other value passes through as sent. Each leg was rebuilt and proven to reach dist/ (ablation-dist-preflight: the marker present in 2 built files, then absent from all 6).

leg driver-sql pin driver-turso pin runtime pin
mutant 28 failed, 2 passed (30) 28 failed (28) 6 failed (6)
restored (git diff HEAD empty, whole tree clean) 30 passed (full suite below) 28 passed (28) 6 passed (6)

Under the mutant, the runtime pin stores driver_text_true and hook_text_true as text on both faces, while engine_text_true stays integer: the engine's door already writes a boolean on its own.

Suites and typechecks at 821e683 (all under the shared verify lock; VERDICT command-exit 0)
pnpm --filter @objectstack/driver-sql typecheck        EXIT=0
pnpm --filter @objectstack/driver-turso typecheck      EXIT=0
pnpm --filter @objectstack/runtime typecheck           EXIT=0
driver-sql   vitest run --maxWorkers=2   Test Files  266 passed | 13 skipped (279)   Tests  4438 passed | 257 skipped (4695)
driver-turso vitest run --maxWorkers=2   Test Files  102 passed | 1 skipped (103)    Tests  2593 passed | 36 skipped (2629)
driver-sqlite-wasm vitest run            Test Files  41 passed (41)                  Tests  768 passed (768)
runtime  vitest run --project local src/domains/boolean-written-spelling-row-scope.test.ts   Tests  6 passed (6)

The full runtime suite and the downstream consumers' suites are left to CI (Test Core). This PR changes no runtime source; it adds one test file there.

Acceptance notes

  • On the remote face of TursoDriver, a toggle column is created with TEXT affinity, while the local face gives it boolean (NUMERIC) affinity. Now that writes are canonical, the remote cell is the text '1' / '0', and every boolean filter reads it correctly. Noted, not filed.
  • The engine's validator accepts fewer text spellings than the driver's door: it does not accept '1.0' / '0.0'. The engine stays the stricter of the two doors. Noted, not filed.
  • No stored row is rewritten. A cell stored before this change keeps its stored form, on either face.
  • The runtime pin file takes about 11 s, almost all of it import time (10.9 s of 11.5 s); its six cases take 0.43 s.

Verification

Read first, by risk:

  1. packages/drivers/driver-sql/src/sql-driver-sqlite-serialisation.ts, the formatInput boolean arm: the one place a value a direct caller could write before is now refused.
  2. packages/drivers/driver-turso/src/turso-driver.ts, remote bulkCreate: the per-row check before the first write.
  3. packages/drivers/driver-sql/src/sql-driver-schema-sync.ts: the convergence SQL is now built from the shared table; it should read byte-identical.

Two-minute verification: with @objectstack/driver-sql built, run pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=2 src/turso-local-remote-boolean-write-parity.test.ts. Expect Tests 28 passed (28).

Dogfood battery, once, on the final head (821e6832c09, the title carries !): the @objectstack/dogfood^... closure was built, then pnpm --filter @objectstack/dogfood test ran under the verify lock. VERDICT command-exit 0: Test Files 482 passed | 3 skipped (485), Tests 4093 passed | 68 skipped (4161). No line of the run's log carries the new refusal's text.

Local gate families at 821e683: 70 derived, 69 run green, 1 not measured

node scripts/pm/dispatch-gates.mjs --commands derived 70 families from this diff. --ran reconciliation: 70 derived famil(ies) accounted for — 69 run, 1 NOT-MEASURED. check:dual-build-cjs-loads exits 3 (PREREQUISITE NOT MET) because it reads the built output of every package, and this checkout built only the dogfood closure. CI's Build Core job runs it.

exit 0  node scripts/check-adr-0087-registration.mjs --base origin/main
exit 0  node scripts/check-adr-0087-registration.mjs --self-test
exit 0  node scripts/check-changeset-no-major.mjs --base origin/main
exit 0  node scripts/check-closing-keyword-parity.mjs
exit 0  node scripts/check-closing-keyword-parity.mjs --self-test
exit 0  node scripts/check-comment-mask-adoption.mjs
exit 0  node scripts/check-comment-mask-adoption.mjs --self-test
exit 0  node scripts/check-comment-mask-corpus.mjs
exit 0  node scripts/check-empty-changeset.mjs --base origin/main
exit 0  node scripts/check-empty-changeset.mjs --self-test
exit 0  node scripts/check-issue-citations.mjs
exit 0  node scripts/check-plugin-teardown-shape.mjs
exit 0  node scripts/check-plugin-teardown-shape.mjs --self-test
exit 0  node scripts/ci/assert-turbo-remote-cache.mjs --self-test
exit 0  node scripts/ci/plan-test-core-shards.mjs --self-test
exit 0  node scripts/ci/prune-turbo-cache.mjs --self-test
exit 0  node scripts/ci/snapshot-next.mjs --self-test
exit 0  node scripts/docs-audit/check-affected-docs.mjs
exit 0  node scripts/docs-audit/check-drift-comment.mjs
exit 0  node scripts/pm/check-governed-queue-guard.mjs --self-test
exit 0  node scripts/pm/release-rehearsal-clone.mjs --self-test
exit 0  node scripts/release-pending-publish.mjs --self-test
exit 0  pnpm --filter @objectstack/spec run check:duration-unit-keys
exit 0  pnpm check:adr-anchors
exit 0  pnpm check:adr-symbol-anchors
exit 0  pnpm check:changeset-gate-self-tests
exit 0  pnpm check:ci-filter-parity
exit 0  pnpm check:cli-command-ids
exit 0  pnpm check:closed-ceremony-text
exit 0  pnpm check:cross-package-test-inputs
exit 0  pnpm check:doc-authoring
exit 0  pnpm check:durability-log-level
exit 0  pnpm check:engine-double-contract
exit 0  pnpm check:error-status-conformance
exit 0  pnpm check:gitlink-declared
exit 0  pnpm check:issue-citations
exit 0  pnpm check:keyed-text-bounds
exit 0  pnpm check:logger-receiver-detach
exit 0  pnpm check:nul-bytes
exit 0  pnpm check:object-def-param-keys
exit 0  pnpm check:objectql-double-limit
exit 0  pnpm check:optional-error-sink
exit 0  pnpm check:org-identifier
exit 0  pnpm check:page-declaration-shape
exit 0  pnpm check:platform-object-tenancy-census
exit 0  pnpm check:query-options-erasure
exit 0  pnpm check:refd-timer-probe
exit 0  pnpm check:registry-log-declared
exit 0  pnpm check:rest-log-spy-declared
exit 0  pnpm check:route-envelope
exit 0  pnpm check:settings-bind-window
exit 0  pnpm check:slot-lookup
exit 0  pnpm check:system-context-census
exit 0  pnpm check:tenant-chokepoint
exit 0  pnpm check:test-source-alias
exit 0  pnpm check:tier-file-adoption
exit 0  pnpm check:undeclared-dep-imports
exit 0  pnpm check:vouch-for-reference-callers
exit 0  pnpm check:watch-hint-literal
exit 0  pnpm check:where-matcher
exit 0  node scripts/check-dts-emitted.mjs --self-test
exit 0  pnpm check:driver-conformance
exit 0  pnpm check:driver-memory-census
exit 0  pnpm check:dts-closure
exit 3  pnpm check:dual-build-cjs-loads
exit 0  pnpm check:lean-entry-closure
exit 0  pnpm check:published-files
exit 0  pnpm check:sourcemap-no-sources-content
exit 0  pnpm check:type-check-coverage
exit 0  pnpm check:type-check-debt   (re-run under the verify lock: 0 ledger entries re-measured, 0 raw tsc errors)

Generated by Claude Code

…ling the caller sends

WIP: write arm, shared spelling table, remote bulkCreate preflight, pins.

Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL
Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4czt69hUUaG5XcgFNYL
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/driver-sql, @objectstack/driver-turso, touching 11 documentable anchor(s).

2 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/data-modeling/virtual-objects.mdx (via bulkCreate (symbol, a method of class TursoDriver))
  • content/docs/permissions/tenant-audit-census.mdx (via bulkCreate (symbol, a method of class TursoDriver))

⛔ 1 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v17/17-6.mdx (via bulkCreate (symbol, a method of class TursoDriver))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 18 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 5d2ce34f88a0d3440386b381bd678a25cd59f7a4 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 5d2ce34f88a0d3440386b381bd678a25cd59f7a4

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

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 5d2ce34f88a0d3440386b381bd678a25cd59f7a4 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added 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 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL

Contract-review-claim: session_016WV4czt69hUUaG5XcgFNYL · head 821e683 · 2026-11-20T02:55Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

security#2 · os-elon-musk · session_016WV4czt69hUUaG5XcgFNYL

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 821e6832c0912938ddc2d11cd419e914067e058e
Local-runs: none
Scope: .changeset/boolean-write-spelling-canonical.md (declaration lines), packages/drivers/driver-sql/src/sql-driver-sqlite-serialisation.ts, packages/drivers/driver-sql/src/sql-driver-schema-sync.ts, packages/drivers/driver-turso/src/turso-driver.ts, packages/drivers/driver-sql/src/sql-driver-boolean-write-spellings.test.ts, packages/drivers/driver-turso/src/turso-local-remote-boolean-write-parity.test.ts, packages/runtime/src/domains/boolean-written-spelling-row-scope.test.ts + none (no further file in the diff; read, not reviewed, in the live tree at this head: sql-driver-crud.ts, sql-driver-bulk-operations.ts, sql-driver-sequence-semantics.ts, sql-driver-rotation.ts, sql-driver-filter-helpers.ts, sql-driver-column-creation.ts, packages/spec/src/data/field-value.zod.ts, AGENTS.md Post-Task Checklist step 3)
Security-touching: yes

No card: this PR is a security-seat no-card order. Inputs were the PR body, its seven-file list, the net diff against merge base 1bf30f8b356, the check-runs on this head, and the dev's evidence on this head. Net diff: 7 files, +678 / -6.

① Derived judgments

Rule under review: on SQLite-family storage a declared scalar boolean / toggle field is stored as the boolean its value spells, whatever accepted spelling the write sends; any other value is refused 400 VALIDATION_ERROR before a statement is built, without echoing the value; the accepted text spellings come from one table shared with the local boot convergence, whose SQL stays byte-identical; no rewrite of rows already stored; Postgres and MySQL untouched.

  • Accept-set, widened — RIGHT. The text 'true' / 'false' / '1.0' / '0.0' and the numbers 1 / 0 used to pass through as sent; they are now bound as sqliteBooleanBinding's '1' / '0'. The lookup is a Map (SameValueZero), so -0 reads as 0 and NaN reads as nothing; 'TRUE', ' true', '' are not in it.
  • Accept-set, narrowed — RIGHT, and it is the declared narrowing. Every other non-null value on a registered boolean field (other strings, other numbers, arrays, objects, dates, bigints) is refused by unwritableBooleanError; it used to be stored as written. null and undefined are skipped before the lookup, and a key the payload does not own is skipped by the own-property test, so a field named constructor or valueOf is not read off the prototype.
  • The refusal precedes every statement — RIGHT. Read in the live tree: create (sql-driver-crud.ts:362), bulkCreate (sql-driver-bulk-operations.ts:180, every row formed before the one INSERT), updateMany (:300), rotatedUpdateById (:354), update (sql-driver-sequence-semantics.ts:289), upsert (:658) each call formatInput before the builder issues anything; local bulkUpdate goes through update. SqliteWasmDriver has no formatInput of its own and inherits this one.
  • The refusal does not echo the value — RIGHT. The message carries the field name, the object name and valueKind(value) (a type word); the value itself is never interpolated.
  • Remote face — RIGHT. create, update, upsert, updateMany and bulkUpdate already formed their payload through toRemoteWriteForms (which is formatInput) before the transport call; bulkUpdate maps every row before the transport runs, so it was already refuse-before-write. bulkCreate loops create per row, so the added pre-pass is what makes a refused row refuse the batch. The pre-pass discards its result and formatInput is copy-on-write, so the rows handed to create are the caller's own.
  • The shared table — RIGHT. The three SQL lists rendered from the table read, in table order, 'true', 'false', '1.0', '0.0', '1', '0' and 'true', '1.0': the same bytes as the three literals they replace. The spellings are module constants with no quote in them, never a caller's value.
  • Module evaluation — RIGHT. sql-driver-schema-sync.ts now evaluates the table at import. sql-driver-sqlite-serialisation.ts imports only sql-driver-oracle-dialect, sql-driver-top-level, date-on-instant-column (and sql-driver for types), none of which reaches sql-driver-schema-sync, so no evaluation cycle is formed.
  • Which fields the door covers — RIGHT, as bounded. The arm reads booleanFields[object], filled by registerManagedObjectMetadata and registerExternalObject for scalar boolean / toggle only (a multiple: true one is a JSON column and is excluded at both fills). A table the driver was never told about is not covered, as with every other coercion in formatInput.
  • Column defaults — checked, no finding. applyDeclaredColumnDefault hands a literal defaultValue to the DDL as written, but the spec's authoring gate holds a boolean field's literal default to z.boolean() (valueSchemaFor), so authored metadata cannot give the column a text default.
  • Postgres / MySQL — untouched: the arm sits below if (!this.isSqlite) return copy.
  • Public surface: SQLITE_BOOLEAN_TEXT_SPELLINGS and sqliteBooleanWriteReading are new module exports, and the module's header states index.ts re-exports nothing from it. No published type, schema or export changes shape.

② Semver level

@objectstack/driver-sql patch and @objectstack/driver-turso patch, with Clause-②: no (narrowing) and Metadata-protocol: none on both the PR body and the changeset, the ! title, a BREAKING paragraph, the one-line fix ("send true or false...") and one ADR-0087 marker. This matches AGENTS.md Post-Task Checklist step 3: nothing a metadata author can write changes (none takes patch), and "a non-protocol change, widening or breaking, ships patch and keeps its BREAKING banner and ADR-0087 disposition". The level is right. Check Changeset concluded success on this head. @objectstack/driver-sqlite-wasm changes behaviour through its workspace:* dependency on driver-sql and sits in the same fixed group, so it is versioned with it.

③ Boundary flags

  • Dev flag "remote toggle column has TEXT affinity, noted, not filed" — answered: the canonical cell there is the text '1' / '0', which is what the door binds; the turso pin reads text for that column and holds find and count to one answer on it. No action owed by this PR.
  • Dev flag "the engine accepts fewer text spellings than the driver" — answered: the engine is the stricter door, so nothing the engine admits is refused below it. Held by the seat as a docs follow-up.
  • Dev flag "no stored row is rewritten" — matches the maintainer ruling (no legacy-data migration); the diff adds no backfill and the local convergence SQL is unchanged.
  • Private residuals held by the security seat: R1–R5 — graded in the seat's private notes. None is graded must-fix for this PR.
  • SQL push-down: no new id materialisation and no in-app join. The only new loop is the remote bulkCreate pre-pass, a pure in-memory check that issues no statement.
  • Check-runs at my read: 20 concluded success (among them Check Changeset, Dogfood Regression Gate, Governed Surface Queue Guard, Lint · ESLint, Type Check · source gates, Type Check · debt ledger, PR-body guards); none failed. Still in progress, so NOT yet a gate verdict: Build Core, Test Core (1/10) to (10/10), Type Check · workspace, Type Check · consumer gates, Lint · CI, release & engine gates. This record judges the design; the queue still owes every one of those green on this head. The dev's local evidence (driver-sql 4438 passed, driver-turso 2593 passed, driver-sqlite-wasm 768 passed, dogfood 4093 passed with 0 failures, ablation 28/30, 28/28 and 6/6 red) is the dev's, not re-run here.

④ Design judgment

No must-fix, no should-fix.

  • sql-driver-sqlite-serialisation.ts — holds. The arm is the single place every SQLite-family write forms its row, so one table decides both what is stored and what is refused; the refusal carries the family and status the neighbouring write refusals carry (sql-driver-oracle-dialect.ts:202, sql-driver-top-level.ts:1458). Tried against it: a prototype-named field (own-property test), -0 and NaN (Map semantics), a multiple boolean (never registered), a second pass over an already-formed row ('1' reads as '1', so the remote pre-pass followed by create is stable), and the earlier NOW() pass (it can only turn a string into another string the table refuses). None breaks it.
  • sql-driver-schema-sync.ts — holds. The emitted SQL is the same bytes; the change is where the literals come from.
  • turso-driver.ts — holds. The pre-pass sits after the column-map refusal and before the first create; it makes the remote batch answer a refused row the way the local single INSERT does. It does not make the remote batch atomic for any other failure, and the comment does not claim it does.
  • The three test files — hold against the rule. The driver-sql pin runs all six doors against a driver-created column and a retyped TEXT column, reads typeof raw, and checks nothing is written on refusal. The turso pin does the same on both faces through a separate client and adds the whole-batch refusal. The runtime pin holds the engine door, the driver door and a beforeInsert assignment to one stored form and one answer across find, count, findOne and REST list / get / delete.

Nits (no effect on correctness or the contract):

  • N1 (nit) — sql-driver-boolean-write-spellings.test.ts's header names SQLITE_BOOLEAN_TEXT_READINGS; the table is SQLITE_BOOLEAN_TEXT_SPELLINGS.
  • N2 (nit) — ACCEPTED_BOOLEAN_TEXT_SENTENCE and the order of the three SQL lists depend on the table's row order (true / false pairs, canonical first). A one-line comment on the table, or a pin on the three rendered lists, would hold "byte-identical" against a later reorder.
  • N3 (nit) — the changeset names beforeInsert / beforeUpdate; the runtime pin exercises beforeInsert only. The update door itself is pinned at the driver on both faces.
  • N4 (nit) — a bigint 1n / 0n is now refused where it used to bind as an INTEGER; the changeset's list of accepted values is exact, so this is stated behaviour, noted for completeness.

Implemented-by: claude/sec2-boolean-write-canonical
Reviewed-by: isolated sub-agent of session_016WV4czt69hUUaG5XcgFNYL

VERDICT: PASS

@objectstack-fleet objectstack-fleet Bot added the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-sales · session_01L6bhgUkbQqRUUFSiu2HGob

Recorded 2026-11-20T04:48Z. Pre-landing notice for this PR's owner. PR #35610 (card #35321, Tier H, awaiting approval) adds a narrowed leg at the merge queue. Once #35610 merges, a pull that declares a narrowing, as this one does, is refused at the queue unless two things are on its head: an authorized approval (or the authorized account's own enqueue), and a standing PASS contract review at CONTRACT_REVIEW_TIER. See the Landing impact section of #35610.

@os-zhuang
os-zhuang marked this pull request as ready for review November 20, 2026 04:52
@os-zhuang
os-zhuang added this pull request to the merge queue Nov 20, 2026
@objectstack-fleet objectstack-fleet Bot removed the pm:awaiting-merge PR only: landing waits on the maintainer's own review and merge (SKILL.md 复核 ②); never on an issue label Nov 20, 2026
Merged via the queue into main with commit 702b0cf Nov 20, 2026
62 checks passed
@os-zhuang
os-zhuang deleted the claude/sec2-boolean-write-canonical branch November 20, 2026 05:21
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/l 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.

3 participants