Skip to content

Commit f446e8a

Browse files
committed
test(runtime): a legacy pair's doc override is served and removed through the doors
Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017ihL2dM9PvPPB9BMVdhf2R
1 parent c0172dd commit f446e8a

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

‎packages/runtime/src/domains/meta-legacy-pair-served.test.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ const SHIPPED = 'Service board (shipped)';
3737
const CUSTOMIZED = 'Service board (customized in the legacy pair)';
3838
const AUTHOR = { userId: 'u_author', isSystem: false, systemPermissions: ['manage_metadata'] };
3939

40+
const GUIDE = 'crm_service_guide';
4041
const board = (label: string) => ({ name: BOARD, label, columns: 12, widgets: [] });
42+
// A doc opens no overlay channel: its removal passes the sealed-removal
43+
// refusal only as a pair's removal of its own declared override.
44+
const guide = (label: string) => ({ name: GUIDE, label, content: '# Service guide' });
4145
const clone = <T>(v: T): T => JSON.parse(JSON.stringify(v));
4246

4347
const liveEngines: ObjectQL[] = [];
@@ -79,6 +83,7 @@ async function boot() {
7983
dependencies: { [APP]: '^6.1.0' },
8084
objects: [{ name: 'crm_service_case', label: 'Case', fields: { subject: { name: 'subject', label: 'Subject', type: 'text' } } }],
8185
dashboards: [board(SHIPPED)],
86+
docs: [guide(SHIPPED)],
8287
});
8388
// The per-package pair an earlier version's ensure door created for the module.
8489
engine.registry.installPackage({
@@ -160,4 +165,19 @@ describe('[#29594] merge question 12: a legacy per-package pair of an App\'s mod
160165
const layeredAfter = await read(`/meta/dashboard/${BOARD}/layers`, { package: MODULE });
161166
expect([labelOf(after.body), effectiveLabel(layeredAfter.body)]).toEqual([SHIPPED, SHIPPED]);
162167
}, 60_000);
168+
169+
it('a doc (no overlay channel) the legacy pair overrides is served, and its removal passes the sealed-removal refusal as the pair\'s own', async () => {
170+
const { protocol, read, remove } = await boot();
171+
await protocol.saveMetaItem({
172+
type: 'doc', name: GUIDE, packageId: LEGACY_PAIR,
173+
item: { ...guide(CUSTOMIZED), overrides: { package: MODULE, basedOn: '6.1.0' } },
174+
});
175+
const byName = await read(`/meta/doc/${GUIDE}`, { package: MODULE });
176+
expect([byName.status, labelOf(byName.body)], JSON.stringify(byName.body).slice(0, 400)).toEqual([200, CUSTOMIZED]);
177+
178+
const removed = await remove('doc', GUIDE, { package: LEGACY_PAIR });
179+
expect(removed.status, JSON.stringify(removed.body).slice(0, 600)).toBe(200);
180+
const after = await read(`/meta/doc/${GUIDE}`, { package: MODULE });
181+
expect([after.status, labelOf(after.body)]).toEqual([200, SHIPPED]);
182+
}, 60_000);
163183
});

0 commit comments

Comments
 (0)