diff --git a/.changeset/34336-composed-bundle-seeds.md b/.changeset/34336-composed-bundle-seeds.md new file mode 100644 index 00000000000..9fe7de6e062 --- /dev/null +++ b/.changeset/34336-composed-bundle-seeds.md @@ -0,0 +1,14 @@ +--- +'@objectstack/cloud-connection': patch +--- + +fix(cloud-connection): install-local seeds a composed bundle's package datasets on install, reseed, upgrade and restart + +Clause-②: no +Metadata-protocol: none + +A composed bundle (`dist/objectstack.json` with `packages[]`, the ADR-0130 D4 publish shape) carries its seed datasets inside each package body and has no top-level `data`. Every seed door of `MarketplaceInstallLocalPlugin` read the top-level `data` only, so such a bundle installed with no sample data: the install, the reseed and an upgrade reported `seeded: { mode: 'skipped', reason: 'no-datasets' }`, nothing was shared for the per-organization replay of new organizations, the restart heal had nothing to seed, the purge answered `NOTHING_TO_PURGE`, the sample-data count answered `0`, and the installed-apps listing answered `withSampleData: false`. + +Every one of those doors now reads the seed datasets through `resolveStackCollection(body, 'data')` from `@objectstack/core`: the top-level `data` when the body carries one, otherwise each package body's, in the artifact's package order (the dependency order the packages register in). A flat bundle, and a composed artifact that still carries its flattened top-level `data`, read exactly that list, once, as before. + +An upgrade seeds the incoming version's datasets into the organization the request acts in (or the single-tenant database), the same as a flat bundle's upgrade, so a package an upgrade adds gets its sample rows there. Organizations other than the caller's are not reseeded by an upgrade, for a flat bundle or a composed one. diff --git a/packages/cloud-connection/src/local-manifest-source.ts b/packages/cloud-connection/src/local-manifest-source.ts index 15aaf2c0f14..9ee8295638b 100644 --- a/packages/cloud-connection/src/local-manifest-source.ts +++ b/packages/cloud-connection/src/local-manifest-source.ts @@ -436,6 +436,16 @@ export class LocalManifestSource { } } + /** + * [#34336] The basename of this manifest id's ledger file, as it sits on + * disk (`SkippedManifestEntry.file`'s spelling) — for a caller that read the + * entry and then found its body unusable, so the answer names the file to + * repair the same way a failed read does. + */ + fileNameOf(manifestId: string): string { + return safeFilename(manifestId); + } + /** Whether the ledger holds an entry for this manifest id. */ has(manifestId: string): boolean { return existsSync(this.fileFor(manifestId)); diff --git a/packages/cloud-connection/src/marketplace-install-local-composed-bundle-seeds.test.ts b/packages/cloud-connection/src/marketplace-install-local-composed-bundle-seeds.test.ts new file mode 100644 index 00000000000..4d94fbc1a97 --- /dev/null +++ b/packages/cloud-connection/src/marketplace-install-local-composed-bundle-seeds.test.ts @@ -0,0 +1,320 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * [#34336, ADR-0130 D4] The seed datasets of a COMPOSED bundle reach every + * seed door of install-local. + * + * A multi-package `dist/objectstack.json` carries `packages[]`, one assembled + * body per package, and no flattened `data` beside it: the seed datasets sit + * in each package body. Every door of this plugin that reads seed datasets + * read the top-level `data` alone, so a composed bundle installed, reseeded, + * upgraded, purged, counted and rehydrated as a package with no sample data + * ("no-datasets"). Each door now reads them through one reader, + * `resolveStackCollection(body, 'data')`: the top-level list when the body + * carries one, otherwise every package body's, in the artifact's package + * order (dependency-topological, the order the packages register in). + * + * The flat-bundle control pins that a body with a top-level `data` reads + * exactly that list, and the composed control that a composed artifact which + * still carries a flattened top-level `data` reads it once, never twice. + */ + +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; +import { mkdtempSync, rmSync } from 'node:fs'; +import { join } from 'node:path'; +import { tmpdir } from 'node:os'; + +/** Every request the (mocked) seed loader was handed, in order. */ +let loadCalls: any[] = []; +let seedResult: any; + +vi.mock('@objectstack/runtime', () => ({ + SeedLoaderService: class { + async load(request: any) { loadCalls.push(request); return seedResult; } + async buildDependencyGraph(objects: string[]) { return { objects }; } + }, + // The locale is not this suite's subject (marketplace-install-local-seed-replayer.test.ts pins it). + resolveSeedLocaleForLoad: async () => undefined, + appDefaultSeedLocale: () => undefined, + describeSeedLocale: () => 'none', +})); +// Only the seed-request parse is stubbed; every other export stays the real one. +vi.mock('@objectstack/spec/data', async (importOriginal) => ({ + ...(await importOriginal()), + SeedLoaderRequestSchema: { parse: (x: any) => x }, +})); +// The purge, the count and the listing's row match: what each door was handed. +const purgeCalls: any[] = []; +const countCalls: any[] = []; +const matchCalls: any[] = []; +vi.mock('./marketplace-install-local-purge.js', async (importOriginal) => ({ + ...(await importOriginal()), + purgeSeedRows: async (args: any) => { purgeCalls.push(args); return { deleted: 1, skipped: 0, errors: [] }; }, + countSeedRows: async (args: any) => { countCalls.push(args); return { count: 1, unidentified: 0 }; }, + matchSeedRows: async (args: any) => { matchCalls.push(args); return { rows: [{ id: 'r1' }] }; }, +})); + +import { MarketplaceInstallLocalPlugin } from './marketplace-install-local-plugin.js'; +import { installerAuthService, withInstallerGrants } from './install-local-principal.fixtures.js'; +import { LocalManifestSource } from './local-manifest-source.js'; + +type Handler = (c: any) => Promise; + +const ROUTE = '/api/v1/marketplace/install-local'; +const SUITE = 'com.example.suite'; + +const CORE_DATA = { object: 'crm_account', records: [{ name: '华东客户' }, { name: '华南客户' }] }; +const O2C_DATA = { object: 'crm_order', records: [{ name: 'SO-0001' }] }; +const PSA_DATA = { object: 'crm_project', records: [{ name: 'PRJ-0001' }] }; + +const body = (id: string, version: string, object: string, data: unknown, dependencies?: Record) => ({ + manifest: { + id, + name: id, + version, + type: 'module', + ...(dependencies ? { dependencies } : {}), + objects: [{ name: object, label: object, fields: { name: { type: 'text', label: 'Name' } } }], + data: [data], + }, +}); + +/** + * A composed artifact: `packages[]` and no top-level `data`. The order module + * is listed FIRST and depends on the core one, so the artifact's package order + * (core, then orders) is not its array order. + */ +const composed = (version: string, withPsa = false) => ({ + id: SUITE, + name: 'Suite', + version, + type: 'app', + packages: [ + body(`${SUITE}.o2c`, version, 'crm_order', O2C_DATA, { [`${SUITE}.core`]: '*' }), + body(`${SUITE}.core`, version, 'crm_account', CORE_DATA), + ...(withPsa ? [body(`${SUITE}.psa`, version, 'crm_project', PSA_DATA, { [`${SUITE}.core`]: '*' })] : []), + ], +}); + +const FLAT = { + id: 'com.example.flat', + version: '1.0.0', + objects: [{ name: 'crm_account', label: 'Account', fields: { name: { type: 'text', label: 'Name' } } }], + data: [CORE_DATA], +}; + +/** What a dataset list comes to, by object and record names: the reader's answer, not the parse's defaults. */ +const shape = (datasets: any[] | undefined) => + (datasets ?? []).map((d: any) => `${d.object}:${(d.records ?? []).map((r: any) => r.name).join('|')}`); +const CORE = shape([CORE_DATA])[0]; +const O2C = shape([O2C_DATA])[0]; +const PSA = shape([PSA_DATA])[0]; + +function makeRawApp() { + const routes = new Map(); + return { + routes, + get: (p: string, h: Handler) => routes.set(`GET ${p}`, h), + post: (p: string, h: Handler) => routes.set(`POST ${p}`, h), + delete: (p: string, h: Handler) => routes.set(`DELETE ${p}`, h), + }; +} + +function makeC(reqBody: any, manifestId?: string) { + const json = vi.fn((payload: any, status?: number) => ({ payload, status: status ?? 200 })); + return { + req: { + url: `http://localhost:3000${ROUTE}`, + raw: new Request(`http://localhost:3000${ROUTE}`), + json: async () => reqBody, + param: (k: string) => (k === 'manifestId' ? manifestId : undefined), + header: () => undefined, + query: () => undefined, + }, + json, + }; +} + +/** One runtime over the ledger directory: a fresh plugin, booted through `kernel:ready`. */ +async function boot(dir: string) { + const rawApp = makeRawApp(); + const hooks = new Map(); + const services: Record = { + manifest: { register: vi.fn() }, + auth: installerAuthService(), + objectql: withInstallerGrants({ syncSchemas: async () => undefined }), + metadata: {}, + }; + const ctx = { + hook: (e: string, h: any) => hooks.set(e, h), + getService: (name: string) => { + if (name === 'http-server') return { getRawApp: () => rawApp }; + const svc = services[name]; + if (svc === undefined) throw new Error(`no ${name}`); + return svc; + }, + registerService: (name: string, svc: unknown) => { services[name] = svc; }, + logger: { info: vi.fn(), warn: vi.fn(), error: vi.fn(), debug: vi.fn() }, + }; + const plugin = new MarketplaceInstallLocalPlugin({ controlPlaneUrl: 'off', storageDir: dir }); + await plugin.start(ctx as any); + await hooks.get('kernel:ready')?.(); + const route = (key: string) => rawApp.routes.get(key)!; + return { + install: (manifest: unknown) => route(`POST ${ROUTE}`)(makeC({ manifest })), + reseed: (id: string) => route(`POST ${ROUTE}/:manifestId/reseed-sample-data`)(makeC({}, id)), + purge: (id: string) => route(`POST ${ROUTE}/:manifestId/purge-sample-data`)(makeC({}, id)), + count: (id: string) => route(`GET ${ROUTE}/:manifestId/sample-data`)(makeC({}, id)), + list: () => route(`GET ${ROUTE}`)(makeC({})), + /** The kernel's shared `seed-datasets` list — what the per-organization replay seeds a new organization from. */ + sharedSeedDatasets: () => services['seed-datasets'] as any[] | undefined, + }; +} + +let dir: string; +beforeEach(() => { + dir = mkdtempSync(join(tmpdir(), 'mil-composed-seeds-')); + loadCalls = []; + purgeCalls.length = 0; + countCalls.length = 0; + matchCalls.length = 0; + seedResult = { summary: { totalInserted: 3, totalUpdated: 0, totalSkipped: 0 }, errors: [] }; +}); +afterEach(() => { rmSync(dir, { recursive: true, force: true }); vi.restoreAllMocks(); }); + +describe('a composed bundle: every seed door reads each package body, in package order', () => { + it('install seeds every package body\'s datasets, core before the module that depends on it, and shares them for new organizations', async () => { + const rt = await boot(dir); + const res = await rt.install(composed('6.3.0')); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(res.payload.data.seeded).toMatchObject({ mode: 'inline', inserted: 3 }); + expect(loadCalls).toHaveLength(1); + expect(shape(loadCalls[0].seeds)).toEqual([CORE, O2C]); + expect(shape(rt.sharedSeedDatasets())).toEqual([CORE, O2C]); + }); + + it('reseed loads them again', async () => { + const rt = await boot(dir); + expect((await rt.install(composed('6.3.0'))).status).toBe(200); + loadCalls = []; + const res = await rt.reseed(SUITE); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(res.payload.data).toMatchObject({ manifestId: SUITE, inserted: 3, withSampleData: true }); + expect(shape(loadCalls[0].seeds)).toEqual([CORE, O2C]); + }); + + it('an upgrade that adds a package seeds the incoming version\'s datasets, the added package\'s included', async () => { + const rt = await boot(dir); + expect((await rt.install(composed('6.3.0'))).status).toBe(200); + loadCalls = []; + const res = await rt.install(composed('6.4.0', true)); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(res.payload.data.upgradedFrom).toBe('previous-marketplace-version'); + expect(shape(loadCalls[0].seeds)).toEqual(expect.arrayContaining([CORE, O2C, PSA])); + expect(shape(loadCalls[0].seeds)).toHaveLength(3); + // Package order: the core body before both modules that depend on it. + expect(shape(loadCalls[0].seeds)[0]).toBe(CORE); + }); + + it('the sample-data count and the purge match the rows of every package body', async () => { + const rt = await boot(dir); + expect((await rt.install(composed('6.3.0'))).status).toBe(200); + + const counted = await rt.count(SUITE); + expect(counted.status, JSON.stringify(counted.payload)).toBe(200); + expect(counted.payload.data).toEqual({ manifestId: SUITE, count: 1, unidentified: 0 }); + expect(shape(countCalls[0].datasets)).toEqual([CORE, O2C]); + + const purged = await rt.purge(SUITE); + expect(purged.status, JSON.stringify(purged.payload)).toBe(200); + expect(shape(purgeCalls[0].datasets)).toEqual([CORE, O2C]); + }); + + it('the installed-apps listing reads the package\'s sample data from every package body', async () => { + const rt = await boot(dir); + expect((await rt.install(composed('6.3.0'))).status).toBe(200); + const res = await rt.list(); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + const entry = res.payload.data.items.find((e: any) => e.manifestId === SUITE); + expect(shape(matchCalls[0]?.datasets)).toEqual([CORE, O2C]); + expect(entry?.withSampleData).toBe(true); + }); + + it('a restart shares them for new organizations and heals an empty database from them', async () => { + const first = await boot(dir); + expect((await first.install(composed('6.3.0'))).status).toBe(200); + loadCalls = []; + + const restarted = await boot(dir); + expect(shape(restarted.sharedSeedDatasets())).toEqual([CORE, O2C]); + // Single-tenant, every seeded object empty: the heal seeds the package bodies. + expect(loadCalls).toHaveLength(1); + expect(shape(loadCalls[0].seeds)).toEqual([CORE, O2C]); + }); +}); + +describe('controls: a body that carries a top-level data reads that list, once', () => { + it('a flat bundle seeds its top-level data, unchanged', async () => { + const rt = await boot(dir); + const res = await rt.install(FLAT); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(shape(loadCalls[0].seeds)).toEqual([CORE]); + expect(shape(rt.sharedSeedDatasets())).toEqual([CORE]); + }); + + it('a composed artifact that still carries its flattened top-level data seeds that union once, never per package as well', async () => { + const rt = await boot(dir); + const res = await rt.install({ ...composed('6.3.0'), data: [CORE_DATA, O2C_DATA] }); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(shape(loadCalls[0].seeds)).toEqual([CORE, O2C]); + }); + + it('a composed artifact with no dataset in any package body still answers no-datasets', async () => { + const rt = await boot(dir); + const bare = composed('6.3.0'); + for (const p of bare.packages) delete (p.manifest as any).data; + const res = await rt.install(bare); + expect(res.status, JSON.stringify(res.payload)).toBe(200); + expect(res.payload.data.seeded).toEqual({ mode: 'skipped', reason: 'no-datasets' }); + expect(loadCalls).toHaveLength(0); + }); +}); + +/** + * A ledger entry whose body the resolver refuses — a `packages` that is present + * but is not an array (ADR-0112 `INVALID_ARTIFACT_PACKAGES`) — reaches the purge + * and the count as the answer those doors give an unreadable entry: the stable + * `MARKETPLACE_STORAGE_FAILED` 500 naming the ledger file to repair, never a + * throw into the route's error path with no entry named. + */ +describe('purge and count over a ledger body the resolver refuses', () => { + async function installThenCorrupt() { + const rt = await boot(dir); + expect((await rt.install(composed('6.3.0'))).status).toBe(200); + const ledger = new LocalManifestSource(dir); + const { entry } = ledger.read(SUITE); + ledger.write({ ...entry!, manifest: { ...(entry!.manifest as object), packages: 'not-a-list' } } as any); + // The ledger file's basename, as it sits on disk. + return { rt, file: `${SUITE}.json` }; + } + + it('the purge answers the unreadable-entry 500 naming the ledger file, and deletes nothing', async () => { + const { rt, file } = await installThenCorrupt(); + const res = await rt.purge(SUITE); + expect(res.status).toBe(500); + expect(res.payload.success).toBe(false); + expect(res.payload.error.code).toBe('MARKETPLACE_STORAGE_FAILED'); + expect(res.payload.error.message).toContain(file); + expect(purgeCalls).toHaveLength(0); + }); + + it('the count answers the same', async () => { + const { rt, file } = await installThenCorrupt(); + const res = await rt.count(SUITE); + expect(res.status).toBe(500); + expect(res.payload.success).toBe(false); + expect(res.payload.error.code).toBe('MARKETPLACE_STORAGE_FAILED'); + expect(res.payload.error.message).toContain(file); + expect(countCalls).toHaveLength(0); + }); +}); diff --git a/packages/cloud-connection/src/marketplace-install-local-plugin.ts b/packages/cloud-connection/src/marketplace-install-local-plugin.ts index 9d8a99a29ed..f8c52c477ed 100644 --- a/packages/cloud-connection/src/marketplace-install-local-plugin.ts +++ b/packages/cloud-connection/src/marketplace-install-local-plugin.ts @@ -249,6 +249,10 @@ import { declaredDependencyIds, credentialUseClientFor, transportPeerAddressOf, + // [#34336, ADR-0130 D4] The one reader of a package-owned collection across + // both artifact shapes: every seed door reads `data` through it + // ({@link seedDatasetsOf}). + resolveStackCollection, } from '@objectstack/core'; import { resolveTenancyPosture, @@ -1224,14 +1228,27 @@ function unmanagedCopyBaseManifest(ctx: PluginContext, baseId: string): unknown } /** - * The seed datasets a cached manifest bundles: its `data[]` entries that name - * an object and carry records. One reading for the two doors that match seed - * rows — the purge, and the listing's `withSampleData` (#21775). + * The seed datasets a package body bundles: its `data[]` entries that name an + * object and carry records. The ONE reading for every seed door of this + * plugin — the install, the reseed and the upgrade (through + * `applySideEffects`), the rehydrate's share and its heal, the purge, the + * sample-data count and the listing's `withSampleData` (#21775). + * + * [#34336, ADR-0130 D4] Read through `resolveStackCollection(body, 'data')`: + * the top-level `data` when the body carries one (a flat bundle, or a composed + * artifact that still carries its flattened union — read once, never again per + * package), otherwise every package body's, in the artifact's package order + * (the dependency order the packages register in). A composed bundle + * (`dist/objectstack.json` with `packages[]`) carries no top-level `data`, and + * a top-level-only read answered "no-datasets" for every one of its doors. + * + * @throws The resolver's ADR-0112 refusal for a malformed `packages` + * (`INVALID_ARTIFACT_PACKAGES`, `INVALID_ARTIFACT_PACKAGE_ENTRY`, …) — the + * refusal the `manifest` service raises on the same bytes. */ -function seedDatasetsOf(manifest: any): PurgeSeedDataset[] { - return Array.isArray(manifest?.data) - ? manifest.data.filter((d: any) => d && d.object && Array.isArray(d.records)) - : []; +function seedDatasetsOf(body: unknown): PurgeSeedDataset[] { + return resolveStackCollection(body, 'data') + .filter((d: any) => d && d.object && Array.isArray(d.records)) as PurgeSeedDataset[]; } /** @@ -1840,9 +1857,16 @@ export class MarketplaceInstallLocalPlugin implements Plugin { * Never throws — a failed heal logs and leaves the boot untouched. */ private maybeHealSampleData = async (ctx: PluginContext, entry: InstalledEntry, converted: any): Promise => { - const datasets = Array.isArray(converted?.data) - ? converted.data.filter((d: any) => d && d.object && Array.isArray(d.records)) - : []; + // [#34336] Every package body's datasets, through the one reader. The + // register above already judged these bytes, so a refusal here is not + // expected; it is said once and the boot continues unhealed. + let datasets: PurgeSeedDataset[]; + try { + datasets = seedDatasetsOf(converted); + } catch (err: any) { + ctx.logger?.warn?.(`[MarketplaceInstallLocal] sample-data heal for ${entry.manifestId} skipped: its seed datasets could not be read: ${err?.message ?? err}`); + return; + } if (datasets.length === 0) return; if (entry.sampleDataPurged === true) return; if (organizationWallActive(ctx)) { @@ -3535,9 +3559,26 @@ export class MarketplaceInstallLocalPlugin implements Plugin { */ private sampleDataInScope = async (c: any, ctx: PluginContext, entries: InstalledEntry[]): Promise> => { const present = new Set(); + // [#34336] A ledger body whose `packages` the resolver refuses answers + // `false` with the reason at `warn`, as every other unread entry does — + // never a refusal of the whole listing. + const unreadBodies: Array<{ manifestId: string; why: string }> = []; const seeded = entries - .map((entry) => ({ entry, datasets: seedDatasetsOf(entry.manifest) })) + .map((entry) => { + try { + return { entry, datasets: seedDatasetsOf(entry.manifest) }; + } catch (err: any) { + unreadBodies.push({ manifestId: entry.manifestId, why: `its seed datasets could not be read: ${err?.message ?? err}` }); + return { entry, datasets: [] as PurgeSeedDataset[] }; + } + }) .filter(({ datasets }) => datasets.length > 0); + for (const { manifestId, why } of unreadBodies) { + ctx.logger?.warn?.( + `[MarketplaceInstallLocal] ${manifestId}: the installed-apps listing could not read this package's ` + + `seed rows (${why}), so it answers withSampleData: false for it`, + ); + } if (seeded.length === 0) return present; let organizationId: string | undefined; @@ -6024,7 +6065,33 @@ export class MarketplaceInstallLocalPlugin implements Plugin { const incompatible = this.refuseProtocolIncompatibleEntry(c, entry); if (incompatible) return incompatible; - return this.purgeSeedDatasets(c, ctx, manifestId, seedDatasetsOf(entry.manifest), entry); + const read = this.ledgerSeedDatasets(c, ctx, manifestId, entry, 'purge sample data'); + if ('response' in read) return read.response; + return this.purgeSeedDatasets(c, ctx, manifestId, read.datasets, entry); + }; + + /** + * [#34336] The seed datasets of a ledger entry the purge or the count acts + * on ({@link seedDatasetsOf}), or — when the resolver refuses the entry's + * body (a malformed `packages`, ADR-0112) — the answer the two doors give + * an unreadable entry ({@link unreadableLedgerEntry}), naming the ledger + * file and quoting the refusal, instead of a throw that reaches the route's + * error path with no entry named. + */ + private ledgerSeedDatasets = ( + c: any, + ctx: PluginContext, + manifestId: string, + entry: InstalledEntry, + attempted: string, + ): { datasets: PurgeSeedDataset[] } | { response: Response } => { + try { + return { datasets: seedDatasetsOf(entry.manifest) }; + } catch (cause) { + return { + response: this.unreadableLedgerEntry(c, ctx, manifestId, { file: this.ledger.fileNameOf(manifestId), cause }, attempted), + }; + } }; /** @@ -6325,7 +6392,9 @@ export class MarketplaceInstallLocalPlugin implements Plugin { } const incompatible = this.refuseProtocolIncompatibleEntry(c, entry); if (incompatible) return incompatible; - datasets = seedDatasetsOf(entry.manifest); + const read = this.ledgerSeedDatasets(c, ctx, manifestId, entry, 'count sample data'); + if ('response' in read) return read.response; + datasets = read.datasets; } if (datasets.length === 0) return answer(0, 0); @@ -6911,10 +6980,11 @@ export class MarketplaceInstallLocalPlugin implements Plugin { * into the i18n service — auto-creating an in-memory fallback if * none is registered, matching AppPlugin's behaviour. * - * 2. Merge `manifest.data` (an array of seed datasets) into the - * kernel's `seed-datasets` service so SecurityPlugin's per-org - * replay middleware picks them up on every future - * sys_organization insert. + * 2. Merge the package's seed datasets ({@link seedDatasetsOf}: the + * top-level `data`, or every package body's in package order for a + * composed bundle, #34336) into the kernel's `seed-datasets` service + * so SecurityPlugin's per-org replay middleware picks them up on + * every future sys_organization insert. * * 3. When `seedNow=true`, also run the seed immediately so the user * sees demo data without having to create a new org: @@ -6980,9 +7050,18 @@ export class MarketplaceInstallLocalPlugin implements Plugin { } // ── 2. Seed datasets — merge into kernel service ───────────────── - const datasets = Array.isArray(manifest?.data) - ? manifest.data.filter((d: any) => d && d.object && Array.isArray(d.records)) - : []; + // [#34336] Through the one reader, so a composed bundle's package + // bodies are seeded too. Every caller hands a body the `manifest` + // service already registered, so a refusal here is not expected; it + // is reported in the summary rather than thrown, per this method's + // contract. + let datasets: PurgeSeedDataset[] = []; + try { + datasets = seedDatasetsOf(manifest); + } catch (err: any) { + seedSummary = { mode: 'skipped', reason: `seed-datasets-unread: ${err?.message ?? err}` }; + ctx.logger?.warn?.(`[MarketplaceInstallLocal] ${appId}: its seed datasets could not be read, so none were merged or seeded: ${err?.message ?? err}`); + } if (datasets.length > 0) { try {