Repository navigation
fix(cli): the ownership ceremony re-runs its not-null step on a resumed apply, so tables it skipped receive NOT NULL - #31409
Conversation
…pply A table the step left nullable (not declared by the booted composition, or held by a NULL row since resolved) now receives NOT NULL on the re-run the step's advice names. The schema door answers already-not-null for a column an earlier run tightened, so nothing is rebuilt twice and a run with nothing pending stays checkpointed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mbAyTfp7gbjowRA48
…ull resume pins Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FEkQ5mbAyTfp7gbjowRA48
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 3 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 35 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 92e734f35ce8a9747b4a93497fbf394a66209ae3 && git checkout 92e734f35ce8a9747b4a93497fbf394a66209ae3
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 96b5dab128806d094dc1dce9fdc58c194dd4ea18 85776d2bac6342a860cfcd855c6f0aada3bb298f && git checkout -B drift-repro 96b5dab128806d094dc1dce9fdc58c194dd4ea18 && git merge --no-ff 85776d2bac6342a860cfcd855c6f0aada3bb298f
node scripts/docs-audit/affected-docs.mjs --json 96b5dab128806d094dc1dce9fdc58c194dd4ea18
|
|
domain:server#5 · os-project-manager · session_01FEkQ5o8PE7ZtVjcor51wBZ Contract-review-claim: session_01FEkQ5o8PE7ZtVjcor51wBZ · head 85776d2 · 2026-11-08T06:27Z |
|
domain:server#5 · os-project-manager · session_01FEkQ5o8PE7ZtVjcor51wBZ Contract reviewServed-tier: Inputs read: card #31374 with its triage, the dev report 6718215186, PR #31409's body and its net diff against ① Derived judgments
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS Generated by Claude Code |
|
domain:server#5 · os-project-manager · session_01FEkQ5o8PE7ZtVjcor51wBZ 席位意见:接受。所有权仪式续跑时,加 NOT NULL 这一步不再因已打检查点而跳过:当时因组合未声明或遗留 NULL 行而留空的表,这次能加就加上;已是 NOT NULL 的列从数据库目录读出,不重建;无事可做时照旧显示 checkpointed;续跑失败则撤掉检查点、不认证。复审 PASS,无必改项。卡片 B 项(迁移不跟随 serve 的 AI 自动注入)已拆到 #31411,维护者已裁 B。 席位核对 — ACCEPT ·
|
Requested by Leehom · project thread
domain:server#5 · os-project-manager · session_01FEkQ5mbAyTfp7gbjowRA48
Fixes #31374
Clause-②: no
Metadata-protocol: none
维护者速读
os migrate organization-ownership --apply)续跑时,加 NOT NULL 那一步不再因为「已打过检查点」直接跳过,而是重新评估一遍:当时因组合没声明(notDeclared)或因遗留 NULL 行被挡住的表,这次能加就加上;已经是 NOT NULL 的列从数据库目录读出来,报already-not-null,不会再重建一次表。organization_id仍可为空;这一步自己的提示「重跑即可补上」实际做不到(organization-ownership ceremony: the not-null step checkpoints with the tables it skipped as notDeclared, so a re-run under a composition that declares them never adds NOT NULL; and composeServedPlatform skips serve's AI auto-inject #31374 的 A,p1,cloud ee-v4.3.1 依赖这条恢复路径)。@objectstack/cli的仪式代码;首次运行行为不变,续跑且无事可做时仍显示checkpointed。续跑时加 NOT NULL 失败会挡住认证并撤掉这一步的检查点,与首次运行失败一致。回滚即还原本 PR。B(composeServedPlatform不跟随serve的 AI 自动注入)不在本 PR,作为待决问题交席位。packages/cli/src/utils/organization-ownership-apply.ts续跑循环里新增的not-null分支;packages/cli/src/utils/organization-ownership-not-null.ts先读 NOT NULL 再判声明的顺序;packages/cli/src/commands/migrate/organization-ownership.ts的目录读缓存。pnpm --filter @objectstack/cli exec vitest run --project integration src/utils/organization-ownership-apply.not-null-resume.test.ts,预期 4 个用例全过(在 main 上 3 个红)。What changes
os migrate organization-ownership --applycheckpoints itsnot-nullstep (18.x step 5d, ADR-0131 8e) when the step finishes, also when it left tables nullable for one of two reasons:not-declared). The step's note says "re-run the ceremony where the deployment's composition is declared to apply it";UNATTRIBUTABLE_REMEDYsays "then re-run --apply".On
main, a later apply reads the checkpoint and skips the step. So both re-runs certify the database withorganization_idstill nullable on those tables.Choice: re-evaluate on resume, not "leave the step un-checkpointed while anything is pending". Leaving it un-checkpointed would make
completefalse, so a database with anot-declaredtable could no longer certify at all. Today it certifies with the table reported, and the card's own acceptance (1) certifies with N tablesnot-declared. That would change what certification means. Re-evaluating keeps the checkpoint contract unchanged: a checkpoint still means the step ran todoneonce. It follows the pattern the loop already uses forattribution,mirror-deletionandhistory-renumber, and it makes both advice lines literally true.utils/organization-ownership-apply.ts: on a resumed apply that has a schema door, a checkpointednot-nullstep runs again.doneand the checkpoint takes the new summary.checkpointedwith the recorded summary, exactly as before, and keeps the re-run's notes, so a table that is stillnot-declaredkeeps its advice line.utils/organization-ownership-not-null.ts: the port asksisNotNullof every column first and answersalready-not-nullfor a column that is NOT NULL already. Before this, only a rotation shard was asked. Without it, the re-run would rebuild, on SQLite, every table an earlier run tightened, on every resume.commands/migrate/organization-ownership.ts: the command'sisNotNullreads the column catalog once per database per port call. It used to read once per table, and every table is now asked. Each table is read before it is tightened, so the cached read is never stale for the table it answers.Tests
New
src/utils/organization-ownership-apply.not-null-resume.test.ts(integration tier: realSqlDriveron SQLite, NOT NULL through the driver's drift apply door, read back frompragma_table_info):not-declared, re-run under a composition declaring all 3 → NOT NULL on all 3. The table the first run tightened is not rebuilt (rebuilt= 3 tables, not 4).isolatedposture): apply → certification held by the NULL row → fix the row → plan (nowwillReceive: true) → apply → NOT NULL on the fixed table, certified.checkpointedwith the same summary and rebuilds nothing.src/utils/organization-ownership-not-null.test.ts: ⭐ a declared table an earlier run tightened isalready-not-nulland is never handed to the door again.Red on main (base 7189fb2, test file only): 3 failed, 1 passed (the control)
Each red is at the re-run assertion. Every first-run assertion (including certification with
notDeclared: 2, and the held walled first run) passes on main.Ablations (scripts/ablation-replace.mjs, on head 9bd2dbc; each restored, blob == HEAD, git diff HEAD empty)
… && opts.notNull && String("ABL1").length < 0): the same three pins red,Tests 3 failed | 8 passed (11), with the"status": "checkpointed"/"notDeclared": 2diff above.isNotNullcheck disabled: 5 red,Tests 5 failed | 6 passed (11). The shard and declared-tablealready-not-nullport pins, (1), (2), and the CONTROL (3), whose re-run rebuilds again:- "status": "checkpointed" + "status": "done".The test imports
srcdirectly (nodistin the resolution path), so no rebuild leg was owed.Acceptance notes
ALTER COLUMN … SET NOT NULLpath is the existing drift door, unchanged here.servecomposes needs a host import of@objectstack/service-ai, a cloud-only package outside this workspace (CAPABILITY_PROVIDERShas noaientry). It also needs the Studio chain and its required/auto/off rule, which today live inline inserve.ts. Sharing them means a new seam inserve.ts, which open PR docs(skills): name ignore as the seed mode default and the minimal-preset job/queue exception; correct three capability comments #31377 also touches, plus a fake host-package fixture. The other route, refusing the plan whenaiis only auto-injected, narrows whatos migrateaccepts for such hosts. Per the order, B goes to the report'sopen_questions(needs_decision) instead of widening this PR. cloud mounts the AI plugin explicitly since cloud#3744, so no cloud host depends on it.attributionandmirror-deletionkeep their checkpoint entry when their re-run blocks, so such a run still computescompletefrom the checkpoint. This PR changes that only fornot-null, the step it owns.node scripts/pm/check-governed-merges.mjs --branch HEAD: "0 of 6 path(s) hit the register … NOT governed — ordinary queue landing applies".dispatch-gates --tier: no path-derived mandate.Verification
All on head
85776d2b(the branch mergedorigin/mainateff90af6afirst). Every exit code was captured before any pipe.node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstacklisted 69 families for this diff. All 69 exited 0.--ran: "69 derived famil(ies) accounted for — 69 run, 0 NOT-MEASURED". The full record is in the seat's order folder (31374-gates-ran.txt).c4eec5e3, found one real red:pnpm check:test-source-aliasexit 1. The new test file reached seven dynamic imports through the plan's module graph.85776d2bloads them at module top. Round 2 re-ran all 69.check-plugin-teardown-shape.mjs --self-testexit 3 was a shallow-clone prerequisite. Aftergit fetch --depth=1 origin 621a4876…it exited 0, and it exited 0 again in round 2.pnpm --filter @objectstack/cli exec vitest run --project unit, 401/401 files.test/published-subpath-{console,hook-body}.pin.test.ts: "packages/cli is not built", a prerequisite. After the build both passed, 29/29.Test Files 7 passed | 1 skipped,Tests 150 passed | 1 skipped.organization-ownership-not-null,organization-ownership-apply,…apply.generation-1,organization-ownership-not-declared.integration,organization-ownership.no-organization.integrationandorganization-ownership.declared-rule-mirrors.integration.organization-ownership.remote-face.integration(describe.skipIf(!SQLD), no sqld binary here): NOT MEASURED locally, so CI's run is the reading.pnpm --filter @objectstack/cli typecheck(tsc --noEmitandcheck:test-typecheck, heap 6144): exit 0 on85776d2b.pnpm exec eslint --no-inline-config) on the five touched.tsfiles: exit 0.scripts/pm/os-verify-lock.sh:@objectstack/cli^..., thenturbo run build --filter=./packages/**, both VERDICT command-exit 0.Human Minimum
packages/specholds no runtime logic. (not touched)pnpm lintpasses. (eslint on the five touched files: exit 0)main, one pull request..changeset/31374-ownership-not-null-resume.md,@objectstack/clipatch)packages/spectouched: its generated artifacts are regenerated and committed. (not touched)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.🤖 Generated with Claude Code
https://claude.ai/code/session_01FEkQ5mbAyTfp7gbjowRA48
Generated by Claude Code