Skip to content

Commit bb3838c

Browse files
committed
test(service-package,cloud-connection): the converted bodies keep the origin main's registry rows record
After merging main, the registry row carries the caller's origin. The marketplace pin's manifest wrapper now forwards register's options, and both door pins assert that the converted body still lands as 'authored' (sys_packages) or 'marketplace' (install, rehydrate). Claude-Session: https://claude.ai/code/session_013JuCowY7RrGXYbGEv3cWsQ Co-authored-by: Claude <noreply@anthropic.com>
1 parent 4981e64 commit bb3838c

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎packages/cloud-connection/src/marketplace-install-local-convert-forward.test.ts‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,13 @@ async function bootPlugin() {
103103
};
104104

105105
const handed: Array<{ reader: string; body: Bag }> = [];
106-
const realManifest = kernel.getService<{ register(m: unknown): unknown }>('manifest');
106+
const realManifest = kernel.getService<{ register(m: unknown, options?: unknown): unknown }>('manifest');
107107
const manifest = {
108-
register: async (body: Bag) => {
108+
register: async (body: Bag, options?: unknown) => {
109109
// The plugin also registers its own Setup UI bundle at
110110
// `kernel:ready`; only the package under test is recorded.
111111
if (body?.id === HOTCRM_ID) handed.push({ reader: 'register', body });
112-
await realManifest.register(body);
112+
await realManifest.register(body, options);
113113
},
114114
};
115115
const routes = new Map<string, Handler>();
@@ -184,7 +184,8 @@ describe('the marketplace install converts a body once and every reader of the l
184184
const { ql, handed, conversionWarnings } = await bootPlugin();
185185

186186
expectOneConvertedBody(handed, ['register', 'bindArtifactHandlers', 'applySideEffects', 'heal']);
187-
expect(ql.registry.getPackage(HOTCRM_ID)).toBeDefined();
187+
// The converted body still registers as a marketplace install.
188+
expect(ql.registry.getPackage(HOTCRM_ID)?.source).toBe('marketplace');
188189
// Converted once: `register` met the entry point again with the
189190
// converted body, and no second warning was printed.
190191
expect(conversionWarnings.filter((w) => w.includes(`conversion '${IS_DEFAULT_CONVERSION}'`))).toHaveLength(1);
@@ -199,7 +200,7 @@ describe('the marketplace install converts a body once and every reader of the l
199200

200201
expect(res.status, JSON.stringify(res.payload)).toBe(200);
201202
expectOneConvertedBody(handed, ['register', 'bindArtifactHandlers', 'applySideEffects']);
202-
expect(ql.registry.getPackage(HOTCRM_ID)).toBeDefined();
203+
expect(ql.registry.getPackage(HOTCRM_ID)?.source).toBe('marketplace');
203204
expect(conversionWarnings.filter((w) => w.includes(`conversion '${IS_DEFAULT_CONVERSION}'`))).toHaveLength(1);
204205
expect(homePage(new LocalManifestSource(dir).read(HOTCRM_ID).entry!.manifest as Bag)).toMatchObject({ isDefault: true });
205206
});

‎packages/services/service-package/src/hydration-convert-forward.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ describe('sys_packages boot hydration converts a stored body forward before the
204204

205205
const record = ql.registry.getPackage(HOTCRM_ID);
206206
expect(record, 'the stored HotCRM body was not hydrated').toBeDefined();
207+
// The converted body is still recorded as the authored package it was installed as.
208+
expect(record!.source).toBe('authored');
207209
const home = ((record!.manifest as Bag).pages as Bag[]).find((p) => p.name === 'sales_home_page')!;
208210
expect(home).toMatchObject({ type: 'home' });
209211
expect(home).not.toHaveProperty('isDefault');

0 commit comments

Comments
 (0)