Repository navigation
fix(driver-sql): boot converges legacy text booleans on SQLite to 1 / 0 - #35076
Conversation
backfillCanonicalBooleans, the fourth schema-sync storage convergence beside the datetime, time and JSON backfills: one guarded UPDATE per boolean/toggle column turns the text 'true' / 'false' into 1 / 0, withholds and warns on any other text, and logs the rows converted with a capped id sample. previewBooleanConvergence lists it under deferred DDL as normalize_boolean_storage. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…nvergence pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…olean-text-backfill
…e per boot One counting scan classifies a boolean column's text cells as legacy 'true' / 'false' or other text; the id sample and the UPDATE run only when it found legacy text. The pins now measure $in, $ne and $nin before the step too, and count the UPDATEs a second boot sends. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
… converted Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
… during collection Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
📓 Docs Drift CheckThis PR changes 2 package(s): 10 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 47 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 4e66167446e55b026c05a38444350c92fb09d271 && git checkout 4e66167446e55b026c05a38444350c92fb09d271
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin a3e216efae9480c2434f1cca746eacc14f366dd3 db8bdd734bdde0f3e0f08ceb71d6e71b8261b259 && git checkout -B drift-repro a3e216efae9480c2434f1cca746eacc14f366dd3 && git merge --no-ff db8bdd734bdde0f3e0f08ceb71d6e71b8261b259
node scripts/docs-audit/affected-docs.mjs --json a3e216efae9480c2434f1cca746eacc14f366dd3
|
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 review — #35076 (#34973 boolean text backfill) · 2026-11-18T01:52ZL1: ACCEPT Surface. All 9 files are inside the claim surface: amendment 6963450544 covers the driver-sql files, pins, changeset and cli.mdx; amendment 6966556044 covers the one-word Route (a), as ruled, checked in the code:
Pins and ablations. 12 driver cases cover: before and after for Clause-②: Must-fix: none. Should-fix (optional, no re-review needed):
Notes:
Landing: seat L2 on the driver contract next, then ordinary queue landing (not Tier H). |
L1 should-fix on the boolean text backfill: the sentence after the boolean paragraph read as if that step preserved stored instants. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 delta review — #35076 · 2026-11-18T01:53ZL1: ACCEPT Delta from the accepted head 30bcd60 (6966602987): one docs-only commit, 0a0c918. It changes Must-fix: none. Should-fix: none. Landing: unchanged. Seat L2 on the driver contract next, then ordinary queue landing (not Tier H) once every check is green on this head. |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: Inputs: card #34973 (body; comments 6961931895, 6963136422, 6963386869 premise, 6963450544 amendment with the seat ruling, 6966532536 build report, 6966556044 amendment), PR #35076 (body, 9 files, net diff from merge base Check-runs on this head at 02:00Z: 21 success, 15 skipped, 16 in progress, 0 failure. Green so far: Check Changeset, Governed Surface Queue Guard, PR-body guards, Spec property liveness, Type Check · source gates, Lint · ESLint, Lint · docs & code guards, Lint · repo & tooling gates, Build Docs, Dogfood Regression Gate. Still running: Test Core 1–10/10, Build Core, Type Check · workspace / consumer gates / debt ledger, Lint · CI, release & engine gates, Live E2E UI. This record judges the contract. It does not stand in for those runs: landing waits for every one of them to be green on this head. ① Derived judgmentsThe predicate converts the legacy spellings and nothing else. Right.
Dialects. Right.
Scope of columns. Right.
Ordering and idempotence of the three existing convergences. Preserved.
The skip-schema-sync door. Right.
The record leaks no field value. Right.
SQL push-down. Right. The count, sample, UPDATE and preview are each one SQL statement per column. No ids are pulled into the app to drive a write, and there is no in-app join. The 5 sampled ids exist only for the log line. Public surface.
The docs match the code on substance, with one wording fault.
② Semver level
③ Boundary flagsOpen questions (premise 6963386869).
Dev deviations (6966532536), each answered.
Out-of-scope findings from the premise:
Findings:
No must-fix. The pins match the claim: 12 driver cases plus the CLI render and summary. They cover before and after for Implemented-by: VERDICT: PASS |
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
…y columns and change-less clients The withheld count no longer counts the canonical text '1' / '0' a TEXT-affinity column stores for the driver's own 1 / 0, and rowsConverted falls back to the counted rows when a client's raw UPDATE reports no changes (driver-sqlite-wasm, knex sqlite3). The PendingSchemaWork rows docblock names normalize_boolean_storage. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGufzg2evNa1V3zxrQq3KX
|
repo:objectstack#3 · os-support-ai · session_01WGufzgQsdnyS4QdR8stjDa L1 delta review — #35076 · 2026-11-18T02:09ZL1: ACCEPT Delta from my ACCEPT on 0a0c918 (6966622908) and seat L2 PASS (6966769750) on the same head. Three commits:
Must-fix: none. Should-fix: none from L1. Seat should-fix 1, the Turso remote face, stays a follow-up, as the seat filed it. Notes: CI at review time showed 8 success, 15 skipped, 19 in progress. Landing waits on all checks being green on this head. Landing: the seat L2 PASS was on 0a0c918. The delta since then is the seat's own should-fix and nits plus a clean merge, so the seat decides whether its L2 carries forward. After that, ordinary queue landing (not Tier H). |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract-review-claim: session_01WGufzgh1zkZzDXL36ckWAG · head |
|
repo:objectstack#3 · os-support-ai · session_01WGufzgh1zkZzDXL36ckWAG Contract reviewServed-tier: This is a delta review. It follows my PASS on Inputs:
The face is unchanged. The delta adds no published schema and no governed path, and the PR still carries only What the delta is. Three commits:
The merge is clean. I compared the sorted Check-runs on this head (read 02:17Z): 27 success, 15 skipped, 11 in progress, 0 failure.
① Derived judgmentsNit 3 fold (TEXT-affinity
Nit 4 fold (
Nit 5 fold. Right. The Should-fix 2 fold (
Should-fix 1 (Turso remote face). Closed to #35084. #35084 is open, Public surface in the delta: none. No export, union member or signature changes. The SQL push-down: holds. The delta adds one aggregate column to the existing per-column scan. There is no new id materialisation, round trip or in-app join. The fallback reuses a number already counted in SQL. ② Semver level
③ Boundary flags
Findings on this delta:
No must-fix and no should-fix on the delta. The PASS on Implemented-by: VERDICT: PASS |
|
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX Landing · 2026-11-18T02:37Z · area o3-A
State: Scope: route a under the seat ruling (claim 6963136422, amendments 6963450544 and 6966556044). Clause-② yes (widening: Merge standard: no open must-fix or should-fix.
Dev-effort: high · Rounds: 1 premise + 1 build + 1 review fold |
Requested by Yibo Wang · project thread
repo:objectstack#3 · os-support-ai · session_01WGufzg2evNa1V3zxrQq3KX
Closes #34973
Clause-②: yes (widening:
@objectstack/driver-sqlexportsPendingSchemaWorkKindfrom its index, and the CLI consumes it, so the union gains one published value,normalize_boolean_storage; boolean filters, sorts and groupBy on SQLite now answer legacy text rows as their boolean)Metadata-protocol: none
维护者速读
'true'/'false',启动时的 schema sync 会把它们改写成1/0(第四个存储收敛步骤,和 datetime、time、JSON 回填并列);os migrate plan会把这一步列成normalize_boolean_storage并给出行数。= false、$in、!=、$nin、排序和分组都拿原始文本去比,结果漏行或分错组(文本'false'在分组里显示成 true)。UPDATE,只改这两个文本拼法,其他文本只计数和告警、绝不改写;第二次启动改写 0 行。没有回滚步骤,因为改写后语义不变,撤回只会恢复有缺陷的形态;回滚代码即可停止该步骤,已改写的行无需还原。packages/drivers/driver-sql/src/sql-driver-schema-sync.ts(backfillCanonicalBooleans的计数/采样/UPDATE 与previewBooleanConvergence)、packages/drivers/driver-sql/src/sql-driver-rotation.ts(initObjects里新增的一次调用)、packages/cli/src/utils/schema-migrate.ts(摘要行措辞)。pnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-34916-boolean-text-read.test.ts,预期 23 个测试全部通过。Premise (measured, wider than filed)
Measured on
origin/main4443014630cin the premise report on #34973 and restated in the claim amendment; nothing here goes beyond those measurements.'true'/'false': the column's NUMERIC affinity folds the text'1'/'0'into integers and keeps'true'/'false'as TEXT. Postgres, MSSQL, MySQL and Oracle coerce or refuse the text (code reading; no rig in this container).=only. On those rows=,$in,!=and$ninall answer wrongly at the driver, the engine and the REST door; ORDER BY sorts them after every integer; aggregate groupBy presents a text'false'as true.'false'comparand narrows tofalse), so the fix is raw SQL in the driver.What changes
sql-driver-schema-sync.ts:backfillCanonicalBooleans, the fourth driver storage convergence. SQLite only, for an existing table's scalarField.boolean/Field.togglecolumns. Per column: one counting scan over the column's text cells sorts them into legacy'true'/'false'and other text. Only when the scan finds legacy text does the step take an id sample (up to 5) and run ONEUPDATE … set col = case col when 'true' then 1 when 'false' then 0 end where typeof(col) = 'text' and col in ('true', 'false'). The count, the sample, theUPDATEand the preview all read one shared predicate (SQLITE_LEGACY_BOOLEAN_TEXT). Failures are logged atwarnand swallowed, the same as the sibling backfills, so the next boot tries again.sql-driver-schema-sync.ts:previewBooleanConvergence, called frompreviewDeferredSchemaWork. It counts the same predicate and reports{ kind: 'normalize_boolean_storage', columns, rows }.sql-driver-rotation.ts: one call beside the datetime, time and JSON backfills ininitObjects, plus the hostPick.sql-driver.ts: the two host stubs (pointer docblocks only, because the facade sits under its line ceiling).schema-drift.ts:PendingSchemaWorkKindgainsnormalize_boolean_storage, which counts as in place under the existingisInPlaceSchemaWorkrule.packages/cli/src/utils/schema-migrate.ts: theos migrate plan/applysummary readN temporal column(s) to converge in place, so with this change a boolean column would have been counted as temporal. It now readsN column(s) to converge in place. The amendment expected no CLI change, because the renderer itself is generic, and it is; the summary label was the one word that would have become false.content/docs/deployment/cli.mdx: one example line and one paragraph for the new kind. A root changeset (driver-sql and cli, patch).Record and reversibility
The seat ruling (22:57Z), quoted from the claim amendment:
infoline with{ table, field, rowsConverted, sampleIds }, with at most 5 ids.'TRUE','yes') is never rewritten. It is counted and logged atwarnas{ table, field, rowsWithheld }.UPDATEon SQLite.Dry-run path
os migrate plan(deferred DDL) lists the step in place asnormalize_boolean_storage: COLUMNS — N row update(s)and writes nothing. The count is the one the step would convert, never the withheld rows.os migrate applyruns it after the confirmation, via the flush, which callsinitObjects.OS_SKIP_SCHEMA_SYNC=1skips it, because that boot takes the DDL-freeregisterObjectMetadatadoor (registerSchemasWithoutDdlin the objectql plugin), which reaches no backfill.Pins and ablations
The pins live in
packages/drivers/driver-sql/src/sql-driver-34916-boolean-text-read.test.ts(three[#34973]describes) andpackages/cli/src/utils/schema-migrate.pending-render.test.ts.= false/= truemiss the text rowsinitObjects,=finds them (toggle too)$in,$ne,$nin: wrong before, right after'false'as true) before, 3 afterinforecord:rowsConverted+sampleIdsper fieldskipSchemaSync(registerObjectMetadata) leaves the text rows untouchednormalize_boolean_storagewith its count, in place, and writes nothingdeal [normalize_boolean_storage: won — 3 row update(s)]in placeAblation C, CLI summary wording (
column(s)put back totemporal column(s)):summarizePendingSchemaWork … never omits in-place workwent red (Expected: "6 column(s) to converge in place"). The 12 other tests stayed green.All three ablations went through
scripts/ablation-replace.mjsin WRAP mode, plus an outer EXIT/INT/TERM trap, and the tests importsrc/directly (nodist/, so no rebuild leg). Each one was restored by blob:Ablation evidence
Tests
All readings from the worktree
objectstack-issue-34973, after mergingorigin/main367e324eeb4and rebuilding the cli closure (turbo run build --filter='@objectstack/cli^...' --filter=@objectstack/cli, 64/64 tasks).383a794b4fd:Tests 21 passed (21).30bcd609ea0touches only the cli test.pnpm --filter @objectstack/driver-sql typecheck && vitest runat383a794b4fd:Test Files 260 passed | 13 skipped (273),Tests 4366 passed | 251 skipped (4617),VERDICT command-exit 0.pnpm --filter @objectstack/cli typecheck && vitest run --project unitat383a794b4fd:Test Files 426 passed (426),Tests 6057 passed (6057),VERDICT command-exit 0.30bcd609ea0: clitypecheckexit 0 (check:test-typecheck: OK). The pending-render, lazy-driver-import and tier-partition files:Tests 38 passed (38).integrationlayer is declared to CI: the diff touches no integration file and no spawn entry.Acceptance notes
skipSchemaSyncpin works at the driver: it calls the door the objectql plugin uses for that boot (registerObjectMetadata), and does not boot the plugin. It stays green under ablation A by design.Verification
dispatch-gates --commandsderived 109 families for 9 paths (merge base367e324ee). I ran all 109 at30bcd609ea0: 108 exit 0, andcheck:type-check-debtis NOT MEASURED (verify-lock queue-timeout, exit 99; the lock was held by another worktree's suite run). It was exit 0 at383a794b4fd, and30bcd609ea0adds only test imports.--ranreconciliation: 109 derived, 108 run, 1 UNRUN (that family). CI'sLint & Repo Gatescarries it.check:test-source-aliaswas red at383a794b4fd: 7 guarded imports reached from the edited pending-render test. It is green at30bcd609ea0, after module-top side-effect imports were added (its printed remedy). The bare imports are no value imports, so the file stays in theunittier.check-governed-merges --branchat30bcd609ea0: NOT governed, 0 of 9 paths, 511 changed lines (+502 / -9), under 3000.overlap-checkat30bcd609ea0:VERDICT clean exit 0againstorigin/mainand feat(cli): os skills install, update and status at the server's version, with or without a project #35060, fix(spec,metadata-protocol)!: retire the seed modes insert and replace, which inserted every record again on each replay #34791 and fix(auth)!: a server outside development mode refuses a development seed credential #34717, which sharecontent/docs/deployment/cli.mdxand merge cleanly.!, and the Clause-② arm is(widening).Delta round (head
db8bdd734bd, after seat L2 PASS 6966769750)c26c7d7551a, docs, folds seat should-fix 2: the closing sentence incli.mdxnow names all three in-place steps. It says only the MySQL widen is a table rebuild.dcbecc37966mergesorigin/main(K = 17).overlap-checkgivesVERDICT clean exit 0againstorigin/mainand feat(cli): os skills install, update and status at the server's version, with or without a project #35060, fix(spec,metadata-protocol)!: retire the seed modes insert and replace, which inserted every record again on each replay #34791 and fix(auth)!: a server outside development mode refuses a development seed credential #34717.db8bdd734bdfolds seat nits 3, 4 and 5:'1'/'0'that a TEXT-affinity column stores.rowsConvertedfalls back to the counted rows when a client's rawUPDATEreports nochanges(driver-sqlite-wasm, knexsqlite3).PendingSchemaWork.rowsdocblock namesnormalize_boolean_storage.'1'/'0'are not withheld, and the legacy'true'still converges. Ablation 3 puts the withheld formula back totext_rows - legacy:Tests 1 failed | 22 passed (23).changes: the record carries the counted rows. Ablation 4 puts the fallback back to0:Tests 1 failed | 22 passed (23).db8bdd734bd: the pin file showsTests 23 passed (23), and driver-sqltsc --noEmitexits 0. The full driver-sql suite was not re-run locally; CI's Test Core carries it.Generated by Claude Code