Repository navigation
fix(driver-turso): the REMOTE face relaxes a NOT NULL column in place with libSQL ALTER COLUMN, applied only on a read-back - #34408
Conversation
Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 4 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 8 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 a54ba2467553f4bb6ab0301dae33dda9b7ae5275 && git checkout a54ba2467553f4bb6ab0301dae33dda9b7ae5275
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 9e6fee19ea358232196e1f704198612a2de34710 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8 && git checkout -B drift-repro 9e6fee19ea358232196e1f704198612a2de34710 && git merge --no-ff 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8
node scripts/docs-audit/affected-docs.mjs --json 9e6fee19ea358232196e1f704198612a2de34710
|
…ace relax (#33724 fix round 1) Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
|
review#1 · os-mickey · session_01ASNY8Ywba8ySbMdWvra2vS Declined 2026-11-16T14:49Z. review#1 does not take this review (mailbox knock 6919749589). The face is the declaration alone ( |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head a6797ba · 2026-11-16T15:30Z |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: ① Derived judgmentsRead: card #33724 with all 16 comments (ruling 6915086281 letter A and its six parameters, claim 6915158382, amendment 6917885070, reports 6917853648 and 6919701288, cloud fact 6920763007), the PR body, the net diff of 12 files, the check-runs. No earlier contract-review record exists on this PR; 6919805011 is a decline, 6920860730 the claim.
② Semver level
③ Boundary flagsData safety of the in-place change (the code, read):
M1 (must-fix) — ruling parameter 4's first step is not met at this head. The ruling makes pinning the statement against a real S1 (should-fix) — a measured refusal class has not been put to the maintainer. The Acceptance note measures that libSQL refuses the relax for any column whose stored definition holds a comma (a DEFAULT, a CHECK, N1 (nit) — changeset wording "the exported N2 (nit) — N3 (nit) — the early Docs line ( Check-runs on the head: 57 runs, none red, none running (success or skipped). The PR is draft. Implemented-by: VERDICT: FAIL |
…outcome as unknown
A failed batch is called refused only when the stored table SQL, read again,
is what it was; a transport error after a possible commit is logged as an
unknown outcome that the next drift read decides. An already-nullable or
missing column now logs why nothing was sent. The changeset names the
published widening as TursoDriver.applyMigrationEntries and
driftApplyLimit('relax_not_null') on the remote face.
Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL
Co-authored-by: Claude <noreply@anthropic.com>
…relaxed Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
… relax has landed Measured on sqld 0.24.33: after the relax lands, an apply without --allow-destructive has no safe entry left and answers nothing_safe_to_apply. Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
…d, and document it Ruling 6922037129 accepts the limit: a column whose stored definition holds a comma keeps its NOT NULL on the remote face, and the apply lists it as not applied. The logged reason now says the definition holds a comma, the docs name the class, and the changeset says the same. Claude-Session: https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL Co-authored-by: Claude <noreply@anthropic.com>
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head 00fadc5 · 2026-11-16T16:30Z |
|
review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR Contract reviewServed-tier: Delta round against this seat's FAIL 6920999561 (head ① Derived judgments
② Semver levelUnchanged and correct: ③ Boundary flagsEarlier findings:
New in this round. No must-fix, no should-fix.
Open questions: none in reports 6921327686, 6921757949, 6922308957. Still not measured, and named as such by the ruling: a hosted Turso database; that is the card's closing check, not this PR's. SQL push-down: no new id materialisation or in-app join. The delta adds one catalog read on the failure path only. Check-runs on the head: 57 runs, all concluded: 40 success, 17 skipped, none red, none running. The PR head is still this sha. The PR is draft. Implemented-by: VERDICT: PASS |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL Request: review · PR #34408 · area o1-B · Part of #33724 · head
|
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi 席位核对 · ACCEPT (L1, first read) · Head-sha: 00fadc5 · 2026-11-16T16:58ZL1 thread L1-a for area o1-B, reading the final head declared in 6923107247. I read card #33724, maintainer rulings 6915086281 (letter A, six parameters) and 6922037129 (the comma class accepted), the PR body, review#2's PASS 6923055131 on this head, and the full diff against merge base
Notes (not blocking)
Landing: not Tier H. Area o1-B lands it once |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL Verdict: ACCEPT at 2026-11-16T17:00Z, and the landing rides this stroke. ACCEPT → PR #34408 comment 6923152602.
State: ready plus auto-merge through the merge queue. |
|
repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL Re-queue · 2026-11-16T17:32Z: PR #34408 left the merge queue on CI_FAILURE. The only red is the |
Requested by Leehom · project thread
Part of #33724
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
NUMERIC(10, 2)这类宽度、注释)托管库改不了,保持必填,apply 列为未应用,日志写明"定义里有逗号",不重建表;平台自己建的列不带逗号,不受影响。回滚 = revert 本 PR,托管上回到"跳过"。packages/drivers/driver-turso/src/turso-driver.ts(applyRemoteRelaxNotNull,批内检查、读回与失败时的日志)、packages/drivers/driver-turso/src/remote-relax-not-null.ts(从库里存的建表语句切出这一列的定义)、turso-remote-migration-entries.test.ts的 relax 一组。pnpm --filter @objectstack/driver-turso exec vitest run src/turso-remote-migration-entries.test.ts,预期 18 条全绿,其中 relax 5 条(已应用、逗号被拒且日志点名、提交后传输出错记为结果未知、意外拼接回滚、安装门已应用)。What changes
The maintainer's ruling on #33724 (record 6915086281, letter A): the Turso REMOTE face relaxes a NOT NULL column in place with libSQL's own
ALTER TABLE t ALTER COLUMN c TO c DEFINITION, and runs no table rebuild.REMOTE_DRIFT_OP_ANSWERS.relax_not_null:'needs-table-rebuild'becomes'applied'. It is the one declaration both the apply door anddriftApplyLimit(whatos migrate planreads) dispatch by, so the plan now lists a remote relax with no transport limit.tighten_not_null,drop_column_default, the widths andwiden_date_to_datetimekeep'needs-table-rebuild'(ruling parameter 1).TursoDriver.applyRemoteRelaxNotNull(new, private), reached from the REMOTE column drift arm:planRelaxedColumnDefinition(new moduleremote-relax-not-null.ts) lexes the table's storedCREATE TABLE(quotes, brackets, both comment forms, nesting) and cuts out the column's own definition. It removes only[CONSTRAINT name] NOT NULL [ON CONFLICT x]at the definition's own depth and keeps every other byte. Measured on libSQL: whatever the text afterTOleaves out is gone from the column, so a definition rebuilt frompragma_table_infowould silently drop a CHECK, a COLLATE, a UNIQUE or a REFERENCES clause.writebatch: the statement and a check. The check is a SELECT that fails (json()over a malformed argument, evaluated only on the CASE's mismatch arm) unlesssqlite_master.sqlnow equals exactly the planned table SQL. If libSQL splices any other way, the whole batch rolls back.false, which the apply door reportsskipped, and the reason is logged atwarn(the caller gets the skipped entry).relaxDeclaredNotNull(the managed install) andapplyPublishedColumnChanges(the publish) stayinherited, so they reach this arm through the face's ownapplyMigrationEntries, as doesos migrate apply. The REMOTE face runs no boot reconcile, and a remote sync of the upgraded declaration leaves the column NOT NULL (pinned).content/docs/deployment/cli.mdx: the remote-primary paragraph says the relax is applied in place, and how a refusal reads.@objectstack/driver-tursopatch.Tests
remote-relax-not-null.test.ts(new, 10 cases): the planner over the stored-text shapes a hosted table can hold. These include a parenthesised DEFAULT, a named constraint with ON CONFLICT,NOT DEFERRABLEandSET NULL(not the constraint),NUMERIC(10, 2), comments, every SQLite quoting, a string that readsNOT NULL, and table constraints. There are refusals for a missing clause, a missing or doubled column, and unterminated text.turso-remote-migration-entries.test.ts, over a real libSQL connection, read back through a second connection::290now pins atighten_not_nullas skipped, with the stored SQL byte-identical.:318now pinsrelaxDeclaredNotNullas applied: the column is nullable with the same type and DEFAULT, and a NULL write succeeds. It also pins that a remote sync of thenotNull: falsedeclaration does NOT relax (ADR-0113 D5).integrity_checkare unchanged, and a re-run is a no-op.turso-remote-drift-apply-limit.test.ts:driftApplyLimit('relax_not_null')isnullon the REMOTE face, and the apply door applies the relax (memoreads nullable). This is the driver half of theos migrate planlisting.turso-remote-relax-not-null-sqld.test.ts(new, skipped unlessOS_TEST_SQLD_BIN): FIRST the bare statement on a realsqldwith a column read-back and a NULL write, then the install door on a remote-mode driver with no client of its own. Measured since on officialsqld0.24.33: 2/2 (records 6921391723, 6921439242; Fix round 3 and 4).Acceptance notes
('a,b'),(strftime('%Y','now'))), a CHECK, a width (NUMERIC(10, 2)) or a comment makes the splicedCREATE TABLEunparseable, and the statement is refused. Such a column keeps its NOT NULL and the entry is skipped. Columns this face creates (TYPE [NOT NULL]) have no comma. A realsqld0.24.33 refuses such a column the same way (record 6921391723); the limit is accepted by ruling 6922037129 (Fix round 4).## Fix round 1).relaxInstallDeclaredNotNull(cloud-connection) is a pass-through to the driver'srelaxDeclaredNotNull, which is pinned here. A pin of the helper itself against a REMOTE-face driver is NOT MEASURED: cloud-connection has no driver-turso dependency, and the helper's tests are outside this surface.Verification
Targeted tests and typecheck (lock VERDICT command-exit 0)
Full driver-turso suite at 342fedf (lock VERDICT command-exit 0)
Ablations (one-off, the change committed first, restored by ablation-replace with blob == HEAD)
Derived gates (dispatch-gates --ran: 100 derived, 96 run, 4 NOT-MEASURED, 0 UNRUN)
sqldpin (ruling parameter 4's first step), first NOT MEASURED here, was measured by the maintainer's decision thread on officialsqld0.24.33: 2/2 (6921391723, 6921439242), and rerun on the final head in Fix round 4. CI has nosqld, so CI does not exercise it.packages/drivers/driver-turso(54 open PRs read), so there was nothing tomerge-treeagainst.Fix round 1
Claim amendment 6917885070 extended the file surface to the three pins outside driver-turso that the ruling makes false. Only tests change outside
packages/drivers/driver-turso/**. TheClause-②andMetadata-protocollines are unchanged.packages/runtime/src/domains/meta-object-publish-column-changes.test.ts: the Turso REMOTE describe now pins both halves on the same face.titlein place, with noobject-column-changes-not-appliedadvisory, and a create that omits the field succeeds.instr("title", ',') >= 0). libSQL ends the old definition at that comma, so the relax is refused, the publish answers the advisory, and the column keeps NOT NULL.packages/cli/src/commands/migrate/apply.remote-face.integration.test.ts(sqld-gated): the relax names no transport limit, and the plan footer counts 1 change it cannot apply, not 2. The first apply that confirms the relax (--yes) lands it, somemoreads nullable from then on, and the later cases list only the drop and the tightening. The edit also added the module-top importscheck:test-source-aliasasks of an edited test file (seven packages the CLI source imports dynamically).apply.remote-posture.test.tsandplan.apply-limit.test.ts: the stubbed driver declares a limit fortighten_not_nullalone and applies the relax. The relax line carries its finding with no limit, and the plan footer counts 1.Round 1 readings (all under the lock)
check:route-envelope,check:cross-package-test-inputs,check:nul-bytes,check:test-source-alias,check:undeclared-dep-imports,check:issue-citationsandcheck:doc-authoringexit 0.check:i18n,check:i18n-coverageandcheck:i18n-walk-parityare NOT MEASURED (exit 3, prerequisite: unbuilt packages); CI ran them inLint & Repo Gates.Lint & Repo Gates, which was red on cfc0ab8 atcheck:test-source-aliasand is fixed by the imports above.sqldpin is measured, 2/2.)Fix round 2
Answers review#2 (contract-review FAIL 6920999561 on
a6797ba0), items N1, N2 and N3 only. M1 (the real-sqld pin) and S1 (the comma refusal class) are with the maintainer and untouched. The docs page and the maintainer summary are unchanged. Dev report 6921327686 on #33724.REMOTE_DRIFT_OP_ANSWERSexported. It names the published widening as behaviour on the remote face:TursoDriver.applyMigrationEntriesnow applies arelax_not_nullentry, andTursoDriver.driftApplyLimit('relax_not_null')answersnullwhere it answered the table-rebuild sentence.applyRemoteRelaxNotNullreads the stored table SQL again before it logs. If it reads as before the send, the log says nothing landed. If it no longer reads as before, or cannot be read, the log says the outcome is unknown and the next drift read decides. The log never says the batch rolled back.the table has no such column; nothing was sent; an already-nullable column logsthe column is already nullable; nothing was sent.turso-remote-migration-entries.test.ts, existinglogger.warnspy pattern): the converged re-run asserts the already-nullable line; the comma refusal assertsnothing landed; a new case commits the real send and then throwsfetch failed: socket hang up, and asserts the entry is skipped, the column reads nullable, the line says the outcome is unknown, and the next drift read finds no relax left on that column.now === storedforced true reddens the unknown-outcome case; the already-nullable skip replaced by a bare return reddens the converged case. Both restored to HEAD blobs.709476e3(under the lock): driver-turso typecheck passed; targeted files 34 passed, 2 skipped (the sqld file, M1, not measured); full driver-turso suite 2563 passed, 36 skipped.Fix round 3
M1 is closed by the maintainer's real-sqld measurement (record 6921391723 on
a6797ba0, addendum 6921439242 on709476e3): officialsqld0.24.33 accepts the in-place relax, and the driver-turso pin passes 2/2. That measurement found one wrong expectation in the cli gated file, and this round fixes only that. S1 (the comma class) waits for its own ruling. Dev report 6921757949 on #33724.apply.remote-face.integration.test.ts, case "apply without --allow-destructive". The relax lands in the case before it, so this run has no safe entry left andapply.tsanswersmessage: 'nothing_safe_to_apply'. The expectation now states that exact value (toBe('nothing_safe_to_apply'), wastoBeUndefined()). No product code changed.715fc6a1(binary sha25628d1039e…816f,sqld 0.24.33 (40a151bd 2025-12-19), under the verify lock): driver-tursoturso-remote-relax-not-null-sqld.test.ts2/2; cliapply.remote-face.integration.test.ts9/9. The red leg is the measurement record itself (1 failed at :460 on both earlier heads).Fix round 4
Ruling-ref: 6922037129 (S1, letter A, the limit accepted). On the Turso REMOTE face, a column whose stored definition holds a comma keeps its NOT NULL. The apply lists it as not applied and says why, the docs name the class, and no rebuild fall-back is added. Dev report 6922308957 on #33724.
os migrate applynames the entry under "change(s) were NOT applied — the driver could not perform them on this database (its log above says why)", and--jsoncarries it innotApplied. The driver's warn line gave only the server's raw SQLite error. When the refused definition holds a comma, the line now ends:The column's stored definition holds a comma, and libSQL's ALTER COLUMN ends the old definition at the first comma after the column's name, so this transport cannot relax it: the column keeps its NOT NULL. Pinned on the comma case; the comma-free unpredicted-splice case asserts the line does not carry it.content/docs/deployment/cli.mdx, Turso remote paragraph, names the class (a DEFAULT or CHECK with a comma, a type width such asNUMERIC(10, 2), a comment) and what the operator sees (listed not applied, the log naming the comma, the column keepingNOT NULL, no rebuild). Columns the platform creates on a remote primary areTEXT,INTEGERorREALwith no DEFAULT and no width, so they are outside the class.sqld0.24.33 refuses such a column the same way, that the logged reason names the comma, and that the maintainer accepted the limit.00fadc55(under the lock): full driver-turso suite 2563 passed, 36 skipped; realsqld0.24.33 pin 2/2. Ablation of the comma-class condition reddens the comma case (1 failed, 17 passed); restored to HEAD. Gates exit 0: check:doc-authoring, nul-bytes, issue-citations, durability log level, changeset no-major / empty, closing-keyword parity, docs section name.