Skip to content

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

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-j80vj4
Nov 9, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/project-thread-j80vj4

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

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 deploy to a cloud environment, and os 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's no: os deploy gains 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 is none, so the changeset is patch.

维护者速读

  • 改了什么:部署到自托管运行时时,os deploy 新增 --dry-run(只看计划、不安装)和 --json(计划、结果、拒绝原因合成一份 JSON,被拒时非零退出);在终端上遇到没声明的改名或有风险的改类型,会直接问一句「仍要部署吗」,os dev 里按 d 也一样。
  • 为什么改:按 Q3「默认拒绝,需显式映射」,开发者部署前应先看到升级计划;以前被拒后只能复制令牌重跑,现在可以当场确认。
  • 风险与回滚:只动 CLI,云端部署路径一行未改;只有新增和已声明改名时照旧不打扰;回滚即还原本 PR。
  • 先看:packages/cli/src/commands/deploy.ts(deployToRuntime 里的提问与 --json 文档),packages/cli/src/utils/upgrade-plan.ts(共用的计划打印与预判),packages/cli/test/deploy.test.ts(新加的 The deploy command and os package publish --install show 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. renderUpgradePlan moved here from install.ts verbatim; install.ts still exports it. New beside it:
    • readSchemaUpgradeRefusal reads a SCHEMA_UPGRADE_CONFIRMATION_REQUIRED envelope 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.
    • renderSchemaUpgradeRefusal holds the refusal lines install.ts printed inline, unchanged in wording.
    • previewSchemaUpgradeStop runs the framework's own schemaUpgradeVerdict on 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.
    • The input is the plan reading ({ plan, environment }), so a hosted door that answers the same reading can hand it to the same printer later.
  • os package install sets outcome on 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 and installedRecordUnreadable. 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.
    • On a terminal (stdin and stdout both TTY), a Q3 refusal is followed by 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 prints Nothing was deployed and 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: reserveStdoutForJson sends every human line to stderr, and the build child's stdout goes to stderr (compileForDeploy's new stdoutToStderr). One document reaches stdout: target, url, result (planned, installed, refused, failed), package, plan, environment, wouldStop, refusal (verbatim), confirm (os deploy --confirm-upgrade TOKEN when the refusal is Q3), error. A refusal or a failure exits 1.
    • The embedded install's own exit is now caught inside 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-run and --json are refused by name before anything is built or sent, the same way the three confirmations already are. Under --json the refusal is itself the document. Nothing else on that path changed.
  • The d key in os dev is unchanged. It already hands the terminal back (raw mode off) while its child os deploy runs, so the child's question reads a cooked terminal. A pin below holds that.
  • ⛔ No --rename flag (ruling D3). The refusal's first way forward is still renamedFrom on the new field.
  • Docs (the seat's OQ2: in this PR): content/docs/deployment/cli.mdx gains --dry-run and --json rows in the os deploy flag table; "To a self-hosted runtime" says 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 keys and exit codes; the os dev d-key paragraph says the key gets the same question. content/docs/deployment/publish-and-preview.mdx says the same in one sentence. No release notes or CHANGELOG touched.
  • Changeset: besides the user-facing bullets, it names the refused variant PackageInstall.outcome gains, 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:
    • additions plus a declared rename install with no question, even on a terminal, and the rename is printed;
    • an undeclared suspected rename stops off a terminal: the plan, the renamedFrom hint, the retry with the token, exit 1, no question, no confirmed install;
    • on a terminal, yes installs with the refusal's own token in the request body ([null, null, 'schema-upgrade:abc'] across the three calls);
    • on a terminal, no deploys nothing: exit 1, no third call;
    • only the Q3 stop asks (an access-upgrade refusal asks nothing);
    • --dry-run sends 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-run and --json refused on the ObjectOS Cloud target before anything is built or sent;
    • the d key 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 a needs_confirm type change ask; a declared rename, a removal and a safe change do not; an unreadable installed record previews its one finding; an unreadable plan previews nothing, never "nothing to confirm").
  • Forced test edits: none. The compileForDeploy mock forwards its options only when given, so the existing one-argument assertions stand unchanged.

Acceptance notes

  • Not built here (the card's cloud half): reading cloud's plan door before a cloud deploy, 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.
  • The terminal question also appears for a typed os deploy on a terminal, not only under the d key. The key runs exactly the command a developer would type (the design utils/dev-deploy-key.ts states), so one deploy path asks in both. Off a terminal, behaviour is as before.
  • Docs: the seat widened the file surface to the hand-written content/docs pages that document os deploy flags or the d key, and ruled the docs into this PR (OQ2). They are in the docs commit; nothing is left for the seat. connect-mcp.mdx mentions os deploy only for how it picks an environment, so it is unchanged.
  • The dry-run preview and the install's verdict can differ in one case: an orphaned install (no ledger entry, registry body present) is compared by the door against the registry body, and by the dry run against no installed version. The install's refusal is the authority either way; the preview never carries a token.

Verification

Head bbeb6018 adds two prose-only commits on top of 4a7dafdb (the docs, and one changeset sentence); no .ts file changed. On bbeb6018, node scripts/pm/dispatch-gates.mjs --commands derives 97 commands (the docs pages add the doc families): all run, all exit 0; --ran reconciliation: 97 derived, 97 run, 0 NOT-MEASURED, 0 UNRUN. Everything below was measured on 4a7dafdb (after merging origin/main f65c36fc), in a card worktree.

Typecheck, unit tier, lint
  • Dependency closure 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 own dist and refused for that reason. After pnpm --filter @objectstack/cli build they pass (2 files, 29 tests). Total: 407 of 407 files.
  • Targeted: test/deploy.test.ts, test/package-install-dry-run.test.ts, test/dev-deploy-key.test.ts: 3 files, 68 tests passed.
  • Lint (root eslint, --no-inline-config) on the 7 changed source and test files: exit 0.
  • Integration tier: not run locally. No integration-tier file or spawn entry is touched; CI runs it.
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 import src directly, so no rebuild was needed.

  • A: ask before every install on a terminal → "installs without a question" red (askYesNo called once).
  • B: drop the terminal check → "stops before any write off a terminal" red.
  • C: a declined question still installs → "declining deploys nothing" and the d-key case red (exit undefined, not 1).
  • D: every refusal treated as Q3 (in install.ts's outcome) → "only the Q3 stop asks" red. A first attempt, which dropped the guard in deploy.ts, stayed green because the missing token threw before the question. It was replaced by this mutation and is declared here.
  • E: ask under --json → "ONE document" red ("never asked under --json").
  • F: --dry-run falls through to the install → "--dry-run … installs nothing" red.
  • G: the cloud loop reads only the confirmations → both cloud refusals red (one call sent).
  • H: a tokenless refusal read as Q3 → "reads a Q3 refusal" red.
  • I: an unreadable plan previewed as empty → "never nothing to confirm" red.
Derived gates

node scripts/pm/dispatch-gates.mjs --commands on 4a7dafdb: 66 commands, all run, all exit 0. --ran reconciliation: 66 derived, 66 run, 0 NOT-MEASURED, 0 UNRUN. check-plugin-teardown-shape --self-test first 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 for check:i18n-coverage.


Generated by Claude Code

@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 1 package(s): @objectstack/cli, touching 27 documentable anchor(s).

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

  • content/docs/ai/connect-mcp.mdx (via os deploy (command, read off packages/cli/src/commands/deploy.ts))
  • content/docs/automation/connectors.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/automation/jobs.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/data-modeling/external-datasources.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/data-modeling/seed-data.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/app-dependencies.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/cli.mdx (via wouldStop (symbol, a field of interface DeployDocument), os deploy (command, read off packages/cli/src/commands/deploy.ts), os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/cloud-connection.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/install-modes.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/marketplace-handbook.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/deployment/publish-and-preview.mdx (via os deploy (command, read off packages/cli/src/commands/deploy.ts), os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/protocol/kernel/index.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/protocol/kernel/lifecycle.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/protocol/kernel/metadata-service.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/protocol/kernel/plugin-spec.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))

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

  • content/docs/releases/v17/17-0.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/releases/v17/17-6.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/releases/v17/17-7.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/releases/v18/18-1.mdx (via findingSet (symbol, a field of interface SchemaUpgradeRefusal), os package install (command, read off packages/cli/src/commands/package/install.ts))
  • content/docs/releases/v18/18-3.mdx (via os package install (command, read off packages/cli/src/commands/package/install.ts))

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
  • 11 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 — 35 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 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91 → packageMentionDocs.

Which tree this was computed on

This run read content/docs from c15da9dfa23a955ebc36111eb461b6a004375eb0 — the merge of head 785490fcb427e65e1cf3ad4758f6fb955ca9677c into base 8dbb4a12af108f64fbc4c35b08c95af5f3e50c91, 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 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

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

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

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>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 4a7dafdbaed2e2a25b6b3a34f8d1a4f11a099e75
Local-runs: none

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 f65c36fc..4a7dafdb (merge-base with origin/main is f65c36fc); the check-runs on the head, read 2026-11-09T03:33Z. Code outside the diff was read, not run: utils/json-stdout.ts, utils/dev-deploy-key.ts, cloud-connection/src/marketplace-install-local-plugin.ts (the door's Q3 gate), packages/cli/package.json (exports, dependencies), packages/cli/src/index.ts, scripts/pm/clause2-line.mjs.

Gate verdicts (check-runs on the head, 03:33Z): 24 success, 0 failure, the rest skipped by their filters. Still running (9): Test Core shards 1, 2, 3, 4, 5, 6 and 8 of 8, Lint · repo & tooling gates, Lint · scoped · query-options erasure. Green already: Type Check · workspace, Type Check · source gates, Type Check · consumer gates, TypeScript Type Check, Lint · ESLint, Lint · PM dispatch-gates, Check Changeset, PR-body guards, Governed Surface Queue Guard, Build Core, Test Core (7/8), Dogfood Regression Gate, Live E2E UI, Flag docs affected by code changes. This verdict is on the contract. Landing still needs every check green.

① Derived judgments

The changes to the accept set and the public surface, each judged:

  1. os deploy --dry-run (new boolean flag, default false). Named right. On a self-hosted runtime target it builds, sends only --dry-run to the embedded install, prints the plan through the shared printer, prints the previewSchemaUpgradeStop preview, and exits 0 with result: planned. if (mode.dryRun) … finish(0, …); return; comes before the first non-dry install, and the test "--dry-run builds, prints the plan and what would stop, and installs nothing" pins it: sent has length 1. The preview runs the framework's own schemaUpgradeVerdict (metadata-core package-upgrade-verdict.ts:128) and never mints a token. An unreadable plan previews undefined, so wouldStop: null is never taken for "nothing to confirm". One write remains: the local build artifact dist/objectstack.json. The changeset ("builds, prints the plan and installs nothing") and the flag help both say so. The card's "writes nothing" reads as nothing sent to the environment, and that holds.
  2. os deploy --json (new boolean flag). Named right. reserveStdoutForJson() is taken before printHeader. It patches process.stdout.write, so console.log, the embedded install's lines and the printer all go to stderr (json-stdout.ts docblock). The build child is a separate process writing to fd 1, and compileForDeploy(…, { stdoutToStderr: true }) gives it stdio ['inherit', 2, 'inherit'], so its stdout goes to stderr too. The only stdout write is emitJson, through writeStdoutDirect. Every exit path emits once:
    • finish() emits and then calls this.exit when the code is non-zero. The resulting ExitSignal is rethrown by run()'s catch without a second emit.
    • The cloud-target refusal emits and then exits.
    • The generic catch emits only for a non-exit error.
    • releaseStdout runs in finally.
      One document, progress on stderr. The refused, planned and installed tests each JSON.parse(stdout) the whole stream.
  3. The --json document's keys. Named right, and accepted by the seat (OQ3, 6731543957). DeployDocument has target (runtime or cloud), url, result (planned, installed, refused, failed), package (manifestId, version, installedVersion), plan, environment, wouldStop, refusal (status, code, message, details, verbatim from the envelope), confirm and error. deployDocument() fills every key, with null for what is unknown, so the shape is fixed on every path. These are the keys the changeset lists and the seat accepted.
  4. The TTY confirmation for deploy. Named right on each point the brief asks about.
    • Nothing is written before the confirmation. The order is dry run (no write), then the install with the caller's confirmations, then the door's Q3 gate. The gate refuses with 409 SCHEMA_UPGRADE_CONFIRMATION_REQUIRED before any write ("Nothing was installed or written", marketplace-install-local-plugin.ts evaluateSchemaUpgradeGate). The question is asked only after that refusal.
    • The "yes" path re-sends with the refusal's own token only. token = run.outcome.schemaUpgrade.findingSet comes from readSchemaUpgradeRefusal(res.body), and the re-send is [...withoutFlag(confirmations, 'confirm-upgrade'), '--confirm-upgrade', token]. Any stale --confirm-upgrade the caller passed is dropped, and the access-upgrade and global-uniques confirmations the caller passed are kept as they were. The test pins the request bodies across the three calls as [null, null, 'schema-upgrade:abc']. The question is asked once only: a second refusal (the findings changed) goes to finish(1) and no loop follows.
    • Decline: Nothing was deployed, exit 1, no third call. Pinned.
    • Only the Q3 stop asks. The guard is run.stopped && kind === 'refused' && schemaUpgrade. The access-upgrade refusal case is pinned.
    • Off a TTY, nothing prompts. canAskOnTerminal() needs both stdin.isTTY and stdout.isTTY, and the guard adds !mode.json. --dry-run returns before any install, so it cannot ask. Pinned by "stops before any write off a terminal" and "never asked under --json".
    • A plan with only additions and declared renames gets no question, even on a TTY. The door does not refuse it. Pinned.
  5. The d key. Named right; utils/dev-deploy-key.ts is unchanged. Before the child runs, the key turns raw mode off, removes its data listener and pauses stdin (:101-105). It then spawns os deploy with stdio: 'inherit', so the child's readline reads a cooked TTY and the parent does not compete for the line. The os dev test drives the question through attachDeployKey and pins that declining deploys nothing and that the key listens again.
  6. The shared printer, utils/upgrade-plan.ts. Named right. renderUpgradePlan moved verbatim: the removed and added bodies match line for line. install.ts still exports it by name. renderSchemaUpgradeRefusal keeps the old inline wording. The leading blank line, the bullets, the renamedFrom hint (only for field findings), the confirm line and both headlines are identical, so os package install's output does not change. readSchemaUpgradeRefusal imports the code constant from @objectstack/metadata-core, which is already a runtime dependencies entry of @objectstack/cli (package.json:74), rather than spelling it again. It reads a refusal without a token as no Q3 refusal.
  7. --dry-run and --json refused on the ObjectOS Cloud target. Named right, and not a narrowing. RUNTIME_ONLY_FLAGS extends the existing confirmation loop. The refusal happens before any build or send (both cloud tests pin compileForDeploy and the network as untouched). Under --json the refusal is itself the document. Deploy declares neither strict = false nor enableJsonFlag, so on main these flags were already rejected as nonexistent. Nothing accepted before is refused now.
  8. The cloud path is untouched. Named right; the hosted half stays held (6730885888). With neither new flag set, the cloud branch runs byte-for-byte as before: releaseStdout is undefined and the catch's --json emit is skipped. publish.ts is not in the file list. Not built here, as the PR's acceptance notes say: the cloud plan read, os package publish --install --confirm-upgrade, and Expected-1's "permission widening" group on the cloud path.
  9. install.ts. Named right; the change is on the published type graph. @objectstack/cli's . entry re-exports PackageInstallCommand (src/index.ts:57), whose public outcome: PackageInstallOutcome | undefined is therefore published. Three things change. The union gains a refused variant (status, code, message, details, and the optional schemaUpgrade). The dry-run variant gains plan, environment and installedRecordUnreadable. outcome is now set on any non-2xx answer that has a status; status 0, meaning no answer, stays unset. Before, it was "unset until the runtime answered 2xx". Printing and exit codes are unchanged. No input is refused, so this is a widening of the public surface, and the PR body names it under "What changes". See nit N1.
  10. Exit codes. Named right. Refusal and failure give 1 on every new path: build failure, a dry run that was not answered or was refused, a refused or declined install, an install that is not a managed install, and hotLoaded: false. Dry run and a live install give 0. Exit codes on the paths that already existed are unchanged: the embedded install's exit is caught and replaced by a single this.exit(1).
  11. ⛔ No --rename flag. Held (D3). The refusal's first way forward is still renamedFrom.

Findings:

  • must-fix: none.
  • should-fix: none.
  • nit N1. The changeset does not name the PackageInstallCommand.outcome change. That change is the new refused variant, and the fact that outcome is now set on a refusal. The class is reachable from the . export, and a consumer with an exhaustive switch on kind, or one that reads "outcome set" as "answered 2xx", sees a different shape. The PR body names it. One line in the changeset would put it on the release page. It does not change the arm (see ②).
  • nit N2. The --json document's confirm is os deploy --confirm-upgrade TOKEN only. It drops the other confirmations the run passed, for example --confirm-access-upgrade, so a script that runs it as written can be refused again on the access stop. This matches the human retry line on main, so it is not a regression. A follow-up could build confirm from withoutFlag(confirmations, 'confirm-upgrade') plus the token.
  • nit N3. The generic catch in run() emits a fresh document labelled target: 'runtime'. A non-exit error thrown before the target is known (activeRuntimeTarget() throws), or one thrown after the plan was read, gives a document without url, package or plan. Its comment, "Only a self-hosted target reaches here", is true for target selection only. The result stays one document with a non-zero exit, so the contract holds.
  • nit N4 (prose surface only). The docs that OQ2 ruled into this PR (content/docs/deployment/cli.mdx, plus any hand-written content/docs/** page that documents os deploy or the d key) are not in the diff at this head. The PR body's acceptance note "left for the seat" is stale since 6731543957. Both are prose surfaces. Under the head-move exception (「head 后移例外」, contract-review.md), a head move that touches only prose surfaces keeps this record in force, with a Regen-provenance: line. The seat's ACCEPT checks the docs sentence by sentence against ① items 1 to 5 and 7, the --json keys included.

② Semver level

  • Changeset: .changeset/30887-deploy-upgrade-plan.md sets '@objectstack/cli': patch. It is the only package the diff touches. Its body carries Clause-②: yes (widening) and Metadata-protocol: none, and the PR body carries the same two lines. Check Changeset passed on the head.
  • Clause-② line, judged against scripts/pm/clause2-line.mjs:
    • yes (widening) is a legal declaration. The value is in CLAUSE2_VALUES and the arm is in CLAUSE2_ARMS, spelled exactly.
    • It is also the correct one. os deploy gains two published flags, a stdout document with named keys, and a terminal question. PackageInstallCommand.outcome gains a variant (① item 9). That widens the public surface.
    • No arm of (narrowing) is owed. Nothing that was accepted before is refused: the cloud-target refusals cover flags that did not exist, and every existing exit code is kept.
    • It supersedes the card's and the claim's no through the declaration amendment 6731543957. The dev's deviation asked for exactly that.
  • Level: under ruling A on changeset levels: minor only when the metadata protocol changes (added / narrowed / semantic), patch otherwise; release notes grouped by what the reader must do (maintainer ruling A, 2026-10-21) #25105, the changeset level follows the Metadata-protocol: line only. none means patch, even with a widening Clause-②. No spec key, schema, error code or metadata-protocol surface is in the diff, and the file list has no packages/spec/**. Metadata-protocol: none is correct, so patch is correct.

③ Boundary flags

  • Dev report 6730875603.
    • OQ "hosted shape" was answered by the seat's ruling B (6730885888). The cloud half is held, and the five readings were asked of the repo:cloud seat. Those readings are still open on the card, which is why the PR says Part of #30887 and not Fixes (PR-body guards passed).
    • OQ "Clause-② for the new flags" was answered by 6731543957: yes (widening).
  • Dev report 6731530772, deviations.
    • (1) Clause-② yes (widening): adopted by the seat (6731543957), and correct per ②.
    • (2) Scope is ruling B: matches the diff, since publish.ts and the cloud branch are untouched apart from the flag refusal.
    • (3) The replacement of ablation D and (4) the dist prerequisite for two pins are disclosures about verification, not contract.
    • These are the dev's own runs and not inputs to this verdict. The verdict rests on the diff and the head's check-runs.
  • Dev report 6731530772, open questions.
    • OQ1 (a typed os deploy on a TTY asks too): ruled A, keep. The diff matches: one deploy path, and off a TTY nothing is asked. A pseudo-TTY harness that used to see exit 1 straight away now waits on the question. That follows from the ruling, and an empty answer is still "no".
    • OQ2 (docs): ruled add to this PR. The docs commit is pending at this head (nit N4). It is prose surface, and the ACCEPT checks it.
    • OQ3 (--json names): ruled A, accepted as listed. The diff matches the list exactly (① item 3).
  • File surface. The claim covers commands/**, src/** helpers, tests and .changeset/30887-*.md, and as amended content/docs/** for os deploy (release pages and CHANGELOG excluded). All 8 files fall inside it. install.ts changes only for the shared printer and the refusal outcome that carries the token, as the claim allows. Governed Surface Queue Guard passed, and no governed path is in the file list.
  • Security and out of scope: none in either report, and none found here.
  • Author: the PR's user.login is objectstack-fleet[bot], so no author login needs naming.
  • Still open on the card, beyond this PR: the hosted half (the cloud plan read, os package publish --install --confirm-upgrade, permission widening on the cloud path). It waits for the five repo:cloud readings (6730885888).

Implemented-by: claude/project-thread-j80vj4
Reviewed-by: session_01ADHkmP8JJo4zF2sjTBRwnX

VERDICT: PASS

@github-actions github-actions Bot added size/xl and removed size/l labels Nov 9, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#4 · os-steve · session_01ADHkmP8JJo4zF2sjTBRwnX

ACCEPT · PR #31776 · Part of #30887 (self-hosted half) · 2026-11-09T04:34Z

Head-sha: 785490fcb427e65e1cf3ad4758f6fb955ca9677c

  • Regen-provenance: 6731620957 · 4a7dafd → bbeb601 · git diff --stat 4a7dafdb bbeb6018 -- . ':!*.md' ':!*.mdx' → (empty)
  • Contract review: PASS at TIER_DEFAULT (declaration face) on 4a7dafdb, record 6731620957. It has no must-fix and no should-fix. The head moved only on prose faces, so the record stays in force via the line above. The prose was read here sentence by sentence.
    • N1 closed: the changeset now names the refused variant that PackageInstall.outcome gains. The class is PackageInstall (install.ts:142), and the sentence spells it that way.
    • N4 closed: the docs are in this PR, and the PR body is refreshed. The seat sent the body, signed by trailer.
    • N2 and N3 are left as nits. N2: the confirm command drops the other confirmations, the same as the human retry line on main. N3: the generic error document has target: runtime.
  • Docs read against the code at this head:
    • cli.mdx, the os deploy flag table: the --dry-run and --json rows say both flags are self-hosted only and refused on Cloud. Under --json, the refused document is target: cloud, result: failed. That matches deploy.ts:280.
    • "To a self-hosted runtime", step 2: --dry-run stops with exit 0 and states whether the install would stop. That matches previewSchemaUpgradeStop and finish(0).
    • Step 3: a plan of only additions and declared renames installs with no question. On a terminal, the question is Deploy anyway, accepting each finding as listed? [y/N]. Yes re-sends with the refusal's own token, and anything else exits 1. Only the schema stop asks. That matches the diff and the pins.
    • The --json key table matches DeployDocument (deploy.ts:142-153) and OQ3. wouldStop is [] or null as the preview returns it.
    • The d-key paragraph links #to-a-self-hosted-runtime, and that heading exists (cli.mdx:3264). publish-and-preview.mdx adds one sentence, which is consistent.
    • No content/docs/releases/** or CHANGELOG.md is touched.
  • Main merge: 785490fc merges bbeb6018 (all green: 40 passed, 16 skipped) with main 8dbb4a12. It had no conflicts. The net +/- lines against the merge base are byte-identical to bbeb6018's (sha256 b16af1d5…).
  • Declarations: Clause-②: yes (widening), Metadata-protocol: none, and @objectstack/cli patch, per ruling A on changeset levels: minor only when the metadata protocol changes (added / narrowed / semantic), patch otherwise; release notes grouped by what the reader must do (maintainer ruling A, 2026-10-21) #25105. Claim 6730849128, amended by 6730885888 (scope split) and 6731543957 (declaration and docs surface), covers all 10 files.
  • Gates on this head: every check-run is success (38) or skipped (14), with none in progress. check-governed-merges --pr 31776: not governed, +868/-158. K = 10 (under 15), and mergeable_state is clean.
  • Landing: pr_ready and automerge_enable happen in this stroke. The deploy command and os package publish --install show the upgrade plan before installing — declared renames printed, undeclared renames and type changes stopped until --confirm-upgrade (epic cloud#3652 Q3) #30887 stays open for the hosted half, which waits on the five repo:cloud readings (6730885888).

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 9, 2026 04:35
@objectstack-fleet
objectstack-fleet Bot enabled auto-merge November 9, 2026 04:35
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 9, 2026
@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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

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

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

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

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/admin-platform-admin-standing.dogfood.test.ts > #9482: what an ObjectStack platform admin gets from every /admin/ route > no /admin/ route refuses the
      ↳ 失败原因: @objectstack/dogfood:test: AssertionError: the stack serves /admin/ route(s) this file neither admits, refuses-by-design, nor classifies as answering for a non-authorization reason. A new admin route 
    

↳ 失败原因 是判读的关键:超时(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,按失败测试文件聚合):

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

历史信号:

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

分诊清单:

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

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

Merged via the queue into main with commit 5f26be2 Nov 9, 2026
53 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-j80vj4 branch November 9, 2026 05:08
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/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant