Skip to content

fix(driver-sql): a storage.notNull field added to a populated table is added nullable and reported as tighten_not_null - #37279

Merged
objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-37258-add-column-notnull-nullable
Nov 25, 2026
Merged

objectstack-fleet[bot] merged 6 commits into
mainfrom
claude/issue-37258-add-column-notnull-nullable

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE
Fixes #37258

Clause-②: no
Metadata-protocol: none

维护者速读

  • 用户能看到什么变化:作者给已有数据的对象新增一个带列约束的必填字段后升级,该对象照常同步、照常可写;这一列先按可空加上,迁移报告里提示需先回填再收紧。
  • 为什么做:今天这样升级会让整个对象同步失败、不可写,而字段说明承诺的是「先回填、经迁移流程收紧」。
  • 出错会怎样:只影响给已有数据的表加列这一步;万一判断错,最坏是列多了一个收紧提示,数据不会坏,可直接撤回。
  • 要你做什么:无。

What changes

  • createColumn (sql-driver-column-creation.ts) takes one more flag, addedToPopulatedTable. When it is set and the field declares storage.notNull with no DEFAULT the existing rows can take, the column is built nullable on both exits (scalar tail and multi-value JSON). A literal or NOW() default still gets NOT NULL DEFAULT …. A fresh table or an empty existing table still gets NOT NULL.
  • emitsDeclaredColumnDefault(field) (sql-driver-schema-sync.ts) is now the single statement of "does this field get a physical DEFAULT". applyDeclaredColumnDefault and the new question both read it.
  • Both ALTER TABLE … ADD COLUMN sites in sql-driver-rotation.ts (the managed path in initObjects, and ensureShardTable) ask addsNotNullToPopulatedTable once per table, as select 1 … limit 1. The read only happens when a column about to be added declares storage.notNull, so other syncs make no extra query.
  • The differ is unchanged. It already compares the column against storage.notNull, so the nullable column comes back as tighten_not_null (destructive, os migrate apply --allow-destructive after the backfill), which is what the storage.notNull describe promises. required is not read on this path.
  • packages/drivers/driver-turso/src/turso-remote-not-null.test.ts (seat ruling A, surface widened to this one file): case 4's LOCAL half flips from "refused" to "adds the column nullable, and detectManagedDrift reports tighten_not_null:added". The REMOTE half still pins the refusal, and the case and the docblock record that as a known asymmetry.
  • The #17231 note in createColumn said the column constrained there "is always EMPTY". That was false for ADD COLUMN on a populated table, and it is corrected.

Tests

src/sql-driver-37258-add-column-not-null.test.ts, a live-dialect matrix suite (declareDialectCell), one block per cell:

  • Populated table: the sync succeeds. added (text) and added_tags (multi-value) are nullable. added_dflt (defaultValue: 'd') is NOT NULL, and the existing row reads 'd'. detectManagedDrift contains tighten_not_null:added and tighten_not_null:added_tags, and does not contain added_dflt. A create that provides added succeeds and reads back.
  • Empty table: added and added_tags are NOT NULL, with no tighten_not_null.
Fix at head: SQLite and live Postgres (PG 16, local throwaway server) both RAN
Test Files  1 passed (1)
     Tests  10 passed | 1 skipped (11)
  sqlite         RAN
  live postgres  RAN
  live mysql     NOT RUN -- set OS_TEST_MYSQL_URL to run it
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/driver-sql typecheck: exit 0 (same lock run). pnpm --filter @objectstack/driver-sql test (earlier head d96f286, which differs from the final head only by a whitespace-only reflow of one wrapper signature): Test Files 270 passed | 14 skipped (284), Tests 4548 passed | 265 skipped (4813).

driver-turso pin at head 848f0f2 (after building the driver-turso dependency closure)
pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=2 src/turso-remote-not-null.test.ts
 Test Files  1 passed (1)
      Tests  10 passed (10)
pnpm --filter @objectstack/driver-turso typecheck   (tsc --noEmit; --listFiles includes the test file)
os-verify-lock: VERDICT command-exit 0

Before the flip, on head 9995c0e: 2 failed, 8 passed (the two local-half refusal pins).

Repro: src at origin/main 057cedf, test at HEAD, red on both dialects
LEG base exit 1
Test Files  1 failed (1)
SqliteError: alter table `nn_add_populated` add column `added` text not null - Cannot add a NOT NULL column with default value NULL
error: alter table "nn_add_populated" add column "added" text not null, add column "added_tags" json not null, add column "added_dflt" text not null default 'd' - column "added" of relation "nn_add_populated" contains null values
restore: git diff HEAD bytes=0
Ablation (scripts/ablation-replace.mjs): the populated-table guard removed, red, then restored to the HEAD blob
anchor "      && !(addedToPopulatedTable && !emitsDeclaredColumnDefault(field));"  x1 -> x0
replace "      && true;"  x0 -> x1
ok mutation landed: anchor 1 -> 0, blob fbe99fc67860 -> 8eaf8866eba9
Test Files  1 failed (1)
command exited 1
ok restored: blob == HEAD (fbe99fc67860) and `git diff HEAD` is empty

This suite resolves the driver from src/ (no package exports hop), so the mutation needs no rebuild.

Acceptance notes

  • Known asymmetry, Turso local and remote faces. On a populated table with no DEFAULT, the local face now adds the column nullable and reports tighten_not_null. The remote face (RemoteTransport.columnDeclarationSQL) still refuses, and its docblock line "The local face sends the same statement and gets the same refusal" is false after this PR. The seat is filing the remote face as its own card. turso-remote-not-null.test.ts case 4 pins both halves as they are.
  • Empty existing tables keep getting the constraint directly, because SQLite and Postgres both accept ADD COLUMN … NOT NULL when the table has no rows. Making them nullable would add tighten_not_null drift to a path that works today.
  • A rows-then-ALTER race (a row inserted between the probe and the ALTER) fails the same way main fails today. It is not widened.

Verification

Read first: sql-driver-column-creation.ts (the notNull head of createColumn), then sql-driver-rotation.ts (addsNotNullToPopulatedTable and the two call sites).

Two-minute check: pnpm --filter @objectstack/driver-sql exec vitest run src/sql-driver-37258-add-column-not-null.test.ts. Expect 5 passed on the sqlite cell. With OS_TEST_POSTGRES_URL set, expect 5 more on live postgres.

Gates (head 848f0f2)

试行偏离 (maintainer-authorized trial, 2026-11-25, rework round 2): only a local subset ran on this head. These are the driver-turso pin and typecheck above, plus the ratchet families. Every other derived family is cited from this PR's CI check-runs. There was no in-session wait on CI.

Local gate readings at 848f0f2
  • pnpm check:type-check-coverage exit 0.
  • pnpm check:facade-delegation-only exit 0 (sql-driver.ts: 10071 lines, ceiling 10071).
  • pnpm check:type-check-debt exit 0 (0 raw tsc error(s) total, none above its recorded number).
  • dispatch-gates --ran: 73 derived, 3 run, 0 NOT-MEASURED, 70 UNRUN. The 70 were left to CI under the trial. On the previous head (9995c0e, driver-sql sources the same as now), 61 of them ran locally and all exited 0.

🤖 Generated with Claude Code

https://claude.ai/code/session_011y7As92T28dA9wc7wtu3iE

…llable and leave it to tighten_not_null

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
… a populated table

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
@github-actions github-actions Bot added size/m 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 25, 2026
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

12 anchor(s) derived from 1 changed package(s); no hand-written page names any of them, so this run has nothing to list — not a clean bill of health. This check sees only pages that NAME a derived anchor: one that documents this change in prose, or enumerates it in an authoring dialect, names none and stays invisible to it on every run.

What this run could not see
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 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; 124 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 — 15 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 4ed453dc211f24114c36133cb016515f377d2d5c → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 4ed453dc211f24114c36133cb016515f377d2d5c

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

… nullable; record the remote asymmetry

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As92T28dA9wc7wtu3iE
…ated arg; fold rotation import

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011y7As92T28dA9wc7wtu3iE
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE

席位核对 — ACCEPT · head c9c0616

L1 by the dispatching seat, read at 2026-11-25T12:27Z. No L2 owed: no Clause-②: yes, no narrowing arm, no packages/spec/src/**, no governed path (files read from the PR's file list), so CI plus the seat's own read (contract-review.md, four faces untouched).

Trial (试行偏离, maintainer-authorized 2026-11-25): rework round by a fresh agent (round 1: 29 tool calls; round 2, cli pin red in CI Test Core (1/10) at 848f0f2: 14 tool calls), no in-agent CI wait, L1 by the seat itself with no second review agent.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE

Landing at 2026-11-25T12:29Z: ACCEPT → PR #37279 comment 7162428406 at head c9c0616. Every check green or expected-skip at that head; not governed; K = 0. Ready + auto-merge in this stroke.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 25, 2026 12:29
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit e845656 Nov 25, 2026
54 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-37258-add-column-notnull-nullable branch November 25, 2026 13:01
@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 45614413204 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Temporal Conformance (live PG + MySQL) — 失败步骤: Run driver-sql suite against both live servers

    × keeps NOT NULL where the field declares a literal default the existing rows take 12ms
    × the object stays writable 4ms
    FAIL  src/sql-driver-37258-add-column-not-null.test.ts > live cell budget (60000 ms) > ADD COLUMN of a storage.notNull field — live mysql (#37258) > a table that already holds rows > keeps NOT NULL wh
      ↳ 失败原因: AssertionError: expected [ '' ] to deeply equal [ 'd' ]
    FAIL  src/sql-driver-37258-add-column-not-null.test.ts > live cell budget (60000 ms) > ADD COLUMN of a storage.notNull field — live mysql (#37258) > a table that already holds rows > the object stays 
      ↳ 失败原因: Error: insert into `nn_add_populated` (`added`, `added_tags`, `id`, `plain`) values ('named', '[\"t\"]', '9J2SZRTjR1rU57bx', 'new') - Field 'added_dflt' doesn't have a default value
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • src/sql-driver-37258-add-column-not-null.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 5 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…age.notNull column nullable and reports tighten_not_null (objectstack-ai#37343)

<!-- claude-projects-attribution: {"github_login":"os-alice"} -->
_Requested by **Alice** · [project
thread](https://claude.ai/code/project/chan_01NoziMoftaSPmzgKNjJGePH?thread=cmsg_01NoziMoftaSPmzgKNjJGePHF2YwdMyivntPLScbmPf6ns)_
Fixes objectstack-ai#37281

Clause-②: no
Metadata-protocol: none

## 维护者速读

-
用户能看到什么变化:托管云数据库上,作者给已有数据的对象新增一个带列约束的必填字段后升级,该对象照常同步、照常可写;这一列先按可空加上,迁移报告里提示需先回填再收紧,与本地数据库的行为一致。
-
为什么做:今天这样升级会让托管环境里整个对象同步失败、不可写,而字段说明承诺的是「先回填、经迁移流程收紧」;本地那一半上一轮已修好,这是剩下的云端一半。
- 出错会怎样:只影响给已有数据的表加列这一步;万一判断错,最坏是列多一个收紧提示,数据不会坏,可直接撤回。
- 要你做什么:无。

## What changes

- `RemoteTransport.columnDeclarationSQL` (`remote-transport.ts`) stays
the one renderer and takes one more flag, `addedToPopulatedTable`. When
it is set and the field declares `storage.notNull` with no literal or
`NOW()` default, the column is rendered without ` NOT NULL`. This is the
same decision the local face's `createColumn` makes (PR objectstack-ai#37279).
- Both `ADD COLUMN` doors ask whether the table holds a row with `SELECT
1 FROM "t" LIMIT 1`, and only when a column about to be added declares
`storage.notNull` (`addsNotNullColumn`). `syncSchema` sends one
statement. `syncSchemasBatch` sends ONE extra read batch covering every
such table, between the column introspection and the DDL batch. A sync
that adds no such column sends nothing extra, so the steady-state
round-trip count is unchanged.
- `declaresEmittedColumnDefault` is the remote twin of driver-sql's
`emitsDeclaredColumnDefault`, composed from the same two spec predicates
(`isNowDefaultToken`, `isRuntimeDefaultToken`) in the same order. It is
a twin because driver-sql does not export that predicate and the claimed
file surface is driver-turso only. See Acceptance notes.
- The drift report needed no new code. The shared differ already
compares the column against `storage.notNull`, so the nullable column
shows up as `tighten_not_null` on the remote face's own
`detectManagedDrift`. Measured: the PM's Zone 2 assumption holds.
- Docblocks: the `columnDeclarationSQL` section "ADD COLUMN on a table
that already holds rows" is rewritten to the `storage.notNull` contract.
The stance "Never drop the NOT NULL" from objectstack-ai#23847 now applies only to the
literal/`NOW()` default case, where the local face keeps the constraint.
The `syncSchemasBatch` round-trip docblock now counts five possible
calls.
- `turso-driver.ts`: `REMOTE_DRIFT_REPORT_CAVEAT` and its docblock now
also name the populated-table add as a source of `tighten_not_null` this
face's own sync produces. Its "the sync creates it now" clause stopped
being the whole story after this change. The only pin on it is
`stringContaining('NOT NULL')`.

## Tests

`turso-remote-not-null.test.ts`, case 4 (the KNOWN ASYMMETRY note is
removed). There is a `describe.each` over two defaults that fill no row
(none, and the `current_user` token) and an `it.each` over `local` /
`syncSchemasBatch` / `syncSchema`. Every cell asserts the same answer:
`plain`, `added` and multi-value `added_tags` all have `notnull` 0, and
`tighten_not_null` covers exactly `added` and `added_tags`. A create
providing the columns then succeeds and reads back. A new batch cell
syncs a populated table and an empty table in one `syncSchemasBatch` and
checks each answer: the populated table gets nullable plus
`tighten_not_null`, and the empty table gets NOT NULL with no drift.

Case 5 (RECORDED ASYMMETRY, a literal `defaultValue`) is unchanged and
still passes: the local face accepts it as NOT NULL, and this face still
refuses.

<details><summary>Fix at head 056bae7</summary>

```
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)
os-verify-lock: VERDICT command-exit 0

pnpm --filter @objectstack/driver-turso typecheck && pnpm --filter @objectstack/driver-turso exec vitest run --maxWorkers=2
 Test Files  104 passed | 1 skipped (105)
      Tests  2657 passed | 36 skipped (2693)
os-verify-lock: VERDICT command-exit 0
```
The typecheck program includes the test file (`tsc --noEmit
--listFiles`: 1 hit).
</details>

<details><summary>Ablation (scripts/ablation-replace.mjs): the
populated-table guard removed, red, then restored to the HEAD
blob</summary>

```
anchor "      && !(addedToPopulatedTable && !declaresEmittedColumnDefault(field));"  x1 -> x0
replace "      && true;"  x0 -> x1
ok mutation landed: anchor 1 -> 0, blob b6abce4 -> 7262586662a3
Tests  5 failed | 10 passed (15)   (the 4 remote cells of case 4 + the batch cell; every local cell stays green)
command exited 1
ok restored: blob == HEAD (b6abce4) and `git diff HEAD` is empty
```
This suite imports `TursoDriver` from `src/`, and `remote-transport.ts`
is reached by a relative import with no package `exports` hop, so the
mutation needed no rebuild.
</details>

## Acceptance notes

- **The remote face can report the tightening but cannot apply it.**
`REMOTE_DRIFT_OP_ANSWERS.tighten_not_null` is `needs-table-rebuild`
(objectstack-ai#23925), so `os migrate apply --allow-destructive` on a remote database
names the entry as not applied, and `driftReportCaveat` already says the
report is for reading. This is an existing declared limit of the face,
and this PR does not widen it. Before this change, the object's sync
failed outright.
- **Literal/`NOW()` default on a populated table (case 5).** This still
refuses on the remote face, because the face emits no declared column
DEFAULT. This PR keeps it as case 5 records it, as the card's acceptance
asks ("default-carrying fields keep `NOT NULL`"). Closing it means
deciding whether, and from which shared source, the remote face emits
declared defaults. If that is owed, it is a separate card for the seat
to file.
- **Twin predicate.** `declaresEmittedColumnDefault` restates
driver-sql's `emitsDeclaredColumnDefault` (4 lines, same spec
predicates, same order). The shared form would be to export it from
`@objectstack/driver-sql` and import it here. That is outside the
claimed surface and would move driver-sql's published exports, so it is
not done here. The `current_user` cell of case 4 and case 5 hold the two
faces to one answer for the token and literal kinds.
- A rows-then-ALTER race (a row inserted between the probe and the
ALTER) fails the way main fails today, as on the local face. It is not
widened.

## Verification

Read first: `remote-transport.ts` `columnDeclarationSQL` (the `notNull`
line and its rewritten docblock), then the two call sites in
`syncSchema` and `syncSchemasBatch` (phase 2c), then case 4 of
`turso-remote-not-null.test.ts`.

Two-minute check: `pnpm --filter @objectstack/driver-turso exec vitest
run src/turso-remote-not-null.test.ts`. Expect 15 passed, with
`[schema-drift] rows_t.added: metadata declares storage.notNull but the
column is nullable` lines printed by the remote cells.

### Gates (head 056bae7)

试行偏离 (maintainer-authorized trial, 2026-11-25): only a local subset ran.
It is the driver-turso tests and typecheck above, plus these families.
Every other derived family is cited from this PR's CI check-runs. There
was no in-session wait on CI.

<details><summary>Local gate readings at 056bae7</summary>

- `pnpm check:type-check-coverage` exit 0; `pnpm check:type-check-debt`
exit 0 (`surplus: none`).
- `pnpm check:doc-authoring`, `check:issue-citations`,
`check:nul-bytes`, `check:closed-ceremony-text`,
`check:durability-log-level`, `check:published-files`: all exit 0.
- `check-empty-changeset`, `check-changeset-no-major`,
`check-adr-0087-registration` (`--base origin/main`): all exit 0.
- `check-platform-checklist --changed-from origin/main`: 0 anchored
files in the change set, nothing judged.
- `dispatch-gates --ran`: `72 derived, 11 run, 0 NOT-MEASURED, 61
UNRUN`. The 61 are left to CI under the trial.
</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_011y7As8wf3DSPRevwNnYLcM)_

---------

Co-authored-by: Claude <noreply@anthropic.com>
Nenzyz pushed a commit to Nenzyz/objectstack that referenced this pull request Dec 1, 2026
…surface (objectstack-ai#38267)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DDypKu7B9nwbu5WuV7AEio8)_
Part of objectstack-ai#38087 (items 1–2; item 3 is the maintainer's)

Clause-②: no
Metadata-protocol: none

## 维护者速读

- 用户能看到什么变化:用户无感。开发 agent 动 SQL
驱动时,派发工具现在会提前告诉它“真库测试会在合并队列里跑”。以前工具对这一项一字不提。
- 为什么做:配合“改 SQL 驱动的 PR 在合并队列里跑真库测试”这项裁决(先观察,再定是否必过)。观察读数已贴在卡上:三天多里有 23
个改驱动的 PR 跑了这一项,只红过一次。那次是 PR 自己新加的测试在 MySQL 上失败,因为这一项不是必过,PR 照样合进主干,主干红了约
6 小时。没有偶发失败,也没有拖慢队列。
- 出错会怎样:只影响开发 agent 读到的提示文字和一段代码注释,不影响 CI 本身,可直接撤回。
- 要你做什么:无。是否把这一项设为必过,由席位另行带读数问你。

## What changes

- **`scripts/pm/dispatch-gates.mjs`** fixes item 2's first bullet, which
did not match main.
- The `temporal-conformance` job's `if:` (ruling record 7146156389) ends
in a clause that `jobIfReading` refused whole: `github.event_name !=
'pull_request' && (github.event_name != 'merge_group' ||
needs.filter.outputs.temporal_live != 'false')`. So a driver-sql card
derived no row for the live PG + MySQL leg at all.
- The reader now recognises that exact spelling as a third WHEN and
returns `queueGate`. `jobFilterPopulation` resolves the output's globs.
- `jobFilteredSteps` then decides per card, on a glob that matches the
path itself (`triggerListMatches`, which has no directory reach), and
names that glob on the row:
    - a matching path gets "first run is the merge-queue build";
- a path that matches none and reaches into none gets the full-battery
sentence;
- a directory surface that only reaches into the globs (for example
`packages/runtime`, through the one-file cascade-delete glob) gets a
hedged third sentence: "the merge-queue build runs it only if a changed
file is in `filter.temporal_live` … otherwise its first run is `main`'s
push battery". The same hedge applies when the queue list is uncertain:
a dropped positive extglob, or a plain negation, which paths-filter and
GitHub's `paths:` read differently. A negated extglob still refuses the
job.
- An unparenthesised `A || B` ahead of any stripped event clause is now
refused. GitHub binds `&&` tighter than `||`, so the clause binds to `B`
alone. `(A || B)` reads as before, and no live `if:` is spelled the bare
way.
- The population is still the filter outputs ahead of the clause. The
queue output's globs never join it.
- **`scripts/check-required-contexts.mjs`**: the tombstone prose said
the leg runs "in the FULL BATTERY only". It now says the leg also runs
on a queue entry that hits `temporal_live`, that it is still not a
required context, and that the call is the maintainer's. Prose only:
`REQUIRED_CONTEXTS` and every pinned name are untouched.
- **Re-read and already right on main, so left untouched:**
- The THE TWO SPEEDS comment in `ci.yml`: already names the exception
and says it is advisory. No `ci.yml` edit, so this PR does not overlap
objectstack-ai#36646 or objectstack-ai#38132.
- The required-set paragraph in `AGENTS.md`: the eleven contexts are
exact, and "a check outside those eleven is advisory" covers the leg.
Net 0 bytes.
- `docs/agents/multi-agent-discipline.md` › Two speeds: already carries
the exception sentence.
- `scripts/pm/check-expected-skips.mjs:1318`: this is the self-test's
FIXTURE_TREE, frozen on purpose to judge the measured historical heads,
not the live tree. The live roster is derived and already handles the
new `if:` (`--roster`: "gate: job-gate filter core + pr-event
pull_request; derived").

## Observation reading (item 1)

Posted on the card: objectstack-ai#38087 comment 7237905765.

- Window: 863 `merge_group` runs since PR objectstack-ai#37155. The leg ran in 38 of
them, which are 23 distinct entries.
- Reds: 1, an own regression. PR objectstack-ai#37279's new live-MySQL test failed. It
landed anyway, because the leg is advisory, and objectstack-ai#37331 fixed it about 6
h later. Flakes 0, inherited 0. Entries that hit a live glob and skipped
the leg: 0.
- Leg minutes: median 11.1, p90 13.6.
- Queue wall time where the leg ran: median 28.4. Where it skipped:
median 24.6. The leg is never on the critical path: it finishes 7 to 26
minutes before the run does.

## Tests

<details><summary>self-test, ablation, derived output (head
0e1b472)</summary>

- `os-verify-lock.sh -c 'pnpm check:pm-dispatch-gates'`: `✓
dispatch-gates self-test (fast tier): 2385 cases pass`, `VERDICT
command-exit 0`. New cases:
- the queue-path reading, three near-miss refusals and `queueGate` null
elsewhere;
  - LIVE: a route-ledger path gets the full-battery sentence;
  - LIVE: a driver-sql path gets the queue-build sentence;
  - an in-place ablation of `queueOutput` on the row;
  - added in the rework:
    - `triggerListMatches` against `triggerListCovers` on a directory;
- LIVE: the directory surface `packages/runtime` gets the hedged
sentence, never the queue-build-first one;
- its ablation: with `queueHedged` stripped, the queue-build-first
sentence comes back;
    - the driver-sql row names its matching glob;
    - `queueUncertain` for a dropped extglob and for a plain negation;
    - the bare `A || B` refusals beside the parenthesised read.
- On-disk mutation: with the clause match replaced by `null`,
`jobIfReading(<live temporal if>)` returns `null`. Restored with `git
checkout HEAD --`, it returns `{refs:[filter.core],
notOnPullRequest:true, queueGate:filter.temporal_live}`.
- `node scripts/pm/dispatch-gates.mjs
packages/drivers/driver-sql/src/sql-driver.ts` now prints `[ci.yml ·
Temporal Conformance (live PG + MySQL)] … ⛔ does NOT run on this PR: …
your paths hit filter.temporal_live, so its first run on this change is
the merge-queue build`. Before, it printed no row.
- `node scripts/check-required-contexts.mjs --self-test`: 190 assertions
pass.

</details>

## Acceptance notes

- `check-expected-skips`'s derived reason for this job still reads
"answered by the merge-queue build" and adds "(plus 2 further
condition(s) the recogniser does not read)". That is true only when the
entry hits `temporal_live`. The hedge is honest, and the recogniser
deliberately evaluates no paths, so this is noted here and not filed.

## Verification

- Read first: `scripts/pm/dispatch-gates.mjs` `jobIfReading` (the
recursion on the text before the clause, which refuses a doubled event
clause), then `jobFilteredSteps` (the per-card `queueHit`).
- Two-minute check: `node scripts/pm/dispatch-gates.mjs
packages/drivers/driver-sql/src/sql-driver.ts 2>&1 | grep Temporal`
should print one row ending "first run on this change is the merge-queue
build".

<details><summary>local gates (head 0e1b472)</summary>

- `dispatch-gates --ran`: 70 of 70 derived families accounted for.
- `pnpm check:i18n-coverage`: NOT MEASURED, exit 3 `PREREQUISITE NOT MET
— the workspace CLI is not built`. The gate needs the CLI and every
example config built, and this diff touches neither. CI's `Lint & Repo
Gates` runs it. The first round's report wrongly counted this gate as
exit 0.
- Every other derived command exited 0, `node
scripts/check-self-test-workflow-commands.mjs` included. It timed out in
the first round and is green now.

</details>

---
_Generated by [Claude
Code](https://claude.ai/code/session_016WV4cxRDKprCtjpEdtiPFW)_

<!-- signed: repo:objectstack#1 · os-elon-musk ·
session_016WV4cxRDKprCtjpEdtiPFW -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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/m tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

2 participants