Skip to content

feat(cli): os deploy and os package publish --install stop on the hosted schema upgrade refusal and take --confirm-upgrade (#30887) - #39286

Merged
objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-30887-hosted-plan
Dec 3, 2026
Merged

objectstack-fleet[bot] merged 7 commits into
mainfrom
claude/issue-30887-hosted-plan

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Part of #30887

The remaining items (the full plan before install, declared renames in the result, os deploy --dry-run on cloud) wait on objectstack-ai/cloud#5409, the dry run on cloud's publish install arm (PM ruling, claim amendment 7372140636).

Clause-②: yes (widening)
Metadata-protocol: none

维护者速读

  • 开发者用部署命令(含开发模式里按 d 键)或带安装的发布命令把软件包装进云端环境时:只新增字段或已声明改名的照常直接装;遇到没声明的改名或改类型,会先停下、列出每一项发现,并给出两条路(在新字段上声明旧字段名再部署,或确认后放行),提示的确认命令会写明被拦下的那个环境,且从不打印密钥。
  • 这是“受管软件包开发循环”这个大目标里云端那一半:按维护者“默认拒绝,需显式映射”的裁决,避免一次部署悄悄把客户的数据留在旧列里。
  • 出错时最多是一次本该放行的部署被拦下(可用确认参数放行),或一次本该拦下的被放行(云端的安装检查仍会拒绝,本改动只是把拒绝说清楚);只改命令行输出和参数,回退即可撤回。
  • 要你做:无;部署前预览完整变更清单要等云端那张“发布安装先试运行、什么都不存”的卡(objectstack-ai/cloud#5409)做完后再补。

What changes

The hosted half of #30887, built against the five cloud readings posted on the card (comment 7370246763, cloud origin/main 19dbb424925b).

  • os package publish --install reads the control plane's Q3 refusal (409 SCHEMA_UPGRADE_CONFIRMATION_REQUIRED, details.findings / details.findingSet) and prints it through the shared printer: each finding, then both ways forward (renamedFrom on the new field, or the same command with --confirm-upgrade TOKEN). Exit 1. The control plane stores no version for a refused install (reading 5), so the text says nothing was published.
  • New flag --confirm-upgrade TOKEN on os package publish, sent as confirm_schema_upgrade (reading 3). It requires --install, and without it the command refuses before any request. The card's Expected 4 rules this flag.
  • os deploy on the ObjectOS Cloud target now accepts --confirm-upgrade and --json. On a terminal, the Q3 stop asks the same question as the self-hosted path, and a yes re-sends the same version with the refusal's token. --json emits the ruled document with target: cloud, and plan and environment stay null because the hosted refusal carries no plan (reading 4). The cloud path moved into deployToCloud, unchanged apart from these points.
  • os deploy --dry-run stays refused on the cloud target, before anything is built or sent. The message now says why: the hosted preview (GET /api/v1/cloud/packages/:id/upgrade-plan) reads only a stored version, and a deploy always publishes a new one (readings 1 and 2).
  • New module packages/cli/src/utils/publish-confirm-upgrade.ts, because publish.ts is over 1,000 lines. The shared renderSchemaUpgradeRefusal gains an optional judge word ("the control plane" vs "the runtime").
  • Docs: content/docs/deployment/cli.mdx (os deploy flags, the cloud stop and the --json keys; os package publish --confirm-upgrade and its example).

Not built, and why this says Part of: the hosted door does not serve a full plan or a dry run for an unpublished version. So the card's "plan printed before install, grouped by change", "declared renames printed in the result" and a cloud --dry-run are open. The seat ruled A (claim amendment 7372140636): these wait on objectstack-ai/cloud#5409, which is why this PR says Part of.

Read first (riskiest first):

  1. packages/cli/src/commands/deploy.ts, deployToCloud: the question and the re-send (same version, refusal token), and finish under --json.
  2. packages/cli/src/commands/package/publish.ts, the !verRes.ok branch and the --confirm-upgrade guard.
  3. packages/cli/src/utils/publish-confirm-upgrade.ts, retryCommandOf: an allowlist walker over the command's own flag specs. A dropped flag goes with its value, so --token never reaches the printed line, and a stale --confirm-upgrade is replaced. deploy.ts CLOUD_RETRY_FLAGS plus the appended --env ENV pin the refused environment.

Two-minute check: pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 test/deploy.test.ts test/package-publish-error-envelope.test.ts. Expect all green, including the #30887 hosted cases.

Tests

  • test/deploy.test.ts adds a judging control-plane stub. Its refusal is the exact schemaUpgradeConfirmationRefusal shape, with findings and token from the framework's schemaUpgradeVerdict. Cases: no-risk installs with no question and no key; the Q3 stop off a terminal (finding, renamedFrom hint, os deploy --confirm-upgrade TOKEN, exit 1, one POST, no wait); a terminal yes (second POST, same version, token); a terminal decline; --confirm-upgrade on the first POST; a non-Q3 refusal asks nothing; --json refusal and clean documents; --dry-run refused with nothing built or sent. The two old cases that pinned "--confirm-upgrade / --json refused on cloud" were removed, because that behaviour is the one this PR replaces.
  • test/package-publish-error-envelope.test.ts, new describe: the publish stop and its retry line, --confirm-upgrade sending the key, a stale token re-refused with only the current token named, and --confirm-upgrade without --install refused with zero requests.
  • Round 2 (review 7373269516): deploy --env retry and --json confirm name --env env_b and never the --token value; an environment resolved without --env is pinned all the same; a terminal yes re-sends into the same environment; a stale --confirm-upgrade is re-refused and the retry names only the current token; the os dev d key on the cloud target asks and a decline deploys nothing; --json reports target: runtime when reading the deploy target fails; publish never prints the key given as --token KEY, --token=KEY, -t KEY or -tKEY; the builder drops a dropped flag with its value.

Verification

Round 2 readings at head 0171f212e9. Targeted: Tests 96 passed (96). Ablations add B1 (6 red), B2 (5 red), B2-deploy (2 red), B2-arity (7 red) and N2 (1 red), each restored to the HEAD blob. Gates: 102 derived, 102 run, 0 NOT-MEASURED, 0 UNRUN (dual-build-cjs-loads re-ran after its dist prerequisites; query-options-erasure re-ran on a longer bound). CI: 59 check-runs, 42 success, 17 skipped, 0 failure. Round 1 readings follow.

Readings at head f0b2842003 (objectstack-ai/objectstack).

Targeted tests, typecheck, lint
  • pnpm --filter @objectstack/cli exec vitest run --maxWorkers=2 test/deploy.test.ts test/package-publish-error-envelope.test.ts test/package-install-dry-run.test.ts test/dev-deploy-key.test.ts: exit 0, Test Files 4 passed (4), Tests 84 passed (84).
  • pnpm --filter @objectstack/cli typecheck: exit 0 (check:test-typecheck: OK).
  • Root eslint --no-inline-config on the 6 changed source and test files: exit 0.
  • CLI unit project in full: NOT MEASURED, reason: it did not finish inside the container's 10-minute foreground bound under the verify lock (timeout 590 answered 124). CI's Test Core runs it. The integration tier is declared to CI as well.
Ablations (5), each turned its pin red and was restored to the HEAD blob

Each mutation went through scripts/ablation-replace.mjs: anchor hit 1 to 0, blob changed, then restored with blob equal to HEAD and an empty git diff HEAD. Tests import src directly, so there is no build leg.

  • A: drop the confirm_schema_upgrade send in publish.ts. 3 red: publish --confirm-upgrade, deploy terminal yes, deploy --confirm-upgrade.
  • B: ask under --json on the cloud path. 1 red: the --json refusal case.
  • C: the terminal yes re-sends without the token. 1 red: the terminal yes case.
  • D: skip the Q3 branch in publish.ts. 3 red: publish stop, stale token, deploy off-terminal stop.
  • E: accept --dry-run on the cloud target. 2 red: both cloud --dry-run cases.
Gates: dispatch-gates --commands (102 families) and --ran
  • node scripts/pm/dispatch-gates.mjs --commands derived 102 families against merge base f5edfb82d. All 102 exit 0.
  • Seven of them first refused on prerequisites (check:skill-examples, check:dual-build-cjs-loads and the three check:i18n* families exited 3 on an unbuilt CLI, client-react or examples), and check:query-options-erasure outran a 280 s bound. check:cli-examples-parity was a real finding (exit 1): the new publish example was missing from the docs block, fixed in f0b2842003. After the prerequisites were built, all seven re-ran to exit 0.
  • The 27 doc-family gates re-ran on f0b2842003: all exit 0.
  • node scripts/pm/dispatch-gates.mjs --ran: exit 0, 102 derived, 102 run, 0 NOT-MEASURED, 0 UNRUN (a derived zero: every line records its exit code).
  • CI-owned families are read from this PR's check-runs, not re-run locally.

Acceptance notes

  • PackagePublishCommand (published from @objectstack/cli) gains the public members refusal and retryCommand, which os deploy reads in-process. This is the same seam PackageInstall.outcome / retryCommand gave the self-hosted half, and the changeset declares it. When retryCommand is unset, the retry is the run's own arguments without --token or --confirm-upgrade.
  • Clause-② is yes (widening), per the seat's ruling in claim amendment 7372140636, and the changeset carries the same line. The level is patch, because a non-protocol change ships patch (AGENTS.md).
  • A hosted stop's printed retry never contains the API key: it is built from an allowlist of flags. os deploy's retry and its --json confirm always name the environment that refused, because the confirming token names no environment (review 7373269516, B1 and B2).
  • Pre-existing, unchanged (review N3): 'Nothing was published' holds for versions. The package-row upsert runs before the version POST, as it does on main.
  • The docs edit is outside the claim's first file surface and is in the claim amendment. It is there because the old docs said --confirm-upgrade and --json were refused on ObjectOS Cloud, which this PR makes false.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1

@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 Dec 3, 2026
@github-actions

github-actions Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/cli, touching 20 documentable anchor(s).

13 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/api/declarative-endpoints.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/concepts/metadata-lifecycle.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/deployment/cli.mdx (via os deploy (command, read off packages/cli/src/commands/deploy.ts), os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/deployment/index.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/deployment/marketplace-handbook.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/deployment/publish-and-preview.mdx (via os deploy (command, read off packages/cli/src/commands/deploy.ts), os package publish (command, read off packages/cli/src/commands/package/publish.ts), /api/v1/cloud/packages/:id/versions (route, a path literal in a comment on a changed line))
  • content/docs/protocol/kernel/index.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/protocol/kernel/lifecycle.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/protocol/kernel/metadata-service.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/protocol/objectql/index.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/protocol/objectql/schema.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/protocol/objectui/actions.mdx (via confirm_schema_upgrade (literal, a string literal in CONFIRM_UPGRADE_BODY_KEY))

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

  • content/docs/releases/v17/17-5.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/releases/v17/17-6.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.ts))
  • content/docs/releases/v18/18-4.mdx (via os deploy (command, read off packages/cli/src/commands/deploy.ts))
  • content/docs/releases/v9.mdx (via os package publish (command, read off packages/cli/src/commands/package/publish.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
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 71 of 256 client-bound route-ledger rows — the other 185 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 185: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 60 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 125 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 — 41 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 1a66d75c45d2eb969a5353c63358161d1bbdfcd8 → packageMentionDocs.

Which tree this was computed on

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

node scripts/docs-audit/affected-docs.mjs --json 1a66d75c45d2eb969a5353c63358161d1bbdfcd8

⚠️ 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 1a66d75c45d2eb969a5353c63358161d1bbdfcd8 → 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

repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 354d7705242ddb10e5dfc6c248e0b46a7099d78b
Local-runs: none
Scope: .changeset/30887-hosted-upgrade-stop.md, content/docs/deployment/cli.mdx, packages/cli/src/commands/deploy.ts, packages/cli/src/commands/package/publish.ts, packages/cli/src/utils/publish-confirm-upgrade.ts, packages/cli/src/utils/upgrade-plan.ts, packages/cli/test/deploy.test.ts, packages/cli/test/package-publish-error-envelope.test.ts (merge base f5edfb82db) + cited read-only: objectstack AGENTS.md (origin/main), packages/cli/src/{index.ts,commands/package/install.ts,utils/terminal-confirm.ts,utils/json-stdout.ts,utils/dev-deploy-key.ts,utils/response-envelope.ts}, packages/metadata-core/src/package-upgrade-verdict.ts; cloud origin/main cdd108e7a (no change since the readings' 19dbb424925b in these files): packages/service-cloud/src/routes/package-install/install.ts, packages/service-cloud/src/routes/package-publish.ts, packages/service-cloud/src/cloud-artifact-helpers.ts; card objectstack#30887 body + comments 6730885888, 7370246763, 7372073663, 7372140636, 7373052070; cloud#5409; PR #39286 body; check-runs on the head.
Security-touching: no
Rule-change-verified: none

① Derived judgments

(1) Wire shapes vs cloud: match.

  • Key: CLI sends confirm_schema_upgrade (utils/publish-confirm-upgrade.ts:36, set at commands/package/publish.ts:1022, only with install_env_id, i.e. inside the installTarget block at :1019-1024). Cloud reads body.confirm_schema_upgrade ?? body.confirmSchemaUpgrade, a non-empty trimmed string only (install.ts:277-280), from the version POST (package-publish.ts:1911). Match.
  • 409 body: cloud returns failWithCode(message, SCHEMA_UPGRADE_CONFIRMATION_REQUIRED, 409, { details }) (install.ts:331-348), which writes { success:false, error:{ code, message, httpStatus, details } } (cloud-artifact-helpers.ts:333-336); status 409 is metadata-core's SCHEMA_UPGRADE_CONFIRMATION_STATUS (package-upgrade-verdict.ts:39). The CLI reads body.error.code === SCHEMA_UPGRADE_CONFIRMATION_REQUIRED, error.details.findingSet (non-empty string) and error.details.findings (utils/upgrade-plan.ts:46-53), and details.manifest_id / version / previous_version for the --json package (deploy.ts:425-438). Every field it reads exists in cloud's details (install.ts:333-341). The publish route forwards the install's refusal unchanged (package-publish.ts:1917-1919).
  • Token flow: cloud refuses unless token === findingSet (install.ts:1929-1944), flags staleToken when a wrong token was sent, and admits with no question when findings.length === 0 (:1928). The CLI re-sends the refusal's own findingSet (deploy.ts:447,455) or the user's --confirm-upgrade (deploy.ts:411,442; publish.ts:1022).
  • Nothing stored on refusal: authorizePackageInstall runs before any write. On !verdict.granted the route writes only the refused-install audit row and returns (package-publish.ts:1917-1919). The version row is created later (:1961), and no write sits between the version-exists check (:1674) and the authorization. So re-sending the same -dev.TIMESTAMP version (deploy.ts:455) is valid. One caveat: the package-row upsert POST /cloud/packages runs before the version POST (publish.ts:953), so "nothing was published" holds for versions, not for package-row metadata (N3).

(2) Q3 honoured: yes. No install path gets past a refusal without an explicit token.

  • The only automatic re-send is behind run.stopped && run.refusal?.schemaUpgrade && !flags.json && canAskOnTerminal() and an explicit y (deploy.ts:446-455). canAskOnTerminal needs both stdin and stdout to be TTYs (terminal-confirm.ts:20-21), and askYesNo is true only for y/yes (:24-28).
  • --json never prompts: !flags.json is in the guard, stdout is reserved for the document (deploy.ts:283), and the refusal ends in finish(1, …) (deploy.ts:457-459). Pinned by deploy.test.ts:468 (TTY true, askYesNo not called) and by ablation B.
  • Off a terminal: exit 1, with no question (deploy.test.ts:408).
  • os package publish never asks. It prints the stop and exits 1 (publish.ts:1033-1041).
  • Stale token: cloud re-refuses with a fresh findingSet (install.ts:1931-1942). Publish prints the retry with the stale token dropped (retryCommandOf, publish-confirm-upgrade.ts:83-91; pinned package-publish-error-envelope.test.ts:340). On deploy, a stale token on a TTY leads to the question, and only a y re-sends with the server's current token. A second refusal is not re-asked (deploy.ts:455-459, no loop).
  • A token sent where the plan has no finding is ignored by cloud (install.ts:1928). That is not a bypass.

(3) Widening: all declared. patch is correct.
Newly accepted:

  • (a) os package publish --confirm-upgrade <token> (new flag, publish.ts:606-610; needs --install, guard at :814-818).
  • (b) os deploy --confirm-upgrade on the ObjectOS Cloud target (removed from RUNTIME_ONLY_FLAGS, deploy.ts:157).
  • (c) os deploy --json on the cloud target (same line), with the DeployDocument now emitted as target: cloud.
  • (d) The new wire key confirm_schema_upgrade on the version POST.
  • (e) Public members PackagePublishCommand.refusal and .retryCommand (publish.ts:510,516). The class is public as PackagePublishCommand from @objectstack/cli (src/index.ts:56). Deploy and utils/* are not exported, so the new util exports and renderSchemaUpgradeRefusal's optional judge parameter are internal.
    The changeset declares (a), (b), (c), (e) and the key in (d). The PR body declares (a), (b), (c) and (e) (in "Acceptance notes").
    Both carry the line-initial Clause-②: yes (widening) and Metadata-protocol: none. That matches PM amendment 7372140636. Under AGENTS.md:1027-1032 (none takes patch, and "a non-protocol change, widening or breaking, ships patch"), '@objectstack/cli': patch is the correct level. Check Changeset re-ran on the edited body at 09:05Z: success.

(4) Self-hosted behaviour: unchanged.

  • deployToRuntime to end of file is byte-identical between main (:414-) and the head (:516-): the diff is empty.
  • confirmationArgv is unchanged (deploy.ts:184).
  • Runtime dispatch is unchanged (deploy.ts:290-294, before the cloud-only flag loop).
  • RUNTIME_ONLY_FLAGS is read only on the cloud branch.
  • The one behavioural delta reachable on a runtime machine is N2: the run-level catch now writes target: targetKind (deploy.ts:285,291,317) where main hard-coded 'runtime' (main :400-401). This applies only when activeRuntimeTarget() itself throws under --json.

(5) Tests and ablations: the claims are pinned, with gaps.

  • Hosted stubs use cloud's exact refusal envelope, with the token from metadata-core's schemaUpgradeVerdict (deploy.test.ts:57-103,145-147; package-publish-error-envelope.test.ts:238-296). The deploy stub stores no version on a refusal, so the deploy tests model the no-version-row guarantee.
  • Each claim has a pinning case:
    • no-risk installs with no question and no key: :396
    • stop off a terminal: :408
    • TTY yes re-sends the same version with the token: :423
    • decline: :437
    • --confirm-upgrade on the first POST: :448
    • a non-Q3 refusal asks nothing: :458
    • --json refusal: :468
    • --json clean deploy: :493
    • --dry-run refused: :502
    • publish stop, key, stale token, no --install: publish test :314,:330,:340,:351
  • Ablations A-E as reported (7372073663) each target a pinned assertion. I did not re-run them (Local-runs: none).
  • Not pinned:
    • deploy's retry or confirm line for an --env/--server run (B1: the tests resolve the only environment, :134);
    • the --token echo in publish's retry line (B2);
    • a deploy stale-token run;
    • a cloud os dev d-key case (the card's acceptance names one; only the self-hosted d-key case exists). The d key spawns a bare os deploy (dev-deploy-key.ts:187), so the TTY cases cover the logic.

(6) Docs (content/docs/deployment/cli.mdx): accurate to the code, with two exceptions.

  • :3911-3923 (the cloud stop and question), :3934-3936 (flag rows), :3996-4000 (JSON keys), :4305-4312 and :4329 (publish) all agree with the code.
  • :4000 and :3911-3923 repeat the defective os deploy --confirm-upgrade <token> shape for --env runs (B1).
  • :3998 gives [] as a possible wouldStop value, but on ObjectOS Cloud a clean install leaves it null (nit).

(7) Part of #30887: an honest statement of the open half.

  • The remaining items (the full plan before install, declared renames in the result, cloud --dry-run) are the card's Expected 1, 2 (renames) and 5.
  • They wait on cloud#5409: open, titled "Publish install arm: a dry run that answers the upgrade plan for a version not stored yet, storing nothing". That is ruling 1 (A) of 7372140636.
  • The card stays open.
  • Some PR-body lines are stale (N1).

CI at the head: 61 check-runs: 42 success, 19 skipped, 0 failure, 0 pending. Required checks are green: Lint & Repo Gates, TypeScript Type Check, Test Core with 12/12 shards, Build Core, Governed Surface Queue Guard, Dogfood Regression Gate, Check Changeset. The PR is still a draft (mergeable_state: unstable). No governed surface is touched (AGENTS.md:276-282).

② Findings

  • B1 (blocking): the deploy remedy and the --json confirm drop the run's target.
    • Where: deploy.ts:415 sets command.retryCommand = 'os deploy', and deploy.ts:430 hard-codes confirm: 'os deploy --confirm-upgrade ' + findingSet. Publish prints ${retry} --confirm-upgrade ${findingSet} (upgrade-plan.ts:76).
    • Effect: os deploy --env env_b (or --server / --token) prints, and documents in confirm, a command that deploys to the active or only environment instead. Cloud's token is schemaUpgradeFindingSet(manifestId, findings) with no environment or version in it (reading 3; install.ts:1929-1931). So the printed command can confirm and install the same findings into an environment whose refusal was never shown. The confirm field is documented as "the command that confirms exactly the refused Q3 findings" (deploy.ts DeployDocument doc; cli.mdx:4000), which this breaks for any explicit-target run.
    • Fix: build the retry from deploy's own argv minus --confirm-upgrade, as retryCommandOf('os deploy', this.argv) already does for publish, with B2 applied. Pin it with an --env case.
    • The self-hosted target cannot take --env, so its 'os deploy' stays faithful.
  • B2 (blocking): the publish retry line echoes the bearer token.
    • Where: retryCommandOf('os package publish', this.argv) (publish.ts:1037; publish-confirm-upgrade.ts:83-91) re-prints every argv word except --confirm-upgrade, including --token <key> / --token=<key>.
    • Effect: the credential lands on stdout and in CI logs.
    • Precedent: the self-hosted half deliberately prints only os package install <package> (install.ts:297).
    • Fix: redact or drop --token/-t values (and any other secret-bearing flag) from the retry line, and pin it with a test.
  • N1 (non-blocking): the PR body contradicts its own header.
    • "Acceptance notes" still says "Clause-② is copied from the claim (no) … The seat decides whether to amend here".
    • 维护者速读 "要你做:决定云端…" and "That is a decision for the seat (options in the os-dev report)" are stale: 7372140636 ruled A, and the header already cites cloud#5409.
  • N2 (non-blocking): --json failure document when activeRuntimeTarget() throws. It now says target: cloud (deploy.ts:285,317) where main said runtime. Neither is known at that point; consider leaving it unset or documenting it.
  • N3 (non-blocking): "Nothing was published or installed." (publish-confirm-upgrade.ts:69) and the changeset are true for versions. The package-row upsert (publish.ts:953, e.g. --visibility, --readme) has already applied by the time of the refusal. This was already true before this PR; a wording nit.
  • N4 (non-blocking): test and doc gaps.
    • No cloud-target d-key case, though the card's acceptance asks for one.
    • No deploy stale-token case.
    • cli.mdx:3998 [] is not produced on cloud.

③ Verdict

FAIL at 354d7705242ddb10e5dfc6c248e0b46a7099d78b. The wire shapes, Q3 handling, widening declarations, patch level, self-hosted parity and CI are all sound, but the printed and --json remedy for os deploy drops --env/--server (B1), and publish's retry line echoes --token (B2).

…t and never prints the API key (#30887)

os deploy's ObjectOS Cloud retry line and its --json `confirm` named a bare
`os deploy`, which re-runs against the active environment: the confirming
token is the findings' digest and names no environment, so it could confirm
the findings into one whose refusal was never shown. The retry now names the
environment that refused (`--env ENV`) and keeps only the typed target flags.

os package publish's retry re-printed every argument but --confirm-upgrade,
--token included. The retry is now built from an allowlist of flags, walked
with the command's own flag specs so a dropped flag's value goes with it.

A --json failure reading the deploy target reports target runtime again, as
before the cloud target took --json. Adds the cloud d-key, stale-token,
--env and --token cases, and corrects the docs' wouldStop row.

Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
Co-authored-by: Claude <noreply@anthropic.com>
…nt and never the API key (#30887)

Claude-Session: https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/xl and removed size/l labels Dec 3, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:cloud@zhuangjianguo · zhuangjianguo · session_01TsNV8Bsjqmw7aXCo2QuLU1

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 0171f212e93d3b39f9857ca3e729e5fdb23427a9
Local-runs: none
Scope: delta 354d7705242ddb10e5dfc6c248e0b46a7099d78b..0171f212e9 (commits b66d847f3a, 0171f212e9): .changeset/30887-hosted-upgrade-stop.md, content/docs/deployment/cli.mdx, packages/cli/src/commands/deploy.ts, packages/cli/src/commands/package/publish.ts, packages/cli/src/utils/publish-confirm-upgrade.ts, packages/cli/test/deploy.test.ts, packages/cli/test/package-publish-error-envelope.test.ts + cited read-only: packages/cli/src/utils/{upgrade-plan.ts,runtime-target.ts}, packages/cli/src/index.ts, packages/cli/package.json, @oclif/core@5.1.12 lib/parser/parse.js (from a pinned tree's node_modules), prior review 7373269516, fix report 7374912660 (objectstack#30887), PR #39286 body (edited 10:15:48Z), check-runs on the head.
Security-touching: yes
Rule-change-verified: none

① Delta judgments

B1: fixed. The retry and confirm now always name the environment that refused.

  • deploy.ts:414-420: retry = retryCommandOf('os deploy', this.argv, Deploy.flags, CLOUD_RETRY_FLAGS, ['--env', target.environmentId]).
    • target comes from resolveInstallTarget (:366-372), so the appended --env is the resolved environment, whatever the source (flag, OS_ENVIRONMENT_ID, the recorded env, or the org's only env).
    • CLOUD_RETRY_FLAGS (:168) is server, wait, wait-timeout, json. The typed --env is not kept as typed: it is dropped and replaced by the resolved id.
  • The human line uses the same string: command.retryCommand = retry (:438), and printPublishSchemaUpgradeStop prints ${retry} --confirm-upgrade … (upgrade-plan.ts:76, publish.ts:1037-1041).
  • The --json confirm uses it too: ${retry} --confirm-upgrade ${findingSet} (deploy.ts:453).
  • TTY re-send: both publish() calls pass '--env', target.environmentId (:431). The yes branch calls publish(confirmToken) with the same target (:465-478).
  • Pinned by tests:
    • deploy.test.ts:510: --env env_b --server --token; the retry is os deploy --server … --env env_b --confirm-upgrade …; the version POST has install_env_id env_b; the secret is absent.
    • :520: --json confirm is os deploy --json --env env_b …, and the secret is in neither stdout nor stderr.
    • :531: an environment resolved without --env is pinned.
    • :540: the TTY yes path gives two POSTs, both env_b, the second with the token.
    • :408, :469: updated to --env env_acme.
  • The self-hosted retryCommand 'os deploy' path is untouched. That target takes no --env.

B2: fixed for both commands.

  • The walker (publish-confirm-upgrade.ts:107-145) mirrors oclif 5.1.12's own lookup.
    • oclif findLongFlag checks name, aliases, then no- with allowNo. findShortFlag checks char. An option takes the next word when the flag is long or arg.length < 3, else arg.slice(arg[2]==='=' ? 3 : 2); --x=v is split at = (parse.js:103-124,510-535).
    • The walker handles each case:
      • --name, --name=v, --no-name: :130-134.
      • -c, -cV, -c=V: :135-138.
      • An option with no inline value consumes the next word: :142.
      • The word is emitted only when keep.has(name): :143.
    • So --token KEY, --token=KEY, -t KEY and -tKEY are all dropped together with KEY.
  • No aliases need handling. Neither command declares aliases or charAliases, and neither uses baseFlags (deploy :219-286; publish flags block; repo-wide grep for baseFlags/enableJsonFlag is empty). The static flags object is therefore the full parse surface.
  • Unknown flags (no spec) are dropped without consuming a value. This is only reachable for input that oclif's strict mode has already rejected.
  • Words after -- are kept verbatim (:119-122). They are positionals to oclif, never the credential.
  • Allowlist coverage, checked flag by flag:
    • PUBLISH_RETRY_FLAGS (:92-96) names exactly the 22 non-credential flags of os package publish. It omits token (-t) and confirm-upgrade.
    • Deploy keeps 4 flags.
    • The only secret-bearing flag on either command is --token/-t (env OS_CLOUD_API_KEY). --confirm-upgrade is a findings digest, and a stale one is dropped. No other flag carries a credential.
  • Other print paths:
    • this.argv is read only at publish.ts:1040 and deploy.ts:416.
    • The token reaches only Authorization headers (publish.ts:1151,1195) and the child argv (deploy.ts:433, which is overridden by retryCommand).
    • The deploy --json document fields are target, url, result, package, plan, environment, wouldStop, refusal (server details), confirm and error. outcome.token is never copied into it.
    • Error messages carry baseUrl and the version, not the token.
    • oclif's opt-in DEBUG parser trace (parse.js:101 _debugInput) can print raw argv. That is pre-existing, opt-in, and outside this PR.
  • Pinned by tests:
    • package-publish-error-envelope.test.ts:354: all four spellings; the secret is absent from captured stdout and stderr, and the target flags plus -n notes are kept.
    • :378: a unit case. A dropped flag takes its value with it, positionals are shell-quoted, and a flag missing from the allowlist is dropped.
    • On deploy: deploy.test.ts:510,520 cover --token KEY.

N2: fixed.

  • targetKind starts as 'runtime' (deploy.ts:298) and becomes 'cloud' only after activeRuntimeTarget() returns nothing (:308). A throw there (runtime-target.ts:52-54 reads cloud.json) reports runtime, as on main.
  • Pinned: deploy.test.ts:601 makes cloud.json a directory, expects 0 calls and target: runtime.

N4: fixed.

  • The cloud d-key case is at deploy.test.ts:563. It drives attachDeployKey on a cooked terminal; on decline it expects one question, one POST, no token, "Nothing was deployed", and the key re-armed.
  • The deploy stale-token case is at :552. It expects one POST carrying the stale token, exit 1, a retry with only the current token, and the stale token not printed.
  • The cli.mdx:4002 wouldStop row now says null on cloud when there was no schema stop. This matches deploy.ts:454, and :494 pins wouldStop: null, confirm: null.

N1 (PR body, at 10:15:48Z): fixed. The 要你做 line, the "seat ruled A … cloud#5409" sentence and the Clause-② acceptance note all match. The header keeps the line-initial Clause-②: yes (widening) / Metadata-protocol: none.

N3: left as is. It is pre-existing and acknowledged in the PR body.

Docs and changeset: they match the code.

  • cli.mdx:3917-3922 gives os deploy --env <environment> --confirm-upgrade <token> and the kept and dropped flags.
  • cli.mdx:4004 covers confirm.
  • cli.mdx:4316-4317 covers the publish never---token line.
  • The changeset bullet covers the same, including the new "unset retryCommand = argv without --token/--confirm-upgrade" semantics.

Widening: nothing new.

  • retryCommandOf's new signature, RetryFlagSpec and PUBLISH_RETRY_FLAGS live in utils/ and are not exported from src/index.ts. Deploy is not exported either.
  • The only public-surface change is the documented meaning of an unset PackagePublishCommand.retryCommand. It narrows what is printed and is declared in the changeset.
  • No new flag, wire key or exit code. '@objectstack/cli': patch still holds.

Tests and ablations: the deltas are pinned (above).

  • The reported ablations each target a pinned assertion:
    • B1, drop the appended --env: 6 red.
    • B2, token on the publish allowlist: 5 red.
    • B2-deploy, token on the deploy allowlist: 2 red.
    • B2-arity, never consume an option's value: 7 red, the value leaks as a positional.
    • N2, start at cloud: 1 red.
  • The red counts agree with the test bodies I read. I did not re-run them (Local-runs: none).

CI at the head:

  • 63 check-runs: 44 success, 19 skipped, 0 failure.
  • The one re-run, Check Changeset 144176078200, was triggered by the 10:15Z body edit. It concluded success.
  • Required checks: Lint & Repo Gates, TypeScript Type Check, Test Core 12/12, Build Core, Governed Surface Queue Guard, Dogfood Regression Gate, Check Changeset and Test UI are success.
  • The PR is still a draft (mergeable_state: unstable).

② New findings

  • N5 (non-blocking): os package publish --install without --env does not pin the resolved environment in its retry line.
    • Where: publish.ts:1040 appends nothing. installTarget is resolved from OS_ENVIRONMENT_ID, the recorded env, or the only env (publish.ts:821-834), and its id is printed only as a step line (:1025).
    • Effect: B1's own rationale (deploy.ts:161-167, cli.mdx:3920-3922) applies here too. The token names no environment, so a retry after os environments switch targets another environment.
    • Why non-blocking: cloud admits the retry only if that environment's findings digest equals the token (cloud origin/main packages/service-cloud/src/routes/package-install/install.ts:1929-1932), so it can only confirm identical findings. The command line is also "the same command" the user typed.
    • Fix: pass ['--env', installTarget.environmentId] as append when installTarget.source !== 'flag', and pin it with a case.
  • Nit: deploy's short and = token spellings are not pinned at the deploy level. -t KEY, -tKEY and --token=KEY are covered only through publish's cases plus the shared walker. Deploy's token has the same char: 't', so the risk is low.
  • Nit: two walker branches have no direct case. The -- branch and the --no-wait negation are both unpinned.

③ Verdict

PASS at 0171f212e93d3b39f9857ca3e729e5fdb23427a9. All four items are fixed: B1 (the retry and confirm pin the resolved environment), B2 (an allowlist walker that drops --token with its value in every oclif spelling), N2 and N4. Each fix is pinned by tests and ablations, no new widening, CI is 0 failures. Only non-blocking N5 and two nits are open.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review December 3, 2026 10:21
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Dec 3, 2026
Merged via the queue into main with commit 14680d0 Dec 3, 2026
64 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-30887-hosted-plan branch December 3, 2026 10:44
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.

2 participants