Repository navigation
feat(cloud-connection): the in-environment install door forwards a named package version - #31861
Conversation
…med package version POST /api/v1/cloud-connection/install accepts `version`, checks it against SEMVER_2_0_0_VERSION_PATTERN (400 INVALID_REQUEST, nothing forwarded) and forwards it as the control plane's `version` param. Omitted, nothing is sent and the install is the latest, as before. Claude-Session: https://claude.ai/code/session_01ADHkmQznRNHwfSHVJJUCj2 Co-authored-by: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ADHkmQznRNHwfSHVJJUCj2 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift CheckThis PR changes 1 package(s): 11 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 6 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 6 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 587f6fa41f4c0d1f484c176eaf10fa61d70cb580 && git checkout 587f6fa41f4c0d1f484c176eaf10fa61d70cb580
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin cfe3563003933662ffc785e2b10041bb406551ce 7c22f5f74fc04f939215e2152b4cef321fb9bbb5 && git checkout -B drift-repro cfe3563003933662ffc785e2b10041bb406551ce && git merge --no-ff 7c22f5f74fc04f939215e2152b4cef321fb9bbb5
node scripts/docs-audit/affected-docs.mjs --json cfe3563003933662ffc785e2b10041bb406551ce
|
|
domain:server#1 · os-steve · session_01ADHkmPF1skfu2kx89BEXZi 席位 ACCEPT · head
|
Requested by Steve · project thread
Fixes #31799
Clause-②: yes (widening)
Metadata-protocol: none
维护者速读
POST /api/v1/cloud-connection/install现在接受version,用 SemVer 2.0.0 语法校验后转发给控制平面的安装动作;不传则与今天完全相同(装最新版)。version时发给控制平面的请求体逐字节不变(有 CONTROL 测试钉住)。格式错误的version返回 400 INVALID_REQUEST 且不发出任何请求。回滚即 revert 本 PR。packages/cloud-connection/src/cloud-connection-plugin.ts中新增的packageVersionOf和/install路由里的转发参数。pnpm --filter @objectstack/cloud-connection exec vitest run src/cloud-connection-plugin.test.ts。version取自卡片说明,本会话无法读取 cloud 仓库,未实测(见下)。What changes
POST /api/v1/cloud-connection/installaccepts an optionalversionin its body.SEMVER_2_0_0_VERSION_PATTERN(from@objectstack/spec/kernel, the grammarPackageVersionSchema.version,PATCH /api/v1/packages/:idand the plugin loader already use) is trimmed and forwarded asparams.versionto the control plane'ssys_package/install_packageaction. No new regex.latest,1.2,v1.2.3,^1.2.3, a range, an empty string, a number, an object, an array) is refused with400 INVALID_REQUESTand a message namingversion, ending "Nothing was installed.", the same shapeinstall_modealready uses. Nothing is forwarded.null: noversionkey is sent, so the control plane installs the latest version exactly as today.version. That is the key the unmanaged grant already echoes (data.version) and the install-local door takes.packageVersionis not an alias; like any unknown key it is ignored.No new route, no new error code, no
packages/spec/**edit.Why
The in-environment install door forwarded no version, so a marketplace install from inside an environment could only ever take the latest version (#31799).
Verification
Clause-② measured: on base a body with
version: '1.2.3'is accepted and the version is dropped (the forward carries noversion); on head the same body forwards it. Bodies withoutversionare forwarded byte-for-byte as on base. A malformedversionthat base silently ignored is now refused 400 before anything is sent; that is the card's asked-for validation, not a narrowing of any request that could install a named version before.Step 0:
version(grant echo, install-local door, card). The control plane's own param name is NOT MEASURED: the cloud repository is not reachable from this session, so it rests on the card.SEMVER_2_0_0_VERSION_PATTERN, reused.packages/cloud-connection/except the release PR chore: version packages #29963 (CHANGELOG/package.json only).Tests (
cloud-connection-plugin.test.ts, three new):1.2.3,2.0.0-beta.1,1.0.0+20260101) is forwarded as named; surrounding spaces are trimmed;versionandinstall_modetravel together.INVALID_REQUESTnamingversion, and the control plane is never called.nullversionsend exactly the body main sends (JSON.stringifycompared), with noversionkey.Base leg (main's source, these tests): the two new pins red, the CONTROL green.
Ablation (restored,
git diff HEADempty afterwards): shape check disabled → the malformed-version pin red ("latest": expected 200 to be 400).Runs: cloud-connection full suite 80 files / 1125 tests green; typecheck green; lint (
eslint --no-inline-config packages/cloud-connection) clean; everydispatch-gates --commandscommand run with stdin closed and reconciled with--ran, plus the four roster gates whose roster sits under a touched directory (check:dual-build-cjs-loadsfirst exited 3 for missingdist/, green after a workspace build);check:nul-bytesOK; the dogfood files that boot cloud-connection (28 files, 245 tests) green locally. No route was added, so the whole dogfood package was not run.Forced test edits: none. Only new tests were added.
Human Minimum
packages/specholds no runtime logic.pnpm lintpasses.main, one pull request.packages/spectouched: its generated artifacts are regenerated and committed. (Not touched.)content/docs/references/,packages/*/CHANGELOG.mdorcontent/docs/releases/.## 维护者速读section is Chinese by the dispatch order.)Generated by Claude Code