Repository navigation
Commit fe19c97
fix(cloud-connection): install-local reads a composed bundle's translations and global uniques from every package body (#34428)
<!-- claude-projects-attribution: {"github_login":"os-project-manager"}
-->
Fixes #34407
Clause-②: no
Metadata-protocol: none
## 维护者速读
- **改了什么**:install-local 读组合包(`packages[]`)时,翻译(translations)和
`isolated` 姿态下的全局唯一确认(ADR-0120 D5e)都改为与样例数据相同的读法,读到每个子包里的内容。
- **为什么改**:组合包没有顶层 `translations` /
`objects`。装上后翻译一条都不加载(`translationsLoaded: 0`,中文用户看到原文标签);`isolated`
环境下子包里的 `unique: 'global'` 不经确认就装上,也不留确认记录。
- **风险与回滚**:低。平铺包、以及仍带顶层合并列表的组合包读法不变,有对照测试钉住;回滚即 revert 本 PR。
-
**先看**:`packages/cloud-connection/src/marketplace-install-local-plugin.ts`
的 `applySideEffects` 第 1 步、`evaluateGlobalUniqueGate`
及其调用处(2b);`marketplace-install-local-composed-top-level-reads.test.ts`。
- **两分钟验证**:`pnpm --filter @objectstack/cloud-connection exec vitest run
src/marketplace-install-local-composed-top-level-reads.test.ts`,预期 8/8
通过。
- **需要你做的**:无,席位落地。
## What changes
On a composed bundle (`dist/objectstack.json` with `packages[]`,
ADR-0130 D4) the package-owned collections sit in each package body and
the top level carries none. Two readers of
`MarketplaceInstallLocalPlugin` read the top level only:
1. **Translations.** `applySideEffects` step 1 read
`manifest.translations`, so install, reseed, upgrade and the restart
rehydrate answered `translationsLoaded: 0` and loaded no labels. It now
reads `resolveStackCollection(manifest, 'translations')`.
2. **The ADR-0120 D5e ceremony.** `evaluateGlobalUniqueGate` ran
`collectGlobalUniques(manifest?.objects)`, so on an `isolated`
deployment a composed app's installation-wide uniques were never listed:
the install answered 200 with no confirmation asked and no
`globalUniqueAttestation` recorded. It now reads
`resolveStackCollection(manifest, 'objects')`.
Both use the reader the seed datasets already use since #34403: the
top-level list when the body carries one (a flat bundle, or a composed
artifact still carrying its flattened union, read once), otherwise every
package body's, in package order.
The gate now walks `packages`, so a `packages` the resolver refuses
throws there. The call site answers that refusal itself: the resolver's
declared 4xx and code (for example 422 `INVALID_ARTIFACT_PACKAGES`), and
nothing is written. An undeclared throw is rethrown. This only happens
under `isolated`, because the gate returns before reading objects under
any other posture. In the translations step a refusal lands in that
step's existing catch (a warn, no translations loaded), the same way any
other failure of that step is handled.
## Tests
New file `marketplace-install-local-composed-top-level-reads.test.ts` (8
cases) goes through the real install route handler and the
`kernel:ready` rehydrate:
- composed install loads 3 locale bundles in package order (core before
the module that depends on it, which is listed first in the array); a
restart loads them again;
- controls: a flat bundle loads its 1 bundle unchanged; a composed
artifact with a flattened top-level `translations` loads the union once
(3, not 6);
- `isolated`: a composed install stops 409
`UNIQUE_SCOPE_CONFIRMATION_REQUIRED` listing both package bodies'
uniques, core first, and writes no ledger entry; confirming records the
attestation for both; control: a flattened top-level `objects` lists
each unique once; a refused `packages` answers 422
`INVALID_ARTIFACT_PACKAGES` and writes nothing.
<details><summary>Red first, green at head</summary>
- Base `857941dbe8`, plugin source as on main, same test file: `Tests 5
failed | 3 passed (8)`. The 3 controls pass and the 5 composed cases
fail (`expected +0 to be 3`, `expected [] to deeply equal [...]`, the
composed `isolated` install answering 200, no attestation, and the
refused `packages` answering 503).
- Reverse verification after the fix was committed: the plugin restored
from `857941dbe8` (hash equal to the base blob, both new reader lines
counted 0 on disk), the same 5 fail and 3 pass. Restored with `git
checkout HEAD -- PATH`, hash equal to the HEAD blob, `git diff HEAD`
empty.
- At head: the new file plus `posture-gate` and `composed-bundle-seeds`
give `Test Files 3 passed (3)`, `Tests 33 passed (33)`.
</details>
## Acceptance notes
- Item 2 premise holds. The gate is reachable through the install door:
a composed artifact under `OS_TENANCY_POSTURE=isolated` installed 200
with its package bodies' `unique: 'global'` unasked.
- `applySideEffects` still reads a top-level array `i18n` as extra
bundles. `i18n` is a config object in the spec
(`TranslationConfigSchema`), so that read never matches spec-valid
metadata. It is left unchanged.
- Other top-level-only reads of package-owned collections in this
plugin, reported and not fixed here (the dispatch scoped the card to the
two items):
- `datasources` (`declaredDatasources`): `connectDeclaredDatasources`,
on install step 4b′ and the rehydrate, and the held-name check at step
2a. Measured in this route harness: a composed bundle whose package body
declares a datasource hands `connectPackageDatasources` `datasources:
[]` and `objects: []`, and the answer carries no `datasources`. The flat
control connects it.
- `connectors` (`describeInstalledCredentialRefs`): code-read only, not
measured.
- Separate from these reads: when the resolver refuses a body at step
2c″ (a malformed `packages`, or a package entry the entry schema
refuses, such as a retired bare `indexes[].unique: true`), the door
answers 503 `SERVICE_UNAVAILABLE` "Retry once the database answers"
instead of a 4xx refusal. Measured on base and still present under the
`single` posture at head.
## Verification
<details><summary>Local readings at head c98999c</summary>
- `pnpm --filter @objectstack/cloud-connection typecheck`: both programs
(`tsc --noEmit`, `-p tsconfig.test.json`) clean. `pnpm --filter
@objectstack/cloud-connection test`: `Test Files 85 passed (85)`, `Tests
1246 passed (1246)`. Lock verdict `command-exit 0`.
- `dispatch-gates --commands`: 71 derived families, 70 exit 0, 1 NOT
MEASURED (`check:dual-build-cjs-loads`, exit 3 PREREQUISITE NOT MET: it
reads every package's `dist/`; CI runs it). `--ran` reconciliation: 71
accounted, 0 unrun.
- `git merge-tree` against every open PR touching
`packages/cloud-connection/src/marketplace-install-local*` (#34418,
#34316, #34419) and the `claude/issue-34405-install-local-landed-keys`
branch: no conflict with any of them. Against `origin/main`
`9e6fee19ea`: clean too.
- Full dogfood: not owed, since there is no `!` and no `(narrowing)`
arm.
</details>
---
_Generated by [Claude
Code](https://claude.ai/code/session_01FEkQ5pHNFS9mn8hS13iGyL)_
<!-- signed: repo:objectstack#1 · os-project-manager ·
session_01FEkQ5pHNFS9mn8hS13iGyL -->
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 69949ae commit fe19c97
3 files changed
Lines changed: 322 additions & 6 deletions
File tree
- .changeset
- packages/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 | |
|---|---|---|---|
| |||
| 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 | + | |
| 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 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3026 | 3026 | | |
3027 | 3027 | | |
3028 | 3028 | | |
3029 | | - | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
3030 | 3049 | | |
3031 | 3050 | | |
3032 | 3051 | | |
| |||
4737 | 4756 | | |
4738 | 4757 | | |
4739 | 4758 | | |
4740 | | - | |
| 4759 | + | |
| 4760 | + | |
| 4761 | + | |
| 4762 | + | |
| 4763 | + | |
| 4764 | + | |
| 4765 | + | |
| 4766 | + | |
| 4767 | + | |
4741 | 4768 | | |
4742 | 4769 | | |
4743 | 4770 | | |
| |||
7105 | 7132 | | |
7106 | 7133 | | |
7107 | 7134 | | |
7108 | | - | |
7109 | | - | |
7110 | | - | |
| 7135 | + | |
| 7136 | + | |
| 7137 | + | |
| 7138 | + | |
| 7139 | + | |
7111 | 7140 | | |
7112 | 7141 | | |
7113 | 7142 | | |
| |||
7139 | 7168 | | |
7140 | 7169 | | |
7141 | 7170 | | |
| 7171 | + | |
| 7172 | + | |
| 7173 | + | |
| 7174 | + | |
| 7175 | + | |
| 7176 | + | |
| 7177 | + | |
| 7178 | + | |
7142 | 7179 | | |
7143 | 7180 | | |
7144 | | - | |
| 7181 | + | |
7145 | 7182 | | |
7146 | 7183 | | |
7147 | 7184 | | |
| |||
0 commit comments