Skip to content

Commit fe19c97

Browse files
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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
'@objectstack/cloud-connection': patch
3+
---
4+
5+
fix(cloud-connection): install-local loads a composed bundle's translations and asks about its installation-wide uniques
6+
7+
Clause-②: no
8+
Metadata-protocol: none
9+
10+
A composed bundle (`dist/objectstack.json` with `packages[]`, the ADR-0130 D4 publish shape) carries its `translations` and its `objects` inside each package body, with no top-level copy. Two readers of `MarketplaceInstallLocalPlugin` read the top level only:
11+
12+
- the install's side effects loaded no translations (`translationsLoaded: 0`, on install, reseed, upgrade and restart), so a composed app's labels never reached the i18n service and zh-CN users saw the source language;
13+
- the ADR-0120 D5e ceremony on an `isolated` deployment listed none of the package bodies' installation-wide uniques (`unique: 'global'`, a declared index's `unique: 'global'`), so a composed app installed without the confirmation and with no attestation recorded.
14+
15+
Both now read through `resolveStackCollection` from `@objectstack/core`, the reader the seed datasets already use: the top-level list when the body carries one, otherwise each package body's, in the artifact's package order. A flat bundle, and a composed artifact that still carries its flattened top-level list, read exactly that list, once, as before. On an `isolated` deployment, a composed artifact whose `packages` the resolver refuses is answered at the ceremony with the resolver's refusal (`422`, its own code, such as `INVALID_ARTIFACT_PACKAGES`), and nothing is installed or written.
Lines changed: 264 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,264 @@
1+
// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license.
2+
3+
/**
4+
* [#34407, ADR-0130 D4] The translations and the ADR-0120 D5e global-unique
5+
* ceremony of a COMPOSED bundle read every package body, not the top level
6+
* alone.
7+
*
8+
* A multi-package `dist/objectstack.json` carries `packages[]`, one assembled
9+
* body per package, and no flattened `translations` or `objects` beside it.
10+
* Two readers of install-local read only the top level:
11+
*
12+
* - the side effects' translation step answered `translationsLoaded: 0`, so a
13+
* composed app's labels never reached the i18n service (zh-CN users read the
14+
* source language);
15+
* - the `isolated`-posture ceremony collected the installation-wide uniques of
16+
* the top-level `objects` only, so a composed app's `unique: 'global'`
17+
* installed with no question asked and no attestation recorded.
18+
*
19+
* Both now read through `resolveStackCollection`, the reader the seed datasets
20+
* use (`marketplace-install-local-composed-bundle-seeds.test.ts`): the
21+
* top-level list when the body carries one, otherwise every package body's, in
22+
* the artifact's package order. The controls pin that a flat bundle reads its
23+
* own top-level list unchanged, and that a composed artifact which still
24+
* carries its flattened union reads it once, never once more per package.
25+
*/
26+
27+
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
28+
import { mkdtempSync, rmSync } from 'node:fs';
29+
import { join } from 'node:path';
30+
import { tmpdir } from 'node:os';
31+
32+
vi.mock('@objectstack/runtime', () => ({
33+
SeedLoaderService: class {
34+
async load() { return { summary: { totalInserted: 0, totalUpdated: 0, totalSkipped: 0 }, errors: [] }; }
35+
async buildDependencyGraph(objects: string[]) { return { objects }; }
36+
},
37+
resolveSeedLocaleForLoad: async () => undefined,
38+
appDefaultSeedLocale: () => undefined,
39+
describeSeedLocale: () => 'none',
40+
}));
41+
42+
import { MarketplaceInstallLocalPlugin } from './marketplace-install-local-plugin.js';
43+
import { declareInstallerPlatformOwner, installerAuthService, withInstallerGrants } from './install-local-principal.fixtures.js';
44+
import { LocalManifestSource } from './local-manifest-source.js';
45+
46+
type Handler = (c: any) => Promise<any>;
47+
48+
const ROUTE = '/api/v1/marketplace/install-local';
49+
const SUITE = 'com.example.suite';
50+
51+
const CORE_ZH = { 'zh-CN': { objects: { crm_account: { label: '客户' } } } };
52+
const O2C_ZH = { 'zh-CN': { objects: { crm_order: { label: '订单' } } }, 'ja-JP': { objects: { crm_order: { label: '注文' } } } };
53+
54+
const body = (id: string, version: string, object: Record<string, unknown>, translations: unknown[], dependencies?: Record<string, string>) => ({
55+
manifest: {
56+
id,
57+
name: id,
58+
version,
59+
type: 'module',
60+
...(dependencies ? { dependencies } : {}),
61+
objects: [object],
62+
translations,
63+
},
64+
});
65+
66+
const ACCOUNT = { name: 'crm_account', label: 'Account', fields: { name: { type: 'text', label: 'Name' }, tax_id: { type: 'text', label: 'Tax ID', unique: 'global' } } };
67+
const ORDER = {
68+
name: 'crm_order',
69+
label: 'Order',
70+
fields: { name: { type: 'text', label: 'Name', unique: true } },
71+
indexes: [{ name: 'uk_order_ext', fields: ['external_id'], unique: 'global' }],
72+
};
73+
/** The installation-wide uniques the two package bodies declare, core first. */
74+
const COMPOSED_FINDINGS = ['crm_account:field:tax_id', 'crm_order:index:external_id'];
75+
76+
/**
77+
* A composed artifact: `packages[]` and no top-level `translations` or
78+
* `objects`. The order module is listed FIRST and depends on the core one, so
79+
* the artifact's package order (core, then orders) is not its array order.
80+
*/
81+
const composed = (version = '6.3.0') => ({
82+
id: SUITE,
83+
name: 'Suite',
84+
version,
85+
type: 'app',
86+
packages: [
87+
body(`${SUITE}.o2c`, version, ORDER, [O2C_ZH], { [`${SUITE}.core`]: '*' }),
88+
body(`${SUITE}.core`, version, ACCOUNT, [CORE_ZH]),
89+
],
90+
});
91+
92+
const FLAT = {
93+
id: 'com.example.flat',
94+
version: '1.0.0',
95+
objects: [ACCOUNT],
96+
translations: [CORE_ZH],
97+
};
98+
99+
function makeRawApp() {
100+
const routes = new Map<string, Handler>();
101+
return {
102+
routes,
103+
get: (p: string, h: Handler) => routes.set(`GET ${p}`, h),
104+
post: (p: string, h: Handler) => routes.set(`POST ${p}`, h),
105+
delete: (p: string, h: Handler) => routes.set(`DELETE ${p}`, h),
106+
};
107+
}
108+
109+
function makeC(reqBody: any) {
110+
const json = vi.fn((payload: any, status?: number) => ({ payload, status: status ?? 200 }));
111+
return {
112+
req: {
113+
url: `http://localhost:3000${ROUTE}`,
114+
raw: new Request(`http://localhost:3000${ROUTE}`),
115+
json: async () => reqBody,
116+
param: () => undefined,
117+
header: () => undefined,
118+
query: () => undefined,
119+
},
120+
json,
121+
};
122+
}
123+
124+
/** One runtime over the ledger directory: a fresh plugin, booted through `kernel:ready`. */
125+
async function boot(dir: string) {
126+
const rawApp = makeRawApp();
127+
const hooks = new Map<string, any>();
128+
/** Every bundle the i18n service was handed, as `locale:labels`, in order. */
129+
const loaded: string[] = [];
130+
const services: Record<string, any> = {
131+
manifest: { register: vi.fn() },
132+
auth: installerAuthService(),
133+
objectql: withInstallerGrants({ syncSchemas: async () => undefined }),
134+
metadata: {},
135+
i18n: {
136+
loadTranslations: (locale: string, data: any) => {
137+
const labels = Object.values(data?.objects ?? {}).map((o: any) => o.label).join('|');
138+
loaded.push(`${locale}:${labels}`);
139+
},
140+
},
141+
};
142+
const ctx = {
143+
hook: (e: string, h: any) => hooks.set(e, h),
144+
getService: (name: string) => {
145+
if (name === 'http-server') return { getRawApp: () => rawApp };
146+
const svc = services[name];
147+
if (svc === undefined) throw new Error(`no ${name}`);
148+
return svc;
149+
},
150+
registerService: (name: string, svc: unknown) => { services[name] = svc; },
151+
logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() },
152+
};
153+
const plugin = new MarketplaceInstallLocalPlugin({ controlPlaneUrl: 'off', storageDir: dir });
154+
await plugin.start(ctx as any);
155+
await hooks.get('kernel:ready')?.();
156+
return {
157+
install: (reqBody: Record<string, unknown>) => rawApp.routes.get(`POST ${ROUTE}`)!(makeC(reqBody)),
158+
loaded,
159+
ctx,
160+
};
161+
}
162+
163+
let dir: string;
164+
let posture: string | undefined;
165+
let restoreOwner: () => void;
166+
beforeEach(() => {
167+
dir = mkdtempSync(join(tmpdir(), 'mil-composed-reads-'));
168+
posture = process.env.OS_TENANCY_POSTURE;
169+
// The request carries no organization, and the ceremony runs walled: the
170+
// installer is the deployment's declared platform owner.
171+
restoreOwner = declareInstallerPlatformOwner('admin');
172+
});
173+
afterEach(() => {
174+
restoreOwner();
175+
rmSync(dir, { recursive: true, force: true });
176+
if (posture === undefined) delete process.env.OS_TENANCY_POSTURE;
177+
else process.env.OS_TENANCY_POSTURE = posture;
178+
vi.restoreAllMocks();
179+
});
180+
181+
describe('a composed bundle: the side effects load every package body\'s translations, in package order', () => {
182+
it('install loads each package body\'s locale bundles, core before the module that depends on it', async () => {
183+
const rt = await boot(dir);
184+
const res = await rt.install({ manifest: composed() });
185+
expect(res.status, JSON.stringify(res.payload)).toBe(200);
186+
expect(res.payload.data.translationsLoaded).toBe(3);
187+
expect(rt.loaded).toEqual(['zh-CN:客户', 'zh-CN:订单', 'ja-JP:注文']);
188+
});
189+
190+
it('a restart loads them again from the ledger', async () => {
191+
const first = await boot(dir);
192+
expect((await first.install({ manifest: composed() })).status).toBe(200);
193+
194+
const restarted = await boot(dir);
195+
expect(restarted.loaded).toEqual(['zh-CN:客户', 'zh-CN:订单', 'ja-JP:注文']);
196+
});
197+
});
198+
199+
describe('controls: a body that carries top-level translations reads that list, once', () => {
200+
it('a flat bundle loads its top-level translations, unchanged', async () => {
201+
const rt = await boot(dir);
202+
const res = await rt.install({ manifest: FLAT });
203+
expect(res.status, JSON.stringify(res.payload)).toBe(200);
204+
expect(res.payload.data.translationsLoaded).toBe(1);
205+
expect(rt.loaded).toEqual(['zh-CN:客户']);
206+
});
207+
208+
it('a composed artifact that still carries its flattened top-level translations loads that union once, never per package as well', async () => {
209+
const rt = await boot(dir);
210+
const res = await rt.install({ manifest: { ...composed(), translations: [CORE_ZH, O2C_ZH] } });
211+
expect(res.status, JSON.stringify(res.payload)).toBe(200);
212+
expect(res.payload.data.translationsLoaded).toBe(3);
213+
expect(rt.loaded).toEqual(['zh-CN:客户', 'zh-CN:订单', 'ja-JP:注文']);
214+
});
215+
});
216+
217+
describe("ADR-0120 D5e — a composed bundle installed into an 'isolated' environment", () => {
218+
it('stops on the installation-wide uniques every package body declares, core first', async () => {
219+
process.env.OS_TENANCY_POSTURE = 'isolated';
220+
const rt = await boot(dir);
221+
222+
const res = await rt.install({ manifest: composed() });
223+
224+
expect(res.status, JSON.stringify(res.payload)).toBe(409);
225+
expect(res.payload.error.code).toBe('UNIQUE_SCOPE_CONFIRMATION_REQUIRED');
226+
expect(res.payload.error.details.findings.map((f: any) => f.id)).toEqual(COMPOSED_FINDINGS);
227+
expect(new LocalManifestSource(dir).read(SUITE).entry).toBeNull();
228+
});
229+
230+
it('confirming records the attestation for every package body\'s uniques and installs', async () => {
231+
process.env.OS_TENANCY_POSTURE = 'isolated';
232+
const rt = await boot(dir);
233+
234+
const res = await rt.install({ manifest: composed(), confirmGlobalUniques: true });
235+
236+
expect(res.status, JSON.stringify(res.payload)).toBe(200);
237+
expect(new LocalManifestSource(dir).read(SUITE).entry!.globalUniqueAttestation).toMatchObject({
238+
posture: 'isolated',
239+
confirmed: COMPOSED_FINDINGS.slice().sort(),
240+
});
241+
});
242+
243+
it('control: a composed artifact that still carries its flattened top-level objects lists each unique once', async () => {
244+
process.env.OS_TENANCY_POSTURE = 'isolated';
245+
const rt = await boot(dir);
246+
247+
const res = await rt.install({ manifest: { ...composed(), objects: [ACCOUNT, ORDER] } });
248+
249+
expect(res.status, JSON.stringify(res.payload)).toBe(409);
250+
expect(res.payload.error.details.findings.map((f: any) => f.id)).toEqual(COMPOSED_FINDINGS);
251+
});
252+
253+
it('a composed artifact whose packages the resolver refuses is answered with that refusal, and nothing is written', async () => {
254+
process.env.OS_TENANCY_POSTURE = 'isolated';
255+
const rt = await boot(dir);
256+
257+
const res = await rt.install({ manifest: { ...composed(), packages: 'not-a-list' } });
258+
259+
expect(res.status, JSON.stringify(res.payload)).toBe(422);
260+
expect(res.payload.success).toBe(false);
261+
expect(res.payload.error.code).toBe('INVALID_ARTIFACT_PACKAGES');
262+
expect(new LocalManifestSource(dir).read(SUITE).entry).toBeNull();
263+
});
264+
});

‎packages/cloud-connection/src/marketplace-install-local-plugin.ts‎

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3026,7 +3026,26 @@ export class MarketplaceInstallLocalPlugin implements Plugin {
30263026
// everyone.
30273027
const previousLookup = this.ledger.read(manifestId);
30283028
const previousEntry = previousLookup.entry;
3029-
const gate = this.evaluateGlobalUniqueGate(manifest, previousEntry, body, userId);
3029+
//
3030+
// [#34407] The gate reads every package body's objects, so a
3031+
// `packages` the resolver refuses (ADR-0112 `code` + its declared
3032+
// 4xx status, the refusal the `manifest` service raises on the same
3033+
// bytes) is answered here, before anything is written — never
3034+
// thrown out of the door. An undeclared throw stays a throw.
3035+
let gate: ReturnType<MarketplaceInstallLocalPlugin['evaluateGlobalUniqueGate']>;
3036+
try {
3037+
gate = this.evaluateGlobalUniqueGate(manifest, previousEntry, body, userId);
3038+
} catch (err: any) {
3039+
const refusal = resolveThrownHttpError(err);
3040+
if (refusal.declaredStatus === undefined || refusal.status >= 500) throw err;
3041+
return c.json({
3042+
success: false,
3043+
error: {
3044+
code: refusal.code,
3045+
message: `Package '${manifestId}' cannot be installed: ${String(err?.message ?? err)} Nothing was installed or written.`,
3046+
},
3047+
}, refusal.status);
3048+
}
30303049
if (gate.blocked) {
30313050
ctx.logger?.warn?.(
30323051
`[MarketplaceInstallLocal] install of ${manifestId} stopped by the ADR-0120 D5e posture gate ` +
@@ -4737,7 +4756,15 @@ export class MarketplaceInstallLocalPlugin implements Plugin {
47374756
return { blocked: false, posture, pending: [], ...(carried ? { attestation: carried } : {}) };
47384757
}
47394758

4740-
const findings = collectGlobalUniques(manifest?.objects);
4759+
// [#34407, ADR-0130 D4] The objects of every package this artifact
4760+
// delivers, through the one reader of a package-owned collection: the
4761+
// top-level `objects` when the body carries them (a flat bundle, or a
4762+
// composed artifact's flattened union — read once), otherwise every
4763+
// package body's, in package order. A composed bundle carries no
4764+
// top-level `objects`, so the top-level read listed nothing and its
4765+
// installation-wide uniques installed unasked. The resolver's refusal
4766+
// of a malformed `packages` propagates to the caller, which answers it.
4767+
const findings = collectGlobalUniques(resolveStackCollection(manifest, 'objects'));
47414768
const pending = unconfirmedGlobalUniques(findings, carried, posture);
47424769
if (pending.length === 0) {
47434770
return { blocked: false, posture, pending: [], ...(carried ? { attestation: carried } : {}) };
@@ -7105,9 +7132,11 @@ export class MarketplaceInstallLocalPlugin implements Plugin {
71057132
* Replicate the start-time side-effects that AppPlugin runs for
71067133
* statically-declared apps but the `manifest` service does NOT:
71077134
*
7108-
* 1. Load `manifest.translations` (array of `Record<locale, data>`)
7109-
* into the i18n service — auto-creating an in-memory fallback if
7110-
* none is registered, matching AppPlugin's behaviour.
7135+
* 1. Load the package's `translations` (arrays of `Record<locale, data>`:
7136+
* the top-level list, or every package body's in package order for a
7137+
* composed bundle, #34407) into the i18n service — auto-creating an
7138+
* in-memory fallback if none is registered, matching AppPlugin's
7139+
* behaviour.
71117140
*
71127141
* 2. Merge the package's seed datasets ({@link seedDatasetsOf}: the
71137142
* top-level `data`, or every package body's in package order for a
@@ -7139,9 +7168,17 @@ export class MarketplaceInstallLocalPlugin implements Plugin {
71397168
let seedSummary: any = { mode: 'skipped', reason: 'no-datasets' };
71407169

71417170
// ── 1. i18n bundles ─────────────────────────────────────────────
7171+
// [#34407, ADR-0130 D4] `translations` through the one reader of a
7172+
// package-owned collection, as the seed datasets below: the top-level
7173+
// list when the body carries one (a flat bundle, or a composed artifact
7174+
// that still carries its flattened union — read once), otherwise every
7175+
// package body's, in package order. A composed bundle carries no
7176+
// top-level `translations`, and the top-level read loaded none of its
7177+
// labels. A resolver refusal lands in this step's catch, as any other
7178+
// failure of it does.
71427179
try {
71437180
const bundles: Array<Record<string, unknown>> = [];
7144-
if (Array.isArray(manifest?.translations)) bundles.push(...manifest.translations);
7181+
bundles.push(...(resolveStackCollection(manifest, 'translations') as Array<Record<string, unknown>>));
71457182
if (Array.isArray(manifest?.i18n)) bundles.push(...manifest.i18n);
71467183

71477184
if (bundles.length > 0) {

0 commit comments

Comments
 (0)