Repository navigation
Commit fbbbaee
fix(cli): os package install prints the connector maps the package export withheld (#30044)
<!-- claude-projects-attribution: {"github_login":"os-support-ai"} -->
_Requested by **Yibo Wang** · [project
thread](https://claude.ai/code/project/chan_01BVUyyPie8gHwoPM18iABwB?thread=cmsg_01BVUyyPie8gHwoPM18iABwB7J3TmFTYMYQrfpye6GQNg9)_
Fixes #29873
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么:** `os package install` 在安装成功后读取安装应答里的
`withheldMaps`,逐条打印被导出扣下的连接器映射(`connector 'NAME'
PATH`),附一句补救:到连接器的编写处重新填入该映射。托管(热加载与未热加载)和非托管两种模式、目录 id 与制品文件两种来源都打印。
- **为什么改:** 导出包时连接器的 header / env 映射被整张扣下,服务端 install-local 的应答已逐条点名,但
CLI 把这个键丢了。按文档用 `os package install DIR/NN-ID/objectstack.json`
安装的运维看不到任何提示,直到连接器运行时不带 header 才失败。
- **风险与回滚:** 只改 CLI 的输出文字:应答不带该列表(或列表为空)时一行都不多印,退出码不变,服务端与导出不动。命令没有
`--json` 输出。`@objectstack/cli` patch。回滚 = revert 本 PR。
- **先看:** `packages/cli/src/commands/package/install.ts` 顶部的
`printWithheldMaps`,以及两处调用(非托管分支 `Sample data` 之后、托管分支 `Hot-load error`
之后);测试 `packages/cli/test/package-install-withheld-maps.test.ts`。
- **两分钟验证:** `pnpm --filter @objectstack/cli exec vitest run --project
unit test/package-install-withheld-maps.test.ts`,预期 `12 passed`。
- **需要你做的:** 无,席位落地。
## What changes
- **`packages/cli/src/commands/package/install.ts`.** A module-local
`printWithheldMaps(answer.withheldMaps)` prints, when the install-local
answer carries a non-empty list:
```text
⚠ 2 connector map(s) arrived empty — the package export withheld each
one whole, so the connector sends none of those headers or environment
variables:
connector 'w5export_erp' providerConfig.headers
connector 'w5export_mcp' providerConfig.transport.env
Re-enter each map where the connector is authored.
```
- **Every install mode the command has.** It is called in the unmanaged
success branch (after `Sample data`) and in the managed success branch
(after `Hot-load error`), which covers a hot-loaded and a not-hot-loaded
managed install. Both sources (catalog id, artifact file) reach those
same branches.
- **From the answer only.** An absent or empty list prints nothing.
Nothing is read from the artifact the command sent, so a runtime that
predates the key gets the output it always got. This matches the
`strippedLocks` reader in the same file.
- **No `--json`.** The command's `flags` block declares no `json` flag
and the class sets no `enableJsonFlag`, so there is no machine output to
carry the list.
- **Exit code unchanged.** The connector is installed and runs; the
warning changes nothing about success.
- **Not changed.** The server answer
(`marketplace-install-local-plugin.ts`, both modes already answer
`withheldMaps`) and the export (`assemblePackageManifest` already writes
it), per the ruling. Neither frozen file (`protocol.ts`, `engine.ts`) is
touched.
- **Declarations.** `Clause-②: no`: `printWithheldMaps` is not exported,
no flag or exported signature changes, and no input the command accepted
is refused. `Metadata-protocol: none`: CLI text only. Changeset
`29873-install-prints-withheld-maps.md`: `@objectstack/cli` patch.
## Tests
New `packages/cli/test/package-install-withheld-maps.test.ts` (unit
tier, derived by `vitest-tiers.ts`), 12 cases, the stub-`fetch` harness
of the sibling `package-install-*.test.ts` files. For each of managed
hot-loaded, managed not hot-loaded, and unmanaged (`--install-mode
unmanaged`):
- a catalog install whose answer carries two maps prints the warning,
one line per map with connector name and path, and the remedy, and exits
normally;
- an artifact-file install (an `objectstack.json` shaped like an `os
package export` directory, with `withheldMaps`) prints the same for its
one map;
- an answer whose `withheldMaps` is absent, or empty, prints none of
those lines.
<details><summary>Ablations (both red as expected, both restored to
HEAD)</summary>
Run with `node scripts/ablation-replace.mjs` on
`packages/cli/src/commands/package/install.ts`; the test imports
`../src/...` directly, so no dist leg is involved.
1. **Old behaviour back** (anchor ` if (maps.length === 0) return;`
replaced by ` return;`, so nothing is printed): `Tests 6 failed | 6
passed (12)`. The 6 red are the positive pins (`names each withheld map
…` and `names the withheld map for an exported artifact file …`, in all
three modes). Restored: `blob == HEAD (0e2e99b) and git diff HEAD
is empty`.
2. **Negative pin** (the empty-list guard deleted, so an absent or empty
list prints `0 connector map(s) arrived empty`): `Tests 6 failed | 6
passed (12)`, all six `prints no withheld-map line when the answer's
list is absent|empty`, `AssertionError: … not to contain 'arrived
empty'`. Restored the same way.
</details>
## Acceptance notes
- The card's step 3 (server answer and `WARN [MarketplaceInstallLocal]`
line) is unchanged and was not re-measured on a boot here; the pins stub
the answer in the shape `marketplace-install-local-plugin.ts` returns
(`...(withheldMaps.length > 0 ? { withheldMaps } : {})` in both modes).
- The warning goes to stdout with the rest of the command's output,
through the existing `printWarning`.
## Verification
All runs at head `d3e4350de` (the last commit; the PR adds no later
commit).
- **Build:** `pnpm --filter '@objectstack/cli^...' build` under
`os-verify-lock`: `VERDICT command-exit 0` (5m54s). Then `pnpm --filter
@objectstack/cli build && pnpm --filter @objectstack/cli typecheck &&
pnpm --filter @objectstack/cli exec vitest run --project unit
--maxWorkers=2`: `VERDICT command-exit 0`, `Test Files 379 passed
(379)`, `Tests 5323 passed (5323)`. The integration tier is declared to
CI: the diff touches no integration-tier file or spawn entry.
- **Lint:** `pnpm lint`: exit 0. `pnpm exec eslint --no-inline-config`
on the two touched `.ts` files: exit 0.
- **Derived gates:** `node scripts/pm/dispatch-gates.mjs --commands`
derived 60 families for the 3 changed paths; all 60 run, `--ran`
reconciles `58 run, 2 NOT-MEASURED, 0 UNRUN`, exit 0. The two NOT
MEASURED families are `check:dual-build-cjs-loads` and
`check:i18n-coverage`, both exit 3 (PREREQUISITE NOT MET: they read
every package's `dist/`, and this checkout built only the cli closure).
CI runs both on a full build. `check-plugin-teardown-shape --self-test`
first exited 3 on the shallow clone; after `git fetch origin 621a487`
it passed (48 cases).
<details><summary>Derived gate exit codes (60)</summary>
```text
node scripts/check-adr-0087-registration.mjs --base origin/main :: exit 0
node scripts/check-adr-0087-registration.mjs --self-test :: exit 0
node scripts/check-changeset-no-major.mjs --base origin/main :: exit 0
node scripts/check-closing-keyword-parity.mjs :: exit 0
node scripts/check-closing-keyword-parity.mjs --self-test :: exit 0
node scripts/check-comment-mask-adoption.mjs :: exit 0
node scripts/check-comment-mask-adoption.mjs --self-test :: exit 0
node scripts/check-comment-mask-corpus.mjs :: exit 0
node scripts/check-dts-emitted.mjs --self-test :: exit 0
node scripts/check-empty-changeset.mjs --base origin/main :: exit 0
node scripts/check-empty-changeset.mjs --self-test :: exit 0
node scripts/check-issue-citations.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs :: exit 0
node scripts/check-plugin-teardown-shape.mjs --self-test :: exit 0
node scripts/ci/assert-turbo-remote-cache.mjs --self-test :: exit 0
node scripts/ci/plan-test-core-shards.mjs --self-test :: exit 0
node scripts/ci/prune-turbo-cache.mjs --self-test :: exit 0
node scripts/docs-audit/check-affected-docs.mjs :: exit 0
node scripts/docs-audit/check-drift-comment.mjs :: exit 0
node scripts/pm/release-rehearsal-clone.mjs --self-test :: exit 0
node scripts/release-pending-publish.mjs --self-test :: exit 0
pnpm --filter @objectstack/spec run check:duration-unit-keys :: exit 0
pnpm check:changeset-gate-self-tests :: exit 0
pnpm check:ci-filter-parity :: exit 0
pnpm check:cli-test-child-env :: exit 0
pnpm check:closed-ceremony-text :: exit 0
pnpm check:cross-package-test-inputs :: exit 0
pnpm check:doc-authoring :: exit 0
pnpm check:driver-memory-census :: exit 0
pnpm check:dts-closure :: exit 0
pnpm check:dual-build-cjs-loads :: exit 3
pnpm check:engine-double-contract :: exit 0
pnpm check:gitlink-declared :: exit 0
pnpm check:i18n :: exit 0
pnpm check:i18n-coverage :: exit 3
pnpm check:i18n-walk-parity :: exit 0
pnpm check:issue-citations :: exit 0
pnpm check:keyed-text-bounds :: exit 0
pnpm check:lean-entry-closure :: exit 0
pnpm check:logger-receiver-detach :: exit 0
pnpm check:nul-bytes :: exit 0
pnpm check:objectql-double-limit :: exit 0
pnpm check:org-identifier :: exit 0
pnpm check:page-declaration-shape :: exit 0
pnpm check:platform-object-tenancy-census :: exit 0
pnpm check:published-files :: exit 0
pnpm check:query-options-erasure :: exit 0
pnpm check:refd-timer-probe :: exit 0
pnpm check:registry-log-declared :: exit 0
pnpm check:rest-log-spy-declared :: exit 0
pnpm check:slot-lookup :: exit 0
pnpm check:sourcemap-no-sources-content :: exit 0
pnpm check:system-context-census :: exit 0
pnpm check:test-source-alias :: exit 0
pnpm check:tier-file-adoption :: exit 0
pnpm check:type-check-coverage :: exit 0
pnpm check:type-check-debt :: exit 0
pnpm check:undeclared-dep-imports :: exit 0
pnpm check:watch-hint-literal :: exit 0
pnpm check:where-matcher :: exit 0
```
</details>
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01WGufzgboTwuVmeMX96wNxm
<!-- signed: domain:server#6 · os-support-ai ·
session_01WGufzgboTwuVmeMX96wNxm -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b0c2209 commit fbbbaee
3 files changed
Lines changed: 182 additions & 0 deletions
File tree
- .changeset
- packages/cli
- src/commands/package
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
49 | 76 | | |
50 | 77 | | |
51 | 78 | | |
| |||
313 | 340 | | |
314 | 341 | | |
315 | 342 | | |
| 343 | + | |
316 | 344 | | |
317 | 345 | | |
318 | 346 | | |
| |||
356 | 384 | | |
357 | 385 | | |
358 | 386 | | |
| 387 | + | |
359 | 388 | | |
360 | 389 | | |
361 | 390 | | |
| |||
| 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 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
0 commit comments