Skip to content

fix(driver-turso): the REMOTE face relaxes a NOT NULL column in place with libSQL ALTER COLUMN, applied only on a read-back - #34408

Merged
objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-33724-remote-relax-not-null
Nov 16, 2026
Merged

objectstack-fleet[bot] merged 9 commits into
mainfrom
claude/issue-33724-remote-relax-not-null

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Leehom · project thread

Part of #33724

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 改了什么:托管库(Turso 远程连接方式)上,"去掉一列的不能为空"现在真的会执行:用 libSQL 自带的改列语句就地改这一列,只删掉 NOT NULL 这几个字,不搬数据、不重建表。
  • 为什么改:应用包升级把必填字段改成选填后,托管客户的数据库还在拒绝空值,保存全部失败;裁决 6915086281 选 A(就地改这一列),本 PR 是框架半边。
  • 风险与回滚:只放宽不收紧;语句和"表定义必须恰好变成预期样子"的检查放在同一批里,任何意外整批回滚、表一字不变;读回确认才算成功。已知限制(裁决 6922037129,接受):列定义里带逗号的列(DEFAULT 或 CHECK 里有逗号、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 条(已应用、逗号被拒且日志点名、提交后传输出错记为结果未知、意外拼接回滚、安装门已应用)。
  • 需要你做的:无,席位落地(真实 sqld 0.24.33 已实测:两份门控文件 2/2、9/9)。

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 and driftApplyLimit (what os migrate plan reads) dispatch by, so the plan now lists a remote relax with no transport limit. tighten_not_null, drop_column_default, the widths and widen_date_to_datetime keep 'needs-table-rebuild' (ruling parameter 1).
  • TursoDriver.applyRemoteRelaxNotNull (new, private), reached from the REMOTE column drift arm:
    • The definition comes from the database, not from metadata (parameter 5). planRelaxedColumnDefinition (new module remote-relax-not-null.ts) lexes the table's stored CREATE 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 after TO leaves out is gone from the column, so a definition rebuilt from pragma_table_info would silently drop a CHECK, a COLLATE, a UNIQUE or a REFERENCES clause.
    • One write batch: 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) unless sqlite_master.sql now equals exactly the planned table SQL. If libSQL splices any other way, the whole batch rolls back.
    • Applied only on a read-back (parameter 3). The column then reads nullable, with the type, the DEFAULT and the pk position it had. Anything else is false, which the apply door reports skipped, and the reason is logged at warn (the caller gets the skipped entry).
    • No fall-back (parameter 4). A refusal is a refusal.
  • The doors do not change (parameter 2). relaxDeclaredNotNull (the managed install) and applyPublishedColumnChanges (the publish) stay inherited, so they reach this arm through the face's own applyMigrationEntries, as does os migrate apply. The REMOTE face runs no boot reconcile, and a remote sync of the upgraded declaration leaves the column NOT NULL (pinned).
  • The local face is untouched (parameter 6).
  • content/docs/deployment/cli.mdx: the remote-primary paragraph says the relax is applied in place, and how a refusal reads.
  • Changeset: @objectstack/driver-turso patch.

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 DEFERRABLE and SET NULL (not the constraint), NUMERIC(10, 2), comments, every SQLite quoting, a string that reads NOT 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:
    • The old skip pin at :290 now pins a tighten_not_null as skipped, with the stored SQL byte-identical.
    • The old install pin at :318 now pins relaxDeclaredNotNull as applied: the column is nullable with the same type and DEFAULT, and a NULL write succeeds. It also pins that a remote sync of the notNull: false declaration does NOT relax (ADR-0113 D5).
    • New: both columns of a hand-made table are relaxed. The stored SQL loses only the two NOT NULL clauses. Indexes, rows, DEFAULT, CHECK, COLLATE-backed UNIQUE and integrity_check are unchanged, and a re-run is a no-op.
    • New: a DEFAULT with a comma is refused by libSQL. The entry is skipped and the table byte-identical.
    • New: a splice the plan did not predict (the statement altered on its way out) is rolled back by the in-batch check.
  • turso-remote-drift-apply-limit.test.ts: driftApplyLimit('relax_not_null') is null on the REMOTE face, and the apply door applies the relax (memo reads nullable). This is the driver half of the os migrate plan listing.
  • turso-remote-relax-not-null-sqld.test.ts (new, skipped unless OS_TEST_SQLD_BIN): FIRST the bare statement on a real sqld with 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 official sqld 0.24.33: 2/2 (records 6921391723, 6921439242; Fix round 3 and 4).

Acceptance notes

  • libSQL's splice, measured (embedded libSQL, SQLite 3.45.1): libSQL ends the old definition at the first comma after the column name. A comma inside a DEFAULT (('a,b'), (strftime('%Y','now'))), a CHECK, a width (NUMERIC(10, 2)) or a comment makes the spliced CREATE TABLE unparseable, 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 real sqld 0.24.33 refuses such a column the same way (record 6921391723); the limit is accepted by ruling 6922037129 (Fix round 4).
  • The three pins the change made false outside driver-turso were rewritten in fix round 1, after claim amendment 6917885070 extended the file surface (see ## Fix round 1).
  • relaxInstallDeclaredNotNull (cloud-connection) is a pass-through to the driver's relaxDeclaredNotNull, 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)
pnpm --filter @objectstack/driver-turso build && pnpm --filter @objectstack/driver-turso typecheck && vitest run (4 files)
 Test Files  3 passed | 1 skipped (4)
      Tests  33 passed | 2 skipped (35)
tsc --noEmit --listFiles: the four touched test files are in the program (101 test files)
Full driver-turso suite at 342fedf (lock VERDICT command-exit 0)
pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=2
 Test Files  100 passed | 1 skipped (101)
      Tests  2562 passed | 36 skipped (2598)
Ablations (one-off, the change committed first, restored by ablation-replace with blob == HEAD)
1. the check always passes (= ? THEN 1  ->  = ? OR 1 THEN 1):
   x a splice the plan did not predict lands nowhere ...   (applied instead of skipped)
   Tests 1 failed | 16 passed (17); restored blob e91ad7ca8fe6 == HEAD
   The read-back alone reported that splice applied: it had dropped the CHECK, which pragma_table_info cannot see.
2. relax_not_null: 'applied' -> 'needs-table-rebuild':
   4 failed | 19 passed (23): the drift-apply-limit pin, the in-place relax, the check, the install door
   restored blob e91ad7ca8fe6 == HEAD
Derived gates (dispatch-gates --ran: 100 derived, 96 run, 4 NOT-MEASURED, 0 UNRUN)
96 exit 0, among them check:durability-log-level, check:nul-bytes, check:doc-authoring,
check:issue-citations, check:test-source-alias, check:cross-package-test-inputs, check:driver-conformance
NOT MEASURED: spec check:skill-examples, check:dual-build-cjs-loads (exit 3, prerequisite: unbuilt packages)
NOT MEASURED: check:query-options-erasure, check:type-check-debt (400 s timeout on a shared box; CI owns them)
  • The real sqld pin (ruling parameter 4's first step), first NOT MEASURED here, was measured by the maintainer's decision thread on official sqld 0.24.33: 2/2 (6921391723, 6921439242), and rerun on the final head in Fix round 4. CI has no sqld, so CI does not exercise it.
  • No open PR touches packages/drivers/driver-turso (54 open PRs read), so there was nothing to merge-tree against.

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/**. The Clause-② and Metadata-protocol lines 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.
    • The publish relaxes title in place, with no object-column-changes-not-applied advisory, and a create that omits the field succeeds.
    • The advisory stays covered by a column the face refuses. Its stored definition is given a comma by hand, inside a CHECK every row satisfies (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, so memo reads nullable from then on, and the later cases list only the drop and the tightening. The edit also added the module-top imports check:test-source-alias asks of an edited test file (seven packages the CLI source imports dynamically).
  • apply.remote-posture.test.ts and plan.apply-limit.test.ts: the stubbed driver declares a limit for tighten_not_null alone 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)
Build: --filter runtime^... --filter cli^... --filter driver-turso build -> VERDICT command-exit 0
GREEN at a6797ba07c:
  runtime meta-object-publish-column-changes.test.ts      Test Files 1 passed, Tests 5 passed (5)
  cli --project unit plan.apply-limit + apply.remote-posture  Test Files 2 passed, Tests 24 passed (24)
  cli --project integration apply.remote-face.integration     Tests 3 passed | 6 skipped (9): the sqld cases skip, no OS_TEST_SQLD_BIN
PREVIOUS behaviour (relax_not_null back to 'needs-table-rebuild', driver-turso rebuilt):
  ablation-replace: mutation landed, blob e91ad7ca8fe6 -> 72938d38df31
  ablation-dist-preflight: marker present in 2 built files (dist spelling relax_not_null: "needs-table-rebuild")
  runtime file: 1 failed | 4 passed (5)
    x [#33724] Turso REMOTE: the relax is applied in place ... (the advisory came back)
    the refused-relax advisory pin stays green under both behaviours, as it should
  restored: blob == HEAD, git diff HEAD empty; dist preflight --absent passes, tree clean
cli stub files: no driver behaviour to ablate (each stub declares its own posture); the sqld file: NOT MEASURED
  • Gates for the new paths: check:route-envelope, check:cross-package-test-inputs, check:nul-bytes, check:test-source-alias, check:undeclared-dep-imports, check:issue-citations and check:doc-authoring exit 0. check:i18n, check:i18n-coverage and check:i18n-walk-parity are NOT MEASURED (exit 3, prerequisite: unbuilt packages); CI ran them in Lint & Repo Gates.
  • CI on a6797ba: 38 success, 15 skipped, 0 failure. That includes Test Core (8/8 shards) and Lint & Repo Gates, which was red on cfc0ab8 at check:test-source-alias and is fixed by the imports above.
  • (Superseded by Fix round 3: the real-sqld pin 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.

  • N1, the changeset. It no longer calls REMOTE_DRIFT_OP_ANSWERS exported. It names the published widening as behaviour on the remote face: TursoDriver.applyMigrationEntries now applies a relax_not_null entry, and TursoDriver.driftApplyLimit('relax_not_null') answers null where it answered the table-rebuild sentence.
  • N2, a failed batch's outcome. The catch in applyRemoteRelaxNotNull reads 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.
  • N3, the early return. A missing column logs the table has no such column; nothing was sent; an already-nullable column logs the column is already nullable; nothing was sent.
  • Pins (turso-remote-migration-entries.test.ts, existing logger.warn spy pattern): the converged re-run asserts the already-nullable line; the comma refusal asserts nothing landed; a new case commits the real send and then throws fetch 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.
  • Ablations: now === stored forced true reddens the unknown-outcome case; the already-nullable skip replaced by a bare return reddens the converged case. Both restored to HEAD blobs.
  • Verification on 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 on 709476e3): official sqld 0.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 and apply.ts answers message: 'nothing_safe_to_apply'. The expectation now states that exact value (toBe('nothing_safe_to_apply'), was toBeUndefined()). No product code changed.
  • Real-sqld runs on 715fc6a1 (binary sha256 28d1039e…816f, sqld 0.24.33 (40a151bd 2025-12-19), under the verify lock): driver-turso turso-remote-relax-not-null-sqld.test.ts 2/2; cli apply.remote-face.integration.test.ts 9/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.

  • The reason, checked and then sharpened. The not-applied listing already existed: os migrate apply names the entry under "change(s) were NOT applied — the driver could not perform them on this database (its log above says why)", and --json carries it in notApplied. 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.
  • Docs. content/docs/deployment/cli.mdx, Turso remote paragraph, names the class (a DEFAULT or CHECK with a comma, a type width such as NUMERIC(10, 2), a comment) and what the operator sees (listed not applied, the log naming the comma, the column keeping NOT NULL, no rebuild). Columns the platform creates on a remote primary are TEXT, INTEGER or REAL with no DEFAULT and no width, so they are outside the class.
  • Changeset. Adds that a real sqld 0.24.33 refuses such a column the same way, that the logged reason names the comma, and that the maintainer accepted the limit.
  • Verification on 00fadc55 (under the lock): full driver-turso suite 2563 passed, 36 skipped; real sqld 0.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.

@github-actions github-actions Bot added size/l 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 16, 2026
@github-actions

github-actions Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/driver-turso, touching 15 documentable anchor(s).

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

  • content/docs/data-modeling/drivers.mdx (via TursoDriver (symbol, a top-level class))
  • content/docs/deployment/cli.mdx (via relax_not_null (symbol, a field of const object REMOTE_DRIFT_OP_ANSWERS), relax_not_null (literal, a string literal in applyRemoteColumnDriftOp))
  • content/docs/plugins/packages.mdx (via TursoDriver (symbol, a top-level class))
  • content/docs/protocol/objectql/query-syntax.mdx (via TursoDriver (symbol, a top-level class))

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

  • content/docs/releases/v17/17-5.mdx (via TursoDriver (symbol, a top-level class))
  • content/docs/releases/v17/17-6.mdx (via TursoDriver (symbol, a top-level class))

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
  • 8 name(s) were too generic to anchor anything (single lowercase words)
  • 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 — 8 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 9e6fee19ea358232196e1f704198612a2de34710 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from a54ba2467553f4bb6ab0301dae33dda9b7ae5275 — the merge of head 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8 into base 9e6fee19ea358232196e1f704198612a2de34710, 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 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

⚠️ 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 9e6fee19ea358232196e1f704198612a2de34710 → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 (Clause-②: yes (widening), Metadata-protocol: none), owed at TIER_DEFAULT. On the maintainer's direction in the review#1 session (2026-11-16T09:50Z) the L2 seat is the fallback for lanes that cannot reach CONTRACT_REVIEW_TIER, and TIER_DEFAULT records stay with the lane seat (contract-review.md: 「仅凭 Clause-②: yes 申报而欠 ⇒ TIER_DEFAULT,由车道席位作 L2 记录」). The routing fix is card #34376. No claim was posted; the lane writes the record.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR

Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head a6797ba · 2026-11-16T15:30Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR

Contract review

Served-tier: TIER_DEFAULT
Head-sha: a6797ba07c832692288d361978c8b162714a0d0f
Local-runs: none

① Derived judgments

Read: 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.

  • Clause-②: yes (widening) is the right arm. Nothing narrows. On the REMOTE face one drift op moves from always-skipped to applied; every other row of REMOTE_DRIFT_OP_ANSWERS is byte-identical, and the local face is not touched (applyMigrationEntries still returns super when not remote).
  • What newly widens, each named right by the PR:
    • TursoDriver.applyMigrationEntries on REMOTE now sends DDL for relax_not_null and may answer it under applied. Right.
    • TursoDriver.driftApplyLimit('relax_not_null') on REMOTE answers null where it answered the rebuild sentence, so os migrate plan and the apply listing show the relax with no limit and the footer counts one fewer unappliable change. Right, pinned by the two CLI stub files.
    • The three doors (relaxDeclaredNotNull, applyPublishedColumnChanges, os migrate apply) stay inherited and reach the new arm; the publish no longer answers object-column-changes-not-applied for a relax that lands. Right (parameter 2). A remote schema sync still does not relax (pinned), so ADR-0113 D5 holds.
  • Named wrong, prose only: the changeset and claim call REMOTE_DRIFT_OP_ANSWERS "exported". It is a module export of turso-driver.ts; src/index.ts does not re-export it and the package exports map has one entry, so no consumer can address it (0 uses outside driver-turso). The published widening is the behaviour of the two TursoDriver methods above. See N1.
  • remote-relax-not-null.ts is not re-exported either: no new public symbol.
  • Ruling parameters against the code: 1 relax only: holds. 3 applied only on a read-back of nullability, type, DEFAULT and pk: holds. 4 no fall-back: holds, every non-success path is false. 5 only nullability changes: holds, and more strictly than the ruling asked (the definition is cut from sqlite_master.sql, not rebuilt). 6 local face untouched: holds.

② Semver level

@objectstack/driver-turso patch, with Clause-②: yes (widening) and Metadata-protocol: none line-initial in both the PR body and the changeset. Correct: no metadata key or accepted value changes, and AGENTS.md ships a non-protocol widening as patch. Only driver-turso source moves; the runtime and CLI changes are tests, so no other package owes a changeset. Check Changeset is green.

③ Boundary flags

Data safety of the in-place change (the code, read):

  • Atomic: the ALTER and its check go in one write batch (RemoteTransport.batch, one server transaction). The check compares the whole stored table SQL to the planned text and raises on any difference, so the outcome is either exactly "the NOT NULL clause removed, every other byte kept" or nothing. No row is copied, so there is no partial-copy state and no table can be left half-built. Re-running after any failure is safe: the arm re-reads the column first.
  • No data-loss path found. The one loss the statement can cause (a CHECK, COLLATE, UNIQUE or REFERENCES clause dropped with the NOT NULL) is what the in-batch check exists to stop, and the PR's ablation shows the pragma read-back alone would miss it.
  • Not resumable, and does not need to be: one statement, one transaction.
  • No new id materialisation or in-app join.

M1 (must-fix) — ruling parameter 4's first step is not met at this head. The ruling makes pinning the statement against a real sqld the build's first step. turso-remote-relax-not-null-sqld.test.ts and the rewritten apply.remote-face.integration.test.ts cases are gated on OS_TEST_SQLD_BIN, CI has no sqld, and both reports say NOT MEASURED. Every measurement in the PR is on the embedded engine. Two things are therefore unknown on the server every hosted tenant runs: whether it accepts the statement, and whether its splice leaves the stored SQL byte-equal to the planned text. If it does not, the arm fails safe (rolled back, skipped) but the widening this PR declares does not exist on hosted. Required: run both gated files against a real sqld, record the result on the card; a refusal goes to the maintainer under parameter 4. No code change is implied by this finding.

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, NUMERIC(10, 2), a comment). Parameter 4 says a refusal comes back to the maintainer once; the 维护者速读 does not name it. Columns this face creates are TYPE [NOT NULL] (remote-transport.ts column renderer, read), so the card's own case is not in the class. For a column that is, os migrate plan lists the relax with no limit, every apply reports it not applied with exit 0, and no door on this transport clears it. Put that to him with M1's result, and say on the card what such a tenant does.

N1 (nit) — changeset wording "the exported REMOTE_DRIFT_OP_ANSWERS": not package-addressable (① above).

N2 (nit) — applyRemoteRelaxNotNull's catch logs "the batch rolled back" for every thrown error. A transport error after the server committed has an unknown outcome; the entry is then reported skipped while the column is relaxed. The state is the wanted one and the next plan shows no drift, so only the log line is wrong.

N3 (nit) — the early if (!before?.notNull) return false logs nothing, while the CLI tells the operator "its log above says why".

Docs line (content/docs/deployment/cli.mdx): matches the code sentence by sentence (in place, only the clause leaves, no row copied, applied only on the read-back, refusal leaves the column and lists the entry not applied, tightening and dropped DEFAULT keep the rebuild sentence). It omits the comma class the changeset names; fold into S1's outcome.

Check-runs on the head: 57 runs, none red, none running (success or skipped). The PR is draft.

Implemented-by: claude/issue-33724-remote-relax-not-null
Reviewed-by: session_01FEkQ5mjfxPu5HKjUtuveBR

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>
… 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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR

Contract-review-claim: session_01FEkQ5mjfxPu5HKjUtuveBR · head 00fadc5 · 2026-11-16T16:30Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

review#2 · os-project-manager · session_01FEkQ5mjfxPu5HKjUtuveBR

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8
Local-runs: none

Delta round against this seat's FAIL 6920999561 (head a6797ba0), asked for by announce 6922371133. Read: the four delta commits (6a05a50a, 709476e3, 715fc6a1, 00fadc55; 5 files, +95 −13), the card's six comments since that record (report 6921327686, measurement 6921391723 and addendum 6921439242, report 6921757949, ruling 6922037129, report 6922308957), the PR body, the check-runs. The merge-base with main is unchanged (183a89e3), so the delta is the whole change since the last record. The findings of 6920999561 that are not named below stand as written.

① Derived judgments

  • Clause-②: yes (widening) is still the right arm. The delta publishes no new accept-set change. The only product hunk is the catch of applyRemoteRelaxNotNull and its two early returns: each still answers false (skipped), only the warn text differs. REMOTE_DRIFT_OP_ANSWERS, the batch, the in-batch check and the read-back are byte-identical to a6797ba0; remote-relax-not-null.ts and the sqld pin file are untouched.
  • No fall-back was added (ruling 6915086281 parameter 4, ruling 6922037129 item 1). Read: the comma branch only appends a sentence to the log line and returns skip(...). Right.
  • The log text now matches what happened. A failed batch re-reads sqlite_master.sql: equal to the text read before the send is "nothing landed"; different or unreadable is "outcome unknown, the next drift read decides". The comma sentence is appended only on the "nothing landed" arm and only when the column's own stored definition holds a comma. Right, and each arm is pinned (comma case, comma-free refused case with a negative assertion, transport error after commit, converged re-run).
  • The changeset names the widening correctly now: TursoDriver.applyMigrationEntries applies the entry and TursoDriver.driftApplyLimit('relax_not_null') answers null on the remote face. "Exported" is gone.

② Semver level

Unchanged and correct: @objectstack/driver-turso patch, Clause-②: yes (widening) and Metadata-protocol: none line-initial in the PR body and the changeset. The delta outside driver-turso is one docs paragraph and one test expectation, so no other package owes a changeset.

③ Boundary flags

Earlier findings:

  • M1 — closed. The decision thread, not the building seat, measured the driver pin on official sqld 0.24.33 (image digest and binary sha256 recorded): 2/2 on a6797ba0 (6921391723) and 2/2 on 709476e3 (6921439242). The server accepts the statement and the stored SQL is byte-equal to the planned text. The cli gated file was 8/9 in both, the one red reading expected 'nothing_safe_to_apply' to be undefined; 715fc6a1 changes exactly that expectation to toBe('nothing_safe_to_apply'), which is the value the independent run observed and the value apply.ts answers on that path (read). The 9/9 on 715fc6a1 and the 2/2 on this head are the building seat's own runs (6921757949, 6922308957); the product code they reach has not changed since the independent 2/2. Not re-run here.
  • S1 — closed by ruling 6922037129, letter A. Its four items against the tree: the column keeps NOT NULL and no rebuild is added (holds); the apply lists the entry not applied and the reason names the class (holds, pinned, ablated per 6922308957); cli.mdx names the class and what the operator sees (holds, sentence by sentence against the code); platform-created columns are outside the class (holds: mapFieldTypeToSQL answers only TEXT, INTEGER, REAL, and columnDeclarationSQL adds only NOT NULL). The 维护者速读 states the limit and cites the ruling.
  • N1, N2, N3 — closed (changeset wording; the re-read before the log; both early returns log why, the already-nullable one pinned).

New in this round. No must-fix, no should-fix.

  • N4 (nit) — cli.mdx and the changeset say platform-created columns have "no DEFAULT". created_at and updated_at are created as TEXT DEFAULT (datetime('now')). Neither is NOT NULL and neither holds a comma, so the conclusion ("never in the class") is true; only the premise is too broad. "No declared-field DEFAULT" would be exact.
  • N5 (nit) — the docs paragraph says what os migrate apply shows for a comma-class column, not that os migrate plan lists the same relax with no limit (the plan does not read the stored definition). Ruling 6922037129 left this wording to the seat and the reviewer; one clause would do.
  • N6 (nit) — the PR body's Acceptance notes and Verification sections still read "not measured" for the real-sqld pin and the hosted splice; Fix round 3 and Fix round 4 lower in the same body supersede them.

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: claude/issue-33724-remote-relax-not-null
Reviewed-by: session_01FEkQ5mjfxPu5HKjUtuveBR

VERDICT: PASS

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5pHNFS9mn8hS13iGyL

Request: review · PR #34408 · area o1-B · Part of #33724 · head 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8 (declared final, green) · 2026-11-16T16:56Z

  • Owed: L1 (thread L1-a), first read. Contract review: review#2 PASS 6923055131 on this head (TIER_DEFAULT), no must-fix or should-fix open. Declaration: Clause-②: yes (widening), Metadata-protocol: none.
  • What it builds: maintainer ruling 6915086281 (A) on Package objects: no hosted door relaxes a NOT NULL column after an upgrade declares storage.notNull:false, and the schema-drift remedy "publishing the object applies it" is refused (403 NOT_OVERRIDABLE) #33724: the Turso REMOTE face relaxes NOT NULL in place with libSQL ALTER COLUMN, in one batch with a check that the stored SQL equals the planned SQL, applied only on a read-back, no rebuild fall-back. Comma-class columns keep NOT NULL and are listed not applied with the reason (ruling 6922037129, A). Tests outside driver-turso by claim amendment 6917885070.
  • Rounds: 1 (runtime and cli pins), 2 (review#2 N1–N3), 3 (cli gated expectation after the real-sqld measurement), 4 (S1: the warn line names the class, docs and 维护者速读). Dev reports 6917853648, 6919701288, 6921327686, 6921757949, 6922308957.
  • Readings at head: full driver-turso suite 2563 passed, 36 skipped; real sqld 0.24.33 pin 2/2 (cli gated file 9/9 on 715fc6a1, no cli change since); ablations per round, restored to HEAD.
  • Check-runs (latest per check): 36 success, 17 skipped, 0 failure. check-governed-merges --pr 34408: NOT governed, +914/-74, under 3,000.
  • Body: the stale "not measured" lines in Tests, Acceptance notes, Verification and Fix round 1 now point to the measurement (review#2 N6), with no push. review#2's N4 and N5 (docs wording: created_at/updated_at carry a DEFAULT without a comma; os migrate plan lists the relax with no limit) are nits; they ride a follow-up, not a push here.
  • Landing: this area lands it after L1 ACCEPT. The card stays open for the cloud half (cloud: a managed install or upgrade rebuild never relaxes a NOT NULL column the new package version declares storage.notNull:false (call relaxInstallDeclaredNotNull after schema sync) #34377) and the hosted re-save.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#1 · os-project-manager · session_01FEkQ5kcNtBBExhz4DZqYbi

席位核对 · ACCEPT (L1, first read) · Head-sha: 00fadc5 · 2026-11-16T16:58Z

L1 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 183a89e3: 12 files, +914/−74. The PR is not governed, and the L2 is review#2's.

  • Card relation. Part of #33724, which is right. This PR is the framework half. The cloud half is cloud: a managed install or upgrade rebuild never relaxes a NOT NULL column the new package version declares storage.notNull:false (call relaxInstallDeclaredNotNull after schema sync) #34377, and the hosted-Turso measurement is the card's closing check, as review#2 also notes.
  • The six ruling parameters, against the code.
    1. Relax only. REMOTE_DRIFT_OP_ANSWERS.relax_not_null becomes 'applied'. tighten_not_null, the width entries and the dropped DEFAULT keep needs-table-rebuild. The comment says why: the statement does not revalidate rows.
    2. Doors unchanged. relaxDeclaredNotNull and applyPublishedColumnChanges stay inherited on this face, so the install or upgrade, the publish and os migrate apply reach it. No boot path changes (ADR-0113 D5).
    3. Applied only on a read-back. applyRemoteRelaxNotNull returns true only when pragma_table_info reads the column back nullable with the same type, dflt_value and pk as before. The stored-SQL check inside the batch covers every other clause.
    4. A refusal is reported, with no fall-back.
    5. Only nullability changes.
      • planRelaxedColumnDefinition lexes the stored CREATE TABLE. Quotes in all four forms and both comment forms are single tokens, so commas and parentheses inside them never count.
      • It splits the column list at depth 1 and finds the one element named for the column, never a table-constraint opener. It cuts only [CONSTRAINT name] NOT NULL [ON CONFLICT x] at the definition's own depth, never inside a CHECK, a DEFAULT expression or a REFERENCES clause.
      • The result is checked inside the same write batch: the stored SQL must equal expectedTableSql, and a mismatch raises from a plain SELECT through json(). So a splice the plan did not predict rolls back. That is pinned (a splice the plan did not predict lands nowhere).
    6. The local face keeps its rebuild. The local arm is not touched.
  • The comma class (ruling 6922037129). A definition holding a comma is refused by libSQL and the table is left byte-identical. This is pinned on the in-memory libSQL and measured on real sqld. The skip reason names the class ("holds a comma … keeps its NOT NULL"), no rebuild follows, and cli.mdx and the changeset name the class. All four of the ruling's terms are met.
  • Pins.
    • remote-relax-not-null.test.ts (planner, 10 cases): every quoting form, a named constraint with ON CONFLICT, NOT DEFERRABLE and SET NULL inside REFERENCES not mistaken for the constraint, a table constraint never taken for the column, a string holding NOT NULL, the last column, and the refusals.
    • turso-remote-migration-entries.test.ts (5 new cases): applied with only the NOT NULL clauses leaving; the comma refusal with the table byte-identical; the unknown outcome; the check rolling the statement back; the declared storage: { notNull: false } path.
    • The cli, runtime and publish pins were re-pointed from "skipped, needs rebuild" to "applied", and apply.remote-face.integration.test.ts reads nothing_safe_to_apply once the relax has landed.
  • Changeset. patch on @objectstack/driver-turso with Clause-②: yes (widening) (an entry that was skipped is now applied) and Metadata-protocol: none. Every bullet matches the code above.
  • Checks on this head (check-runs): 61 names, 41 success, 19 skipped, 0 failed, 1 still running (Check Changeset) when I read them. Landing needs it green.
  • Base. PRBASE is 9e6fee19 (Test Core plan), and K = 0.

Notes (not blocking)

  • review#2's N4 ("no DEFAULT" is too broad, since created_at and updated_at carry DEFAULT (datetime('now'))) and N5 (os migrate plan lists a comma-class relax with no limit) are left for a follow-up, per 6923107247. They are prose in cli.mdx and the changeset. Before landing, either name the card that carries them, or apply them on this branch as a prose-only move. The changeset sentence ships in the release notes once released, so fixing it before landing costs least.

Landing: not Tier H. Area o1-B lands it once Check Changeset is green.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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.

Reading Head 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8
L1 (L1-a) ACCEPT 6923152602
Contract review (review#2, TIER_DEFAULT) PASS 6923055131 on this head, no must-fix or should-fix open
check-governed-merges --pr 34408 NOT governed, +914/-74, under 3,000
Real sqld pin (ruling 6915086281 parameter 4) 2/2 on official sqld 0.24.33 (6921391723, 6921439242, rerun 6922308957)
Dogfood battery n/a, no ! title
K (Test Core plan PRBASE → origin/main, per L1) 0
Check-runs 36 success, 17 skipped, 0 failure (Check Changeset success)

State: ready plus auto-merge through the merge queue. Part of #33724: the card stays open for the cloud half (#34377) and the hosted re-save. review#2's docs nits N4 and N5 are carried on the card (6923174212).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 17:01
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 16, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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 TypeScript Type Check aggregator in merge-group run 43913871181. Its lane Type Check · source gates (job 133462684295) failed in Checkout repository: "The action 'Checkout repository' has timed out after 25 minutes". No type check ran. It was a runner checkout hang, not this diff; the same hang cancelled an unrelated PR's docs check at the same time. Every other merge-group workflow on this entry (CI, Governed Surface Guard, PR-Body Guards, Spec Liveness Check) is green. Head unchanged at 00fadc550bb6d2733fe43b0d2a5e1cce91ffbef8; L1 ACCEPT 6923152602 and review#2 PASS 6923055131 stand. Re-queued once in this stroke; a second failure goes to the seat, not to another re-queue.

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.

1 participant