Skip to content

fix(objectql): a server boot's schema sync takes the schema-migration lock, so replicas starting together create each table once - #31747

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-0js4sp
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/project-thread-0js4sp

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #31715

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:服务器启动时的表结构同步(含 OS_MIGRATE_AND_EXIT=1)现在和 os migrate apply 拿同一把数据库迁移锁,只在建表期间持有,同步完立即释放。
  • 为什么改:多个副本同时启动会重复建同一张表,Postgres 报 pg_type 冲突,那个启动记下 Schema sync FAILED 却仍以 0 退出;实测可复现。
  • 风险与回滚:单机无争用时只多一条加锁语句、输出逐字节不变;SQLite 不加锁。回滚即还原本 PR,锁模块挪回 cli。
  • 先看:packages/objectql/src/plugin.ts(acquireBootSchemaMigrationLock 与 Phase 1–3 的 try/finally)、packages/objectql/src/schema-migration-lock.ts(从 cli 挪来)、packages/drivers/driver-sql/src/sql-driver.ts(新只读 getter schemaDdlDeferred)。
  • 两分钟验证:OS_TEST_POSTGRES_URL=postgres://… pnpm --filter @objectstack/cli exec vitest run --project integration src/utils/schema-migration-lock.integration.test.ts,预期 8/8 通过,三个启动各打印一行等待、每张表只建一次。
  • 需要你做的:无,席位落地。

#31598 card item 2 (quoted)

  1. The lock is harmless on a single node (uncontended); keep its output identical apart from no new lines when uncontended. Note: this changes the single-node code path by one uncontended lock call; say so in the PR.

As there: this PR changes the single-node server boot by one uncontended lock call (pg_try_advisory_lock / GET_LOCK on a connection of its own, then the unlock), on Postgres and MySQL only. Nothing is printed when it is uncontended; the single-boot output was diffed byte for byte below.

What changes

  • Where the boot syncs, measured. A server boot's DDL is ObjectQLPlugin.start() Phase 1 (installRegisteredSchemas), Phase 2 (hydrate from sys_metadata) and Phase 3 (sync what Phase 2 added). OS_MIGRATE_AND_EXIT=1 is that same boot followed by an exit in serve.ts, so the lock goes into the engine's boot, not into serve.ts. serve.ts is untouched.
  • The lock. start() takes it right before Phase 1 and releases it in finally after Phase 3 (a boot that fails between the phases releases it too). It is never held while the server runs. It is taken even when nothing turns out to be pending, so the "read what is missing, then create it" race is closed. It is taken on the default datasource's driver, the database the tables live in (as fix(cli): os migrate apply takes a database lock so concurrent migrators run one at a time #31714 locks the primary).
  • No lock where this boot runs no DDL: skipSchemaSync / OS_SKIP_SCHEMA_SYNC=1, and a default driver whose DDL os migrate plan / apply holds back. That command takes the lock itself before it reads what is pending; taking it in the boot too would make one migrator wait twice and spend a second uncontended statement. The engine reads this from a new read-only getter, SqlDriver#schemaDdlDeferred.
  • One lock, one module (seat ruling 1). schema-migration-lock.ts and its unit test moved from packages/cli/src/utils/ to packages/objectql/src/: @objectstack/objectql cannot import @objectstack/cli (the CLI depends on it), and objectql is the lowest package that holds a caller of the lock (@objectstack/core / types are driver-agnostic and call nothing here). It is exported from the objectql barrel (not the lean ./core entry). packages/cli/src/utils/schema-migration-lock.ts is now a re-export, so bootSchemaStack and the CLI tests import exactly what they did. Same name objectstack:schema-migrate, same Postgres key (its unit pin moved with it, unchanged).
  • Dialect from the driver, before its Knex (CI fix, ab5e5910). The lock reads SqlDriver#dialectName (the driver's one public "which SQL do I speak") and calls getKnex() only for postgres / mysql. At 86ea712b it asked every driver for its Knex first, and the Turso REMOTE transport refuses getKnex() by throwing, so a remote Turso boot failed in ObjectQLPlugin.start() (CI Test Core (3/8), organization-ownership-boot-guard.turso-remote.kernel.test.ts). A Postgres or MySQL driver whose Knex cannot be handed out still throws; nothing is swallowed. bootSchemaStack passes the same SqlDriver, so the CLI path reads the same answer.
  • Wait bound. A server boot waits at most half of ObjectQLPlugin.startupTimeout (60 s by default), so a boot queued behind a long migration refuses with the lock's own message (it names the lock and says nothing was changed) instead of the kernel's generic start timeout, and keeps the other half for its own sync. os migrate apply keeps its 10-minute bound.
  • Forced edit outside the named surface: packages/drivers/driver-turso/src/turso-driver.ts gains one row in REMOTE_FACE_ANSWERS (schemaDdlDeferred: 'inherited'). That ledger is typed Record<keyof SqlDriver, …>, so the new getter fails the Turso DTS build until it is classified. It is inherited because the remote face refuses arming, so it always reads false.

Tests

  • packages/objectql/src/plugin-boot-schema-migration-lock.test.ts (new, 6 pins): a real ObjectKernel boot with a stub default driver whose knex and syncSchema write into one ordered log. The lock comes before the first DDL and the unlock after the last; uncontended it is one lock statement and no line logged; contended it is one wait line, then DDL; a boot failing between the phases still unlocks; no lock for skipSchemaSync or a deferring driver; control: SQLite and memory drivers run no statement and sync as before.
  • packages/cli/src/utils/schema-migration-lock.integration.test.ts: a second top-level describe in fix(cli): os migrate apply takes a database lock so concurrent migrators run one at a time #31714's live-Postgres harness (ruling record 6583487846: one harness file per component). It holds the lock, starts three os serve boots with OS_MIGRATE_AND_EXIT=1, waits until Postgres shows all three queued, then lets go. Asserted: all three queued; each exits 0 and prints exactly one wait line; none logs Schema sync FAILED; an event trigger sees each table created once; control: one more boot prints no wait line, creates nothing, exits 0. A named skip without OS_TEST_POSTGRES_URL, as the apply cell; the event trigger needs a superuser URL.
  • Moved: schema-migration-lock.test.ts (header text updated for its second caller). Its fake drivers now carry dialectName; the dialect pins assert getKnex() is never called for sqlite / mssql / oracle / unknown / none; new pins: a SQLite face whose getKnex() throws answers null without calling it, and a postgres / mysql driver whose getKnex() throws rejects with that error.
  • plugin-boot-schema-migration-lock.test.ts gains a 7th pin: a SQLite-dialect default driver whose getKnex() throws (Turso remote) boots, is never asked for Knex, takes no lock and syncs.

Acceptance notes

  • Postgres and MySQL only, as fix(cli): os migrate apply takes a database lock so concurrent migrators run one at a time #31714. MySQL is NOT MEASURED live (no MySQL server in the container); the MySQL statements are the module's own, pinned in its unit test.
  • The lock covers the default datasource only; DDL on any other datasource is unchanged by this PR. Only the default datasource's database is locked (as fix(cli): os migrate apply takes a database lock so concurrent migrators run one at a time #31714 locks the primary); objects bound to another SQL datasource on another database sync exactly as before, outside the lock.
  • The kernel:ready platform-table repairs (metadata-protocol identity-index migrations, IF [NOT] EXISTS index DDL) run after the lock is released. In the 5 barrier-aligned runs and 2 staged integration runs with the fix, no boot logged a failure from them. The runtime resyncs (metadata:reloaded, ObjectQL.syncSchemas on install) are not boot DDL and are not touched.
  • The red on main needs the boots aligned. Started together without help, tsx start jitter puts one boot about 100 ms ahead and it leads the whole sync: 4 unaided runs on main showed no collision. Held together at their first database round trip by a TCP barrier in front of Postgres (a measurement tool, not committed), main collided every valid time.

Verification

Concurrency measurements at 3fa9769b (main 4013e308 merged in), Postgres 16 in the container. 86ea712b moved a JSDoc (no code change). Head ab5e5910 fixes the Turso remote boot:

runtime organization-ownership-boot-guard.turso-remote.kernel.test.ts  before (objectql dist of 86ea712b): 2 failed, "Handing out the Knex instance (`getKnex()`) is not supported by the Turso REMOTE transport"  /  after (rebuilt): 2 passed
runtime turso files 2/2 (9 tests) · rest remote-tables-twin 10/10 · cli schema-migrate.remote-posture 11/11
objectql   typecheck ✓ · vitest 577 files / 11736 tests passed (lock pins 26/26)
driver-turso typecheck ✓ · vitest 97 files, 2522 passed | 34 skipped
cli        typecheck ✓ · live-PG schema-migration-lock.integration.test.ts 8/8 (OS_TEST_POSTGRES_URL set)
eslint --no-inline-config on the 4 changed .ts files: exit 0
Red on main (b126c13), green with the fix: concurrent boots on one fresh database

DDL counted from the Postgres log (log_statement = ddl); boots aligned by the barrier.

main  3 x OS_MIGRATE_AND_EXIT  run A  CREATE TABLE 85 / distinct 84 / created twice: 1 (sys_migration) / pg_type_typname_nsp_index duplicate key x1 / all exit 0, one boot logged "Schema sync FAILED for object 'sys_migration'"
main  3 x OS_MIGRATE_AND_EXIT  run B  CREATE TABLE 85 / distinct 84 / created twice: 1 / pg_type collision x1 / all exit 0
main  2 x ordinary boot        run A  created twice: 1 / pg_type collision x1
main  2 x ordinary boot        run B  created twice: 1 / pg_type collision x1
      (a third main run was void: the barrier's own port was taken; both boots failed to connect)
fix   3 x OS_MIGRATE_AND_EXIT  2 runs  CREATE TABLE 84 / distinct 84 / created twice: 0 / no pg_type error / all exit 0 / 2 wait lines per run (one per waiter)
fix   2 x ordinary boot        3 runs  CREATE TABLE 84 / created twice: 0 / no pg_type error / both listening / 1 wait line per run
Control: single-boot output unchanged

Timestamps, durations, ports, temp paths and database names normalized; nothing else.

single OS_MIGRATE_AND_EXIT boot, main vs fix: stdout IDENTICAL (0 lines), stderr IDENTICAL (11 lines)
single ordinary boot, main vs fix:            stdout IDENTICAL (0 lines), stderr IDENTICAL (32 lines)
Ablation: the lock call removed from ObjectQLPlugin.start()

scripts/ablation-replace.mjs replaced const migrationLock = await this.acquireBootSchemaMigrationLock(ctx); with await Promise.resolve(null) (anchor 1 → 0, planted 1). Rebuilt objectql: the build exits 1 because the DTS step rejects the now-unused private method, but the JS was written: ablation-dist-preflight.mjs … --absent shows the call absent from all 8 built files.

unit   × locks before the first DDL… × uncontended: ONE lock statement… × contended: says ONCE… × a boot that fails… (4 failed | 2 passed)
live   × all three boots queued behind the held lock (expected +0 to be 3) × each boot … says ONCE that it waited (2 failed | 6 passed)
restore: blob == HEAD, git diff HEAD empty; rebuilt; preflight finds the call in dist/index.js and dist/index.mjs; live file 8/8 passed
Packages, lint, gates
objectql   typecheck ✓ · vitest 577 files / 11732 tests passed (pre-merge head e02afaa6); after the main merge: typecheck ✓, the two lock files 22/22
driver-sql typecheck ✓ · vitest 246 passed | 13 skipped files, 4170 passed | 223 skipped tests
driver-turso typecheck ✓ · vitest 97 files, 2522 passed | 34 skipped
cli        typecheck ✓ (both heads) · unit tier 406 files / 5755 tests · live-PG file 8/8 (both heads; OS_TEST_POSTGRES_URL set)
eslint --no-inline-config on all 9 changed .ts files: exit 0
dispatch-gates --commands (79 derived on 3fa9769b): 79 run, 79 exit 0; --ran reconciliation: 79 derived, 79 run, 0 NOT-MEASURED, 0 UNRUN
  (first round: teardown self-test, dual-build-cjs-loads and i18n-coverage exited 3 on prerequisites; green after fetching the teardown fixture and a full `pnpm build`)

A server boot, an OS_MIGRATE_AND_EXIT=1 job and os migrate apply now
exclude one another on one database. ObjectQLPlugin.start() takes the lock
on the default datasource's driver before Phase 1 and releases it in
finally after Phase 3; never for a skipSchemaSync boot, or for a driver
whose DDL os migrate holds back (SqlDriver#schemaDdlDeferred), which takes
the lock itself.

The lock module moves from the CLI to @objectstack/objectql, the lowest
package holding a caller; the CLI re-exports it.

Claude-Session: https://claude.ai/code/session_01ADHkmRuoKNTbmDhQPaG2vW
Co-authored-by: Claude <noreply@anthropic.com>
…gration lock on live Postgres

Also classifies SqlDriver#schemaDdlDeferred on the Turso remote face's
member ledger (inherited: arming is refused there, so it reads false).

Claude-Session: https://claude.ai/code/session_01ADHkmRuoKNTbmDhQPaG2vW
Co-authored-by: Claude <noreply@anthropic.com>
@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 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/cli, @objectstack/driver-sql, @objectstack/driver-turso, @objectstack/objectql, touching 13 documentable anchor(s). ⚠️ 1 changed file(s) yielded no anchor (packages/objectql/src/index.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

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

  • content/docs/data-modeling/drivers.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/data-modeling/index.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/data-modeling/objects.mdx (via ObjectQLPlugin (symbol, a top-level class))
  • content/docs/data-modeling/queries.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/kernel/services-checklist.mdx (via ObjectQLPlugin (symbol, a top-level class))
  • content/docs/kernel/services.mdx (via ObjectQLPlugin (symbol, a top-level class))
  • content/docs/permissions/authentication.mdx (via ObjectQLPlugin (symbol, a top-level class))
  • content/docs/permissions/tenant-audit-census.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/plugins/packages.mdx (via ObjectQLPlugin (symbol, a top-level class), SqlDriver (symbol, a top-level class))
  • content/docs/protocol/kernel/index.mdx (via ObjectQLPlugin (symbol, a top-level class), SqlDriver (symbol, a top-level class))
  • content/docs/protocol/kernel/lifecycle.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/protocol/objectql/query-syntax.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/protocol/objectql/types.mdx (via SqlDriver (symbol, a top-level class))

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

  • content/docs/releases/v17/17-0.mdx (via ObjectQLPlugin (symbol, a top-level class), SqlDriver (symbol, a top-level class))
  • content/docs/releases/v17/17-1.mdx (via ObjectQLPlugin (symbol, a top-level class))
  • content/docs/releases/v17/17-5.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/releases/v17/17-6.mdx (via SqlDriver (symbol, a top-level class))
  • content/docs/releases/v18/18-1.mdx (via SqlDriver (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
  • 1 changed file(s) yielded no anchor (packages/objectql/src/index.ts) — pages documenting those are invisible to this run
  • 4 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 231 client-bound route-ledger rows — the other 166 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 166: 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; 107 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 — 56 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 f65c36fcca8c33d38c62104c0888c950a315089a → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json f65c36fcca8c33d38c62104c0888c950a315089a

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

Move acquireBootSchemaMigrationLock and its JSDoc above the existing
JSDoc of installRegisteredSchemas, so neither block is orphaned.
Comment placement only; no behaviour change.

Claude-Session: https://claude.ai/code/session_01ADHkmRuoKNTbmDhQPaG2vW
Co-authored-by: Claude <noreply@anthropic.com>
The schema-migration lock asked every driver for its Knex to learn its
dialect. The Turso remote transport refuses getKnex() by throwing, so a
remote Turso boot failed in ObjectQLPlugin.start() before its schema
sync. The lock now reads SqlDriver#dialectName first and calls
getKnex() only for postgres or mysql; a Postgres or MySQL driver whose
Knex cannot be handed out still fails loudly. Pins cover a SQLite face
whose getKnex() throws (no lock, no throw, boot syncs) and the loud
failure on postgres/mysql. The Turso ledger comment is corrected.

Claude-Session: https://claude.ai/code/session_01ADHkmRuoKNTbmDhQPaG2vW
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#2 · os-steve · session_01ADHkmQKZzp4DLtqiCkZZRM

维护者速读

  • 改了什么: 服务器启动时同步表结构(包括 OS_MIGRATE_AND_EXIT=1 的迁移任务)现在也拿 os migrate apply 用的同一把数据库锁,同步完立刻放掉,不在运行期间持有。锁模块下移到 @objectstack/objectql,cli 从那里引用。
  • 为什么改: 多副本同时启动时各自读到同样缺失的表、各自建表。实测在 main 上三个迁移任务加两个普通启动会撞 pg_type 冲突,有表被建两次,而进程都以 0 退出。
  • 风险与回滚: 单节点没人争锁时只多一条语句,启动输出不变;SQLite/Turso 不拿锁。等锁最多等启动预算的一半(默认 60 秒),超时则这次启动失败并说明原因,不改任何东西。回滚即还原本 PR。
  • 先看: packages/objectql/src/plugin.ts 的 acquireBootSchemaMigrationLock 和 start() 里包住第 1 到第 3 阶段的 try/finally。
  • 两分钟验证: 读 plugin-boot-schema-migration-lock.test.ts 的六个用例,以及 cli 实库集成测试里新增的并发启动用例。
  • 需要你做的: 无,由席位落地。
  • 席位意见: ACCEPT。

席位核对 — ACCEPT · domain:server#2 · Head-sha ab5e59107ea32f637f691e576af7a7d139af4311 · 2026-11-09T03:14Z

  1. Shape: draft to main, Fixes #31715; Clause-②: no, Metadata-protocol: none; patch changeset for @objectstack/objectql, @objectstack/driver-sql and @objectstack/cli. 10 files, +624/−179. fix(cli): schema migration takes a cluster-wide lock so concurrent replicas cannot migrate at once (#3814) #31598's card item 2 is quoted under its own heading.
  2. Premise: held. On main, barrier-aligned boots (three OS_MIGRATE_AND_EXIT=1 plus two ordinary) against one fresh Postgres gave a pg_type collision and a table created twice, and all exited 0. After: 0 duplicates in 5 runs.
  3. Read of the diff:
    • One lock. Same function, name and PG key as fix(cli): os migrate apply takes a database lock so concurrent migrators run one at a time #31714. The module moved to @objectstack/objectql (the lowest package both the boot and cli import), and packages/cli/src/utils/schema-migration-lock.ts is now a re-export only. No second copy.
    • Scope. Taken in ObjectQLPlugin.start() just before Phase 1 and released in finally after Phase 3, so a refusal or throw between phases still releases it. It is never held while the server runs.
    • Datasource. Default datasource only. DDL on any other datasource is unchanged, and the PR body says so.
    • No lock under skipSchemaSync, or when the default driver has its DDL deferred (the new read-only SqlDriver#schemaDdlDeferred), because os migrate plan/apply takes the lock itself. This keeps a migrator from waiting on itself.
    • Turso. The face-answer table gains schemaDdlDeferred: 'inherited'. The lock never asks a non-pg/mysql face for Knex (round 2).
    • Bound. Half the plugin's start budget (60 s by default), so a queued boot refuses with the lock's own message instead of hitting the kernel's start timeout.
    • serve.ts. Untouched: OS_MIGRATE_AND_EXIT=1 is the same kernel boot.
  4. R3 exception (fix(cli): schema migration takes a cluster-wide lock so concurrent replicas cannot migrate at once (#3814) #31598 card item 2): uncontended single node is one lock statement with no output, and single-boot output is identical to main. SQLite takes no lock.
  5. Gates:
    • Dev: 79/79 derived gates exit 0, with 0 NOT-MEASURED and 0 UNRUN. Lint is clean, and typecheck passes for objectql, driver-sql, driver-turso and cli.
    • Tests: objectql 577 files / 11736 tests, driver-sql 246, turso 97, cli unit 406; live-PG pin 8/8.
    • Ablations: 4 unit pins and 2 live pins go red.
    • Check-runs on this head: 36 success, 17 skipped, 0 failed (one PR-body guard run was cancelled when the body edit re-triggered it; its rerun is green).
  6. Review rounds:
    • Round 1 (seat review). The new method had been inserted between installRegisteredSchemas's JSDoc and that method, orphaning the doc. It was moved above (comment placement only, 3fa9769 → 86ea712).
    • Round 2 (CI fail). Test Core (3/8) went red on runtime organization-ownership-boot-guard.turso-remote.kernel.test.ts because getKnex() throws on the Turso remote face, so a remote Turso boot died before its sync. Root fix (86ea712 → ab5e591): the lock reads the driver's own SqlDriver#dialectName first and asks for Knex only for postgres or mysql. A Postgres/MySQL driver whose getKnex() throws still fails loudly (no catch). New pins cover a throwing SQLite face (no call, null) and a throwing pg/mysql face (rejects), plus a boot pin. Measured: that runtime file red 2 → green 2/2; runtime turso files 9/9; cli schema-migrate.remote-posture 11/11.
  7. Open questions, ruled:
    • (1) New public names: the objectql lock exports and SqlDriver#schemaDdlDeferred are accepted.
    • (2) Module home: objectql, not core.
    • (3) Wait bound: half the start budget is accepted.
    • Deviation: the forced one-row Turso face-answer entry (Record<keyof SqlDriver>) is accepted.
  8. Landing: Clause-② is no and no governed path is touched, so there is no contract review face. Ordinary queue landing: pr_ready + automerge_enable.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 9, 2026 03:15
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit f647430 Nov 9, 2026
54 of 55 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-0js4sp branch November 9, 2026 03:42
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

1 participant