Repository navigation
fix(driver-sql): a storage.notNull field added to a populated table is added nullable and reported as tighten_not_null - #37279
Conversation
…lated table Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
…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
… line ceiling Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011y7As5bdhV5T4N9vpjmZzH
📓 Docs Drift Check12 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
Coarse fallback — 15 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 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 |
… 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
|
repo:objectstack#7 · os-alice · session_011y7As92T28dA9wc7wtu3iE 席位核对 — ACCEPT · head c9c0616L1 by the dispatching seat, read at 2026-11-25T12:27Z. No L2 owed: no
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. |
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 45614413204 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
…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>
…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>
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 declaresstorage.notNullwith no DEFAULT the existing rows can take, the column is built nullable on both exits (scalar tail and multi-value JSON). A literal orNOW()default still getsNOT NULL DEFAULT …. A fresh table or an empty existing table still getsNOT NULL.emitsDeclaredColumnDefault(field)(sql-driver-schema-sync.ts) is now the single statement of "does this field get a physical DEFAULT".applyDeclaredColumnDefaultand the new question both read it.ALTER TABLE … ADD COLUMNsites insql-driver-rotation.ts(the managed path ininitObjects, andensureShardTable) askaddsNotNullToPopulatedTableonce per table, asselect 1 … limit 1. The read only happens when a column about to be added declaresstorage.notNull, so other syncs make no extra query.storage.notNull, so the nullable column comes back astighten_not_null(destructive,os migrate apply --allow-destructiveafter the backfill), which is what thestorage.notNulldescribe promises.requiredis 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, anddetectManagedDriftreportstighten_not_null:added". The REMOTE half still pins the refusal, and the case and the docblock record that as a known asymmetry.#17231note increateColumnsaid 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:added(text) andadded_tags(multi-value) are nullable.added_dflt(defaultValue: 'd') is NOT NULL, and the existing row reads'd'.detectManagedDriftcontainstighten_not_null:addedandtighten_not_null:added_tags, and does not containadded_dflt. A create that providesaddedsucceeds and reads back.addedandadded_tagsare NOT NULL, with notighten_not_null.Fix at head: SQLite and live Postgres (PG 16, local throwaway server) both RAN
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)
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
Ablation (scripts/ablation-replace.mjs): the populated-table guard removed, red, then restored to the HEAD blob
This suite resolves the driver from
src/(no packageexportshop), so the mutation needs no rebuild.Acceptance notes
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.tscase 4 pins both halves as they are.ADD COLUMN … NOT NULLwhen the table has no rows. Making them nullable would addtighten_not_nulldrift to a path that works today.Verification
Read first:
sql-driver-column-creation.ts(thenotNullhead ofcreateColumn), thensql-driver-rotation.ts(addsNotNullToPopulatedTableand 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. WithOS_TEST_POSTGRES_URLset, 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-coverageexit 0.pnpm check:facade-delegation-onlyexit 0 (sql-driver.ts: 10071 lines, ceiling 10071).pnpm check:type-check-debtexit 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