Repository navigation
feat(cli): show the upgrade plan before a self-hosted deploy — os deploy --dry-run, --json, and a terminal confirmation for an undeclared rename - #31776
Conversation
…oy --dry-run, --json, and a terminal confirmation (wip) Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 5 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 c15da9dfa23a955ebc36111eb461b6a004375eb0 && git checkout c15da9dfa23a955ebc36111eb461b6a004375eb0
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91 785490fcb427e65e1cf3ad4758f6fb955ca9677c && git checkout -B drift-repro 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91 && git merge --no-ff 785490fcb427e65e1cf3ad4758f6fb955ca9677c
node scripts/docs-audit/affected-docs.mjs --json 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91
|
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract-review-claim: session_01ADHkmP8JJo4zF2sjTBRwnX · head 4a7dafd · 2026-11-09T03:30Z |
…tion The os deploy flag table gains --dry-run and --json (self-hosted target only), the self-hosted steps say what the dry run prints, when the install asks "Deploy anyway?" on a terminal and what each answer does, and a table lists the --json document's keys and exit codes. The os dev d-key paragraph and the publish-and-preview page say the key gets the same question. Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX Contract reviewServed-tier: Inputs read: card #30887 body and all 9 comments (triage 6682243833 and 6730630146, unblock 6687606585, correction 6692857869, claim 6730849128, blocked report 6730875603, scope-split amendment 6730885888, dev report 6731530772, declaration amendment 6731543957); PR #31776 body and file list (8 files, +812 / −145); the net diff Gate verdicts (check-runs on the head, 03:33Z): 24 success, 0 failure, the rest skipped by their filters. Still running (9): ① Derived judgmentsThe changes to the accept set and the public surface, each judged:
Findings:
② Semver level
③ Boundary flags
Implemented-by: VERDICT: PASS |
Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmNyKKDzf9hWGt2cQYb Co-authored-by: Claude <noreply@anthropic.com>
|
domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX ACCEPT · PR #31776 · Part of #30887 (self-hosted half) · 2026-11-09T04:34ZHead-sha:
|
⛔ merge queue 构建失败 — 先分诊,再决定要不要重排队列构建 42562721779 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集), 分类: 失败的 job(日志抽取,best effort):
跨 PR 相同签名(24h,按失败测试文件聚合):
历史信号:
分诊清单:
Generated by Claude Code · merge-queue-triage workflow (#4859) |
Requested by Steve · project thread
Part of #30887
Clause-②: yes (widening)
Metadata-protocol: none
This is the self-hosted half only, per the seat's ruling B on the card. The ObjectOS Cloud half (
os deployto a cloud environment, andos package publish --install --confirm-upgrade) waits for the cloud plan door's shape (cloud#3654) to be read onto the card, and this PR leaves that path untouched. The card stays open for it.Clause-② is
yes (widening), not the claim'sno:os deploygains two published flags (--dry-run,--json) and a terminal question. Nothing that was accepted before is refused. The two new flags are refused on the ObjectOS Cloud target, where they did not exist before. Metadata-protocol isnone, so the changeset ispatch.维护者速读
os deploy新增--dry-run(只看计划、不安装)和--json(计划、结果、拒绝原因合成一份 JSON,被拒时非零退出);在终端上遇到没声明的改名或有风险的改类型,会直接问一句「仍要部署吗」,os dev里按d也一样。packages/cli/src/commands/deploy.ts(deployToRuntime里的提问与--json文档),packages/cli/src/utils/upgrade-plan.ts(共用的计划打印与预判),packages/cli/test/deploy.test.ts(新加的 The deploy command andos package publish --installshow the upgrade plan before installing — declared renames printed, undeclared renames and type changes stopped until--confirm-upgrade(epic cloud#3652 Q3) #30887 用例)。pnpm --filter @objectstack/cli exec vitest run --project unit test/deploy.test.ts,预期 47 条全过。What changes
packages/cli/src/utils/upgrade-plan.ts(new): one printer for the plan and the Q3 refusal.renderUpgradePlanmoved here frominstall.tsverbatim;install.tsstill exports it. New beside it:readSchemaUpgradeRefusalreads aSCHEMA_UPGRADE_CONFIRMATION_REQUIREDenvelope into its findings and token. The code constant is imported from@objectstack/metadata-core(PR feat(metadata-core): export the schema upgrade verdict and its finding set token, so a host's install door forwards the platform's own verdict #31529), not re-spelled.renderSchemaUpgradeRefusalholds the refusal linesinstall.tsprinted inline, unchanged in wording.previewSchemaUpgradeStopruns the framework's ownschemaUpgradeVerdicton the plan a dry run answered, to say whether the install would stop. It is a preview, never a token: the door judges again on its own reading of the installed version, and only its refusal carries the token.{ plan, environment }), so a hosted door that answers the same reading can hand it to the same printer later.os package installsetsoutcomeon a refusal too:kind: 'refused'with the status, code, message and details verbatim, plus the read Q3 refusal. The dry-run outcome now carries the plan reading andinstalledRecordUnreadable. Printing is unchanged.os deploy, self-hosted runtime target (deployToRuntime):--dry-run: build, dry run, plan printed, then whether the install would stop and on what. Nothing is installed; exit 0.Deploy anyway, accepting each finding as listed? [y/N]. Yes sends the same install again with the refusal's own finding-set token (confirmSchemaUpgrade). Anything else printsNothing was deployedand exits 1. Only the Q3 stop asks: the access-upgrade and global-uniques stops print their retry as before. Off a terminal, or under--json, nothing is asked.--json:reserveStdoutForJsonsends every human line to stderr, and the build child's stdout goes to stderr (compileForDeploy's newstdoutToStderr). One document reaches stdout:target,url,result(planned,installed,refused,failed),package,plan,environment,wouldStop,refusal(verbatim),confirm(os deploy --confirm-upgrade TOKENwhen the refusal is Q3),error. A refusal or a failure exits 1.deployToRuntime, so the command asks, writes the document and exits once. Exit codes are unchanged for every path that existed.os deploy, ObjectOS Cloud target:--dry-runand--jsonare refused by name before anything is built or sent, the same way the three confirmations already are. Under--jsonthe refusal is itself the document. Nothing else on that path changed.dkey inos devis unchanged. It already hands the terminal back (raw mode off) while its childos deployruns, so the child's question reads a cooked terminal. A pin below holds that.--renameflag (ruling D3). The refusal's first way forward is stillrenamedFromon the new field.content/docs/deployment/cli.mdxgains--dry-runand--jsonrows in theos deployflag table; "To a self-hosted runtime" says what the dry run prints, when the install asksDeploy anyway?on a terminal and what each answer does, and a table lists the--jsonkeys and exit codes; theos devd-key paragraph says the key gets the same question.content/docs/deployment/publish-and-preview.mdxsays the same in one sentence. No release notes or CHANGELOG touched.refusedvariantPackageInstall.outcomegains, for code that runs the install command in-process.Tests
New pins in the existing shared harnesses, as top-level cases (no new test file):
packages/cli/test/deploy.test.ts, in the self-hosted describe:renamedFromhint, the retry with the token, exit 1, no question, no confirmed install;[null, null, 'schema-upgrade:abc']across the three calls);--dry-runsends only the dry run and says what would stop; a clean plan says it installs as it is;--json: refused, planned and installed each give one parseable document; never asked under--json; the build is told to keep stdout clean;--dry-runand--jsonrefused on the ObjectOS Cloud target before anything is built or sent;dkey on a plan with an undeclared rename: the question is asked on a cooked terminal, declining deploys nothing, and the key listens again.packages/cli/test/package-install-dry-run.test.ts: the refusal reader (the Q3 code with a token, nothing else), and the preview (a suspected rename and aneeds_confirmtype change ask; a declared rename, a removal and asafechange do not; an unreadable installed record previews its one finding; an unreadable plan previews nothing, never "nothing to confirm").compileForDeploymock forwards its options only when given, so the existing one-argument assertions stand unchanged.Acceptance notes
os package publish --install --confirm-upgrade, and the Expected-1 "permission widening" group on the cloud path. The self-hosted path shows permission findings as the access-upgrade stop, as before.os deployon a terminal, not only under thedkey. The key runs exactly the command a developer would type (the designutils/dev-deploy-key.tsstates), so one deploy path asks in both. Off a terminal, behaviour is as before.content/docspages that documentos deployflags or thedkey, and ruled the docs into this PR (OQ2). They are in the docs commit; nothing is left for the seat.connect-mcp.mdxmentionsos deployonly for how it picks an environment, so it is unchanged.Verification
Head
bbeb6018adds two prose-only commits on top of4a7dafdb(the docs, and one changeset sentence); no.tsfile changed. Onbbeb6018,node scripts/pm/dispatch-gates.mjs --commandsderives 97 commands (the docs pages add the doc families): all run, all exit 0;--ranreconciliation: 97 derived, 97 run, 0 NOT-MEASURED, 0 UNRUN. Everything below was measured on4a7dafdb(after mergingorigin/mainf65c36fc), in a card worktree.Typecheck, unit tier, lint
pnpm --filter '@objectstack/cli^...' build: exit 0.pnpm --filter @objectstack/cli typecheck: exit 0.pnpm --filter @objectstack/cli exec vitest run --project unit: 405 of 407 files passed at first. The other two (published-subpath-console.pin,published-subpath-hook-body.pin) need the CLI's owndistand refused for that reason. Afterpnpm --filter @objectstack/cli buildthey pass (2 files, 29 tests). Total: 407 of 407 files.test/deploy.test.ts,test/package-install-dry-run.test.ts,test/dev-deploy-key.test.ts: 3 files, 68 tests passed.--no-inline-config) on the 7 changed source and test files: exit 0.Ablations (each negative pin turned red, then restored; git diff HEAD empty after each)
All mutations went through
scripts/ablation-replace.mjs(the anchor hit once, the blob moved). The tests importsrcdirectly, so no rebuild was needed.askYesNocalled once).d-key case red (exit undefined, not 1).install.ts's outcome) → "only the Q3 stop asks" red. A first attempt, which dropped the guard indeploy.ts, stayed green because the missing token threw before the question. It was replaced by this mutation and is declared here.--json→ "ONE document" red ("never asked under --json").--dry-runfalls through to the install → "--dry-run … installs nothing" red.Derived gates
node scripts/pm/dispatch-gates.mjs --commandson4a7dafdb: 66 commands, all run, all exit 0.--ranreconciliation: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN.check-plugin-teardown-shape --self-testfirst exited 3 because the pinned fixture commit was not in the clone; after fetching it, it exits 0 (48 cases). The examples were built first forcheck:i18n-coverage.Generated by Claude Code