Repository navigation
Commit 6eb23c8
fix(cloud-connection): the install-local answer names the pending Everyone suggestion an isDefault set leaves (#38637)
<!-- claude-projects-attribution: {"github_login":"os-steve"} -->
_Requested by **Steve** · [project
thread](https://claude.ai/code/project/chan_01FdL1XeUyvVNxLreh3F4Qi9?thread=cmsg_01FdL1XeUyvVNxLreh3F4Qi9St4eUWHFcCKuRUrCZPperJ)_
Fixes #38247
Clause-②: no
Metadata-protocol: none
## 维护者速读
-
用户能看到什么变化:安装带默认权限集的应用后,安装结果和命令行输出会列出每条待接受的"全员授权建议",并说明去哪里接受;不再只说"应用已可用"。
- 为什么做:这是"安装后普通成员被拒"那张卡的提示半边,维护者已裁定按设计保留人工接受、只补提示。
- 出错会怎样:最坏是提示漏列或多列一条建议,不会替任何人授权;改动只增加提示,可直接撤回。
- 要你做什么:无
## What changes
- **Producer — `packages/cloud-connection`, the managed `POST
/api/v1/marketplace/install-local` answer.** A new step 8, after every
step that makes the version live, asks the security service's existing
listing (`ISecurityService.listAudienceBindingSuggestions`, as the
system, filtered to `status: 'pending'` and the package) and names each
pending `everyone` row on a new key, `pendingSuggestions`, omitted when
empty. Each element has the advisory shape of `advisories` (`rule:
'audience-binding-suggestion-pending'`, `severity`, `where`, `path`,
`message`, `hint`) plus `suggestionId`, `packageId`, `permissionSet`,
`anchor`. The `hint` says where to accept it: Grant on the package's
Marketplace page, or `POST
/api/v1/security/suggested-bindings/ID/confirm`. While a suggestion is
pending, the `note` no longer says the app is available to everyone.
- **Why this source (the dispatch's question a/b/c, answered with
evidence):** route (b) through an existing service, with no timing
dependence. The listing's contract is "Re-syncs before reading"
(`packages/spec/src/contracts/security-service.ts`). It runs the same
convergent `syncAudienceBindingSuggestions` that a boot, a package
publish and every Setup list run, so the answer names a row only once it
exists as `pending`. It never names one already accepted, dismissed or
observed in the baseline, and it does not wait on the fire-and-forget
`onMetadataMutation` listener. The door's own header
(`announceHotInstall`) records that the security catalog serves an
installed package's sets as soon as register resolves. The real-stack
pin below measures that. Route (a), reading `isDefault` off the
manifest, would claim suggestions the reconcile does not create (an
accepted or baseline set), so it is used only as a pre-filter that
decides whether to ask at all. No new kernel service, no new
cross-plugin coupling: the door already reaches the security plugin
through services (`security.accessUpgradeCheck`).
- **Nothing is accepted.** ADR-0090 D5 stands ("It is never
auto-bound"): the reconcile only records suggestions, and no acceptance
verb is called (pinned).
- **Composed artifacts:** rows are matched against the install's unit
(`installedUnitPackageIds`, the ids the uninstall withdraws), so a
member package's suggestion is named under its own `packageId`.
- **Consumer — `packages/cli`, `os package install` (and `os deploy`,
which runs it):** after the managed install summary, it prints one
warning, one line per pending set with its package, and each element's
`hint`. It prints from the answer only, and nothing when the key is
absent.
- Changeset: `.changeset/38247-install-pending-suggestion.md` (patch
×2).
## Tests
-
`packages/cloud-connection/src/marketplace-install-local-pending-suggestions-38247.test.ts`
(new, 11 tests). These run at the real install seam, with a stub
security service. An `isDefault` install names the pending row, with the
id, the accept route and the changed note. The CONTROL install without
one never asks and lists nothing. Accepted, baseline, dismissed, guest
and other-package rows are not named. With no security service, or one
without the listing, the key is omitted. A throwing listing omits the
key, warns once with its cause, and still answers 200. No acceptance
verb is called.
- `packages/cli/test/package-install-pending-suggestions-38247.test.ts`
(new, unit tier, 6 tests): printed for hot-loaded and not-hot-loaded
answers; nothing printed for an absent or empty list.
- Real-stack pin, added to the existing harness
`packages/cli/test/package-install-local-sample-owner.integration.test.ts`,
which already installs an `isDefault` set through `os start`. The
install answer's `pendingSuggestions` names exactly the row that `GET
/api/v1/security/suggested-bindings?status=pending&packageId=…` lists
right after it, with the same id. This file is in the integration tier,
which CI owns. It was run once locally as the measurement, and passed.
<details><summary>Local readings (head fe3fc53)</summary>
All readings are at head `fe3fc53bc`. Heavy runs went through
`scripts/pm/os-verify-lock.sh`, so each figure is a VERDICT line.
- `pnpm --filter @objectstack/cloud-connection exec vitest run
--maxWorkers=2` → `Test Files 95 passed (95)`, `Tests 1370 passed
(1370)`, VERDICT command-exit 0.
- `pnpm --filter @objectstack/cli exec vitest run --project unit
--maxWorkers=2` → `Test Files 2 failed | 448 passed (450)`. The two
failures were `published-subpath-console.pin` and
`published-subpath-hook-body.pin`, which refused with "packages/cli is
not built". After `pnpm --filter @objectstack/cli build`, those two
files gave `Test Files 2 passed (2)`, `Tests 29 passed (29)`.
- `pnpm --filter @objectstack/cli exec vitest run --project integration
--maxWorkers=2
test/package-install-local-sample-owner.integration.test.ts` → `Test
Files 1 passed (1)`, `Tests 7 passed (7)`. This was run once locally as
the measurement; CI owns this tier.
- `pnpm --filter @objectstack/cloud-connection --filter @objectstack/cli
typecheck` → VERDICT command-exit 0. The cloud-connection typecheck
includes `tsconfig.test.json`.
- Ablations, run through `scripts/ablation-replace.mjs`, each restored
with blob == HEAD and an empty `git diff HEAD`:
- Dropping the answer key turned the new cloud-connection file red: `1
failed | 10 passed (11)`.
- Dropping the CLI print call turned the new CLI file red: `2 failed | 4
passed (6)`.
- `node scripts/pm/dispatch-gates.mjs --ran` → `77 derived famil(ies)
accounted for — 75 run, 2 NOT-MEASURED`, both exit 3 PREREQUISITE NOT
MET:
- `check-plugin-teardown-shape --self-test` needs an unshallowed clone.
- `check:dual-build-cjs-loads` needs unbuilt dists.
- CI runs both. The three i18n families first refused with "CLI not
built" and were run again after the CLI build: exit 0.
</details>
## Acceptance notes
- New test files rather than a shared harness. Each install-local answer
key has its own per-feature file (`-withheld-maps`, `-credential-refs`,
…), and there is no shared harness file to join. The real-stack pin
joined the existing integration harness.
- The pre-filter (does the body declare an `isDefault: true` set, via
`resolveStackCollection(converted, 'permissions')`) has one gap. On the
lenient path (register failed, `hotLoaded: false`), a pending row of the
previous version is not named when the new body declares no default. The
note there already says that the package loads at the next restart.
- An unmanaged install copies sets into the environment as env-authored.
An unowned `isDefault` set is never suggested (ADR-0086 D3), so that
answer gains nothing. This is unchanged behaviour, noted only.
- A walled deployment whose host declares
`acceptedDefaultPermissionSets` makes the listing throw (there is no
record to accept in). The answer then names nothing, and the door warns
once with the security plugin's own remedy sentence (add the set's name
to that option).
## Verification
Two-minute check: `pnpm --filter @objectstack/cloud-connection exec
vitest run --maxWorkers=2
src/marketplace-install-local-pending-suggestions-38247.test.ts` → 11
passed. The first case shows `pendingSuggestions[0].suggestionId ===
'sug_01pending'` and the confirm route in its `hint`.
Read first, by risk:
1. `packages/cloud-connection/src/marketplace-install-local-plugin.ts`,
`describePendingSuggestions`: the system-context listing call and its
failure arm.
2. Same file, `pendingSuggestionsOf`: the row filter (pending,
`everyone`, a package of this install's unit).
3. `packages/cli/src/commands/package/install.ts`,
`printPendingSuggestions`.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE)_
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01ADHkmRar3Kkg6SpwVgaaVE
<!-- signed: repo:objectstack#3 · os-steve ·
session_01ADHkmRar3Kkg6SpwVgaaVE -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent e6634ce commit 6eb23c8
6 files changed
Lines changed: 562 additions & 2 deletions
File tree
- .changeset
- packages
- cli
- src/commands/package
- test
- cloud-connection/src
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
142 | 171 | | |
143 | 172 | | |
144 | 173 | | |
| |||
634 | 663 | | |
635 | 664 | | |
636 | 665 | | |
| 666 | + | |
637 | 667 | | |
638 | 668 | | |
639 | 669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
242 | 242 | | |
243 | 243 | | |
244 | 244 | | |
| 245 | + | |
| 246 | + | |
245 | 247 | | |
246 | 248 | | |
247 | 249 | | |
| |||
279 | 281 | | |
280 | 282 | | |
281 | 283 | | |
| 284 | + | |
282 | 285 | | |
283 | 286 | | |
284 | 287 | | |
| |||
401 | 404 | | |
402 | 405 | | |
403 | 406 | | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 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 | + | |
0 commit comments