Skip to content

driver-turso remote: schema sync adds a new storage.notNull field to a populated table as ADD COLUMN … NOT NULL with no default, so the refusal fails the whole object's sync (remote half of #37258) #37281

Description

@objectstack-fleet

repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE
Filing gate: ① · Source: fleet · finding class b · reach: named producer (RemoteTransport.syncSchema / syncSchemasBatch on every hosted Turso/libSQL environment)

What

packages/drivers/driver-turso/src/remote-transport.ts columnDeclarationSQL still emits ALTER TABLE … ADD COLUMN … NOT NULL with no DEFAULT when a field declaring storage.notNull is added to a table that already holds a row. SQLite/libSQL refuses it ("Cannot add a NOT NULL column with default value NULL"), and the refusal fails the object's sync, through both doors (syncSchema and syncSchemasBatch).

The storage.notNull contract says: "Declaring this over existing null rows is a destructive migration gated by the schema-drift ceremony". So the add should land nullable and the differ should report tighten_not_null, which is what the local face does after PR #37279 (#37258).

Evidence

Why its own card

The remote face carries an explicit ⛔ Never drop the NOT NULL docblock stance from #23847. Reversing it on the populated-table path is a design change of that face, so it was kept off #37279 (seat ruling A, #37258 comment 7160678195). The docblock sentence "The local face sends the same statement and gets the same refusal" becomes false once #37279 lands.

Acceptance

  • Remote syncSchema and syncSchemasBatch add a storage.notNull column without a literal/NOW() default nullable when the table is populated, and the drift report shows tighten_not_null; empty tables and default-carrying fields keep NOT NULL.
  • turso-remote-not-null.test.ts case 4: both halves assert the same outcome; the known-asymmetry note is removed.
  • The remote-transport.ts docblock is rewritten to the storage.notNull contract.

Blocked-by: #37258
Dedupe: searched 'turso remote NOT NULL', 'columnDeclarationSQL', 'tighten_not_null' — nearest #23847 (closed, the stance this reverses), #23925 / #33724 (closed, other doors); no open card on this path.

Activity

  1. added
    finding
    on Nov 25, 2026
  2. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    triage#1 · os-warren · session_01JQwxbZKP5YM48rWMWTS7wE

    First touch 2026-11-25T11:35Z.

  3. added
    bug
    pm:blocked
    priority:p2
    on Nov 25, 2026
  4. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor
  5. added
    pm:queue
    and removed
    pm:blocked
    on Nov 25, 2026
  6. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM

    Claim: PM loop round 1 (seat 7) · 2026-11-25T19:22Z
    Session: session_011y7As8wf3DSPRevwNnYLcM
    Account: os-alice
    Branch: claude/issue-37281-turso-remote-add-notnull-nullable
    Worktree: objectstack-issue-37281
    Domain: domain:data
    Seat: repo:objectstack#7
    File surface: packages/drivers/driver-turso/src/** (remote-transport.ts columnDeclarationSQL / add-column path and its docblock; turso-remote-not-null.test.ts; any other driver-turso pin that asserts the remote refusal), plus one .changeset/*.md for @objectstack/driver-turso. A pin outside this surface that reads driver-turso source anchors (e.g. a packages/cli generator pin test) = stop and report, the seat amends the claim.
    Container & model: S, mode:subagent, model: default (dispatch-gates --tier at 68250f6: no path-derived mandate), effort: high (reason: S but not mechanical — the populated-table path reverses a docblock stance, M treatment per execution-duties)
    Clause-②: no
    Metadata-protocol: none
    Responsibility: objectstack: packages/drivers/driver-turso/src/remote-transport.ts columnDeclarationSQL / syncSchema / syncSchemasBatch emit ADD COLUMN … NOT NULL with no DEFAULT on a populated table | the local face (driver-sql, PR #37279) already adds it nullable and reports tighten_not_null; no remote path does | every hosted Turso/libSQL environment that adds a storage.notNull field to a populated object
    Thread-read: 7164030500
    Premise: holds (remote-transport.ts at 68250f6 lines 2566-2588 still render NOT NULL on ADD COLUMN; turso-remote-not-null.test.ts case 4 still records the KNOWN ASYMMETRY)
    Serial constraints cleared: none — no open pm:dispatched card claims packages/drivers/driver-turso/**; predecessor #37279 (local face) and #37331 (MySQL DEFAULT, driver-sql) merged.

    Clause-②: no reason: this removes a refusal the published storage.notNull contract text already denies — "Declaring this over existing null rows is a destructive migration gated by the schema-drift ceremony" — pulling the remote face back to the declared contract, the same as #37279 did for the local face.

    Trial deviation (试行偏离, maintainer-approved 2026-11-25T10:56Z): local runs only the affected tests + ratchet families, the rest cited from CI on the same head; the dev runs l1-face.mjs before reporting.

  7. added
    pm:dispatched
    and removed
    pm:queue
    on Nov 25, 2026
  8. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM
    os-dev-report

    {
     "issue": 37281,
     "status": "done",
     "branch": "claude/issue-37281-turso-remote-add-notnull-nullable",
     "pr": "https://github.com/objectstack-ai/objectstack/pull/37343",
     "session": "session_011y7As8wf3DSPRevwNnYLcM",
     "premise_still_valid": true,
     "summary": "RemoteTransport.columnDeclarationSQL stays the one renderer and gains an addedToPopulatedTable flag: a storage.notNull field with no literal/NOW() default (declaresEmittedColumnDefault, the remote twin of driver-sql's emitsDeclaredColumnDefault composed from the same spec predicates) is rendered without NOT NULL on ADD COLUMN to a table holding a row. syncSchema probes with one SELECT 1 ... LIMIT 1, syncSchemasBatch with one extra read batch (phase 2c), both only when an added column declares storage.notNull. Zone 2 assumption verified: the remote face's detectManagedDrift reports tighten_not_null with no extra code. Case 4 of turso-remote-not-null.test.ts now asserts one outcome for local and both remote doors (KNOWN ASYMMETRY note removed); the columnDeclarationSQL docblock is rewritten to the storage.notNull contract; REMOTE_DRIFT_REPORT_CAVEAT names the populated-table add. Case 5 (literal default, RECORDED ASYMMETRY) still holds and passes unchanged.",
     "tests": "head 056bae7f: `pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=2 src/turso-remote-not-null.test.ts` -> Test Files 1 passed (1), Tests 15 passed (15), VERDICT command-exit 0. `pnpm --filter @objectstack/driver-turso typecheck && ... vitest run --maxWorkers=2` (whole package) -> Test Files 104 passed | 1 skipped (105), Tests 2657 passed | 36 skipped (2693), VERDICT command-exit 0; tsc --listFiles includes the test file (1 hit). Dependency closure built first (`pnpm --workspace-concurrency=2 --filter '@objectstack/driver-turso^...' build`, VERDICT 0). Ablation via scripts/ablation-replace.mjs at committed head: anchor '&& !(addedToPopulatedTable && !declaresEmittedColumnDefault(field));' x1->x0, replacement '&& true;' x0->x1, blob b6abce46b1c9 -> 7262586662a3; Tests 5 failed | 10 passed (the 4 remote cells of case 4 + the batch cell; local cells green); restored blob == HEAD b6abce46b1c9, git diff HEAD empty. No rebuild needed: suite imports src/turso-driver.js, remote-transport.ts reached relatively (no exports hop).",
     "gates": "local at 056bae7f (each exit captured before any pipe): check:type-check-coverage 0; check:type-check-debt 0 (surplus: none); check:doc-authoring 0; check:issue-citations 0; check:nul-bytes 0; check:closed-ceremony-text 0; check:durability-log-level 0; check:published-files 0; check-empty-changeset --base origin/main 0; check-changeset-no-major --base origin/main 0; check-adr-0087-registration --base origin/main 0; check-platform-checklist --changed-from origin/main: 0 anchored files, nothing judged. dispatch-gates --ran (--repo objectstack-ai/objectstack, tree 056bae7f): 72 derived, 11 run, 0 NOT-MEASURED, 61 UNRUN (left to CI under the trial deviation). CI on PR #37343 at 056bae7f: in_progress (l1-face: 0 success, 5 expected skip, 0 failed, 18 pending) -- NOT MEASURED, the seat reads CI.",
     "dogfood_battery": "n/a — no `!` in the PR title and no (narrowing) arm",
     "mcp_calls": "0",
     "api_writes": "2 relay actions — (1) pr_create: POST /repos/objectstack-ai/objectstack/pulls (draft) + POST /repos/objectstack-ai/objectstack/issues/37343/assignees [os-alice], read-back byte-identical 8322/8322; (2) this report comment: POST /repos/objectstack-ai/objectstack/issues/37281/comments via post-stamped.mjs. Plus git push (not REST).",
     "open_questions": [],
     "security_findings": "none",
     "out_of_scope_findings": [
      "carrier: seat · noted, not filed — case 5 RECORDED ASYMMETRY (storage.notNull + literal/NOW() defaultValue on a populated table: local accepts NOT NULL DEFAULT, remote emits no declared DEFAULT and refuses) still holds after this change; not in this card's acceptance; a card for it, if owed, is the seat's to file (listed under the PR's Acceptance notes).",
      "carrier: none · noted, not filed — declaresEmittedColumnDefault is a 4-line twin of driver-sql's unexported emitsDeclaredColumnDefault; the shared form (export from @objectstack/driver-sql) is outside the claimed surface; parity pinned by case 4's current_user cell and case 5."
     ],
     "deviations": "(1) Trial deviation followed: local ran only driver-turso tests/typecheck + the 11 families above; 61 derived families left to CI on the same head. (2) No pin outside the file surface went red (whole driver-turso suite green; no packages/cli pin reads the changed anchors -- grep for columnDeclarationSQL/executeAddColumn/'Cannot add a NOT NULL' outside driver-turso hits only driver-sql's own test). (3) turso-driver.ts (in surface) edited beyond the claim's named files: REMOTE_DRIFT_REPORT_CAVEAT and its docblock, because their 'the sync creates it now' clause became incomplete under this change. (4) Commits carry the model-free trailer pair as ordered (Co-Authored-By: Claude + Claude-Session).",
     "files_changed": [
      ".changeset/37281-turso-remote-add-column-not-null-populated-table.md",
      "packages/drivers/driver-turso/src/remote-transport.ts",
      "packages/drivers/driver-turso/src/turso-driver.ts",
      "packages/drivers/driver-turso/src/turso-remote-not-null.test.ts"
     ],
     "line_budget": "4 files, +187 / -62 (249 changed lines vs the 3000 human-merge threshold: under); no skills/** touched",
     "tool_calls": "~55",
     "end_context": "~115k tokens"
    }
  9. objectstack-fleet commented on Nov 25, 2026

    @objectstack-fleet
    ContributorAuthor

    repo:objectstack#7 · os-alice · session_011y7As8wf3DSPRevwNnYLcM

    2026-11-25T20:34Z Closed by PR #37343 (merged). Removing pm:dispatched. Follow-up for case 5 (remote face emits no declared column DEFAULT): #37345.

  10. removed
    pm:dispatched
    on Nov 25, 2026
  11. added a commit that references this issue on Dec 1, 2026
    49ad529
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:databugdomain:datafindingpriority:p2

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions