Repository navigation
Commit 14680d0
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).
<details><summary>Targeted tests, typecheck, lint</summary>
- `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.
</details>
<details><summary>Ablations (5), each turned its pin red and was
restored to the HEAD blob</summary>
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.
</details>
<details><summary>Gates: dispatch-gates --commands (102 families) and
--ran</summary>
- `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.
</details>
## 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.com/claude-code)
https://claude.ai/code/session_01TsNV8Bsjqmw7aXCo2QuLU1
<!-- signed: repo:cloud@zhuangjianguo · zhuangjianguo ·
session_01TsNV8Bsjqmw7aXCo2QuLU1 -->
---------
Co-authored-by: Claude <noreply@anthropic.com>
1 parent f808641 commit 14680d0
8 files changed
Lines changed: 976 additions & 155 deletions
File tree
- .changeset
- content/docs/deployment
- packages/cli
- src
- commands
- package
- utils
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3908 | 3908 | | |
3909 | 3909 | | |
3910 | 3910 | | |
| 3911 | + | |
| 3912 | + | |
| 3913 | + | |
| 3914 | + | |
| 3915 | + | |
| 3916 | + | |
| 3917 | + | |
| 3918 | + | |
| 3919 | + | |
| 3920 | + | |
| 3921 | + | |
| 3922 | + | |
| 3923 | + | |
| 3924 | + | |
| 3925 | + | |
| 3926 | + | |
| 3927 | + | |
| 3928 | + | |
3911 | 3929 | | |
3912 | 3930 | | |
3913 | 3931 | | |
| |||
3917 | 3935 | | |
3918 | 3936 | | |
3919 | 3937 | | |
3920 | | - | |
3921 | | - | |
3922 | | - | |
| 3938 | + | |
| 3939 | + | |
| 3940 | + | |
3923 | 3941 | | |
3924 | 3942 | | |
3925 | 3943 | | |
| |||
3976 | 3994 | | |
3977 | 3995 | | |
3978 | 3996 | | |
3979 | | - | |
3980 | | - | |
| 3997 | + | |
| 3998 | + | |
3981 | 3999 | | |
3982 | | - | |
3983 | | - | |
3984 | | - | |
3985 | | - | |
3986 | | - | |
| 4000 | + | |
| 4001 | + | |
| 4002 | + | |
| 4003 | + | |
| 4004 | + | |
3987 | 4005 | | |
3988 | 4006 | | |
3989 | 4007 | | |
| |||
4258 | 4276 | | |
4259 | 4277 | | |
4260 | 4278 | | |
| 4279 | + | |
4261 | 4280 | | |
4262 | 4281 | | |
4263 | 4282 | | |
| |||
4287 | 4306 | | |
4288 | 4307 | | |
4289 | 4308 | | |
| 4309 | + | |
| 4310 | + | |
| 4311 | + | |
| 4312 | + | |
| 4313 | + | |
| 4314 | + | |
| 4315 | + | |
| 4316 | + | |
| 4317 | + | |
| 4318 | + | |
| 4319 | + | |
4290 | 4320 | | |
4291 | 4321 | | |
4292 | 4322 | | |
| |||
4302 | 4332 | | |
4303 | 4333 | | |
4304 | 4334 | | |
| 4335 | + | |
4305 | 4336 | | |
4306 | 4337 | | |
4307 | 4338 | | |
| |||
0 commit comments