Skip to content

Commit d6169e3

Browse files
committed
test(dogfood): create the base packages before saving into them
Four dogfood files saved into package ids no package had, three of them ids the install door refuses outright (underscores are not a reverse-domain segment). Each now installs its base through the protocol's install primitive, under a valid id with the namespace its object names carry, and the uninstall case installs the package again before it republishes. Claude-Session: https://claude.ai/code/session_01FEkQ5nhhuhjVQJ8R3qK9UB Co-authored-by: Claude <noreply@anthropic.com>
1 parent 7cd9098 commit d6169e3

3 files changed

Lines changed: 34 additions & 6 deletions

File tree

‎packages/qa/dogfood/test/flow-shipped-name-published-door.dogfood.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const CUSTOMER_SOURCE = 'showcase_reassign_wizard';
6161
/** A flow name no managed package ships, given an environment-wide stored row. */
6262
const CUSTOMER = 'dogfood_21002_pub_customer_flow';
6363
/** A writable base and an object published into it at runtime: the `object` control. */
64-
const OBJECT_BASE = 'app.dogfood_21002_pub';
64+
const OBJECT_BASE = 'app.dogfood-21002-pub';
6565
const OBJECT_NAME = 'dogfood_21002_pub_widget';
6666

6767
/** The node id and label a stored body carries, so it can be told from the loader's. */
@@ -95,6 +95,7 @@ interface Ql {
9595
}
9696
interface Protocol {
9797
saveMetaItem(request: Record<string, unknown>): Promise<unknown>;
98+
installPackage(request: { manifest: Record<string, unknown> }): Promise<unknown>;
9899
}
99100

100101
const plugins = () => [
@@ -194,6 +195,11 @@ describe('the published-snapshot door answers the loader\'s body for a shipped f
194195
sharingModel: 'private',
195196
fields: { title: { type: 'text', label: 'Title' } },
196197
};
198+
// [#26708] The base is created first, as Studio's "New package" does:
199+
// a save naming a package no installed package has is refused.
200+
await protocol.installPackage({
201+
manifest: { id: OBJECT_BASE, name: 'Dogfood 21002 base', version: '0.1.0', type: 'app', namespace: 'dogfood_21002_pub' },
202+
});
197203
await protocol.saveMetaItem({ type: 'object', name: OBJECT_NAME, item: objectBody, packageId: OBJECT_BASE, mode: 'draft' });
198204
await protocol.saveMetaItem({ type: 'object', name: OBJECT_NAME, item: objectBody, packageId: OBJECT_BASE, mode: 'publish' });
199205
await stack.stop();

‎packages/qa/dogfood/test/package-first-authoring.dogfood.test.ts‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,17 @@ describe('dogfood: package-first authoring rejects runtime creates into read-onl
6363

6464
it('the same create into a fresh writable base id is NOT rejected (control)', async () => {
6565
const protocol = await stack.kernel.getServiceAsync<any>('protocol');
66-
// A bare, unregistered project-base id is writable — the write must succeed.
66+
// A fresh authored base is writable — the write must succeed. [#26708] It
67+
// is created first, as Studio's "New package" does: a save naming a
68+
// package no installed package has is refused.
69+
await protocol.installPackage({
70+
manifest: { id: 'app.dogfood-probe-base', name: 'Dogfood probe base', version: '0.1.0', type: 'app', namespace: 'dogfood' },
71+
});
6772
const res = await protocol.saveMetaItem({
6873
type: 'object',
6974
name: 'dogfood_pkgfirst_ok',
7075
item: { name: 'dogfood_pkgfirst_ok', label: 'OK', fields: { name: { type: 'text', label: 'Name' } } },
71-
packageId: 'app.dogfood_probe_base',
76+
packageId: 'app.dogfood-probe-base',
7277
mode: 'draft',
7378
});
7479
expect(res?.success ?? true).toBeTruthy();
@@ -80,13 +85,18 @@ describe('dogfood: the package is the authoring & delete unit (ADR-0070 D3/D4)',
8085
let protocol: any;
8186
let ql: any;
8287
// A fresh, writable, project-scoped base (never a code/installed package).
83-
const BASE = 'app.dogfood_lifecycle';
88+
const BASE = 'app.dogfood-lifecycle';
8489
const OBJ = 'dfl_widget';
8590

8691
beforeAll(async () => {
8792
stack = await bootStack(crmStack);
8893
protocol = await stack.kernel.getServiceAsync<any>('protocol');
8994
ql = await stack.kernel.getServiceAsync<any>('objectql');
95+
// [#26708] The base is created first, as Studio's "New package" does: a
96+
// save naming a package no installed package has is refused.
97+
await protocol.installPackage({
98+
manifest: { id: BASE, name: 'Dogfood lifecycle', version: '0.1.0', type: 'app', namespace: 'dfl' },
99+
});
90100
});
91101
afterAll(async () => {
92102
await stack?.stop?.();
@@ -210,6 +220,11 @@ describe('dogfood: duplicate a writable base (ADR-0070 D4)', () => {
210220
stack = await bootStack(crmStack);
211221
protocol = await stack.kernel.getServiceAsync<any>('protocol');
212222
ql = await stack.kernel.getServiceAsync<any>('objectql');
223+
// [#26708] The source base is created first, as Studio's "New package"
224+
// does: a save naming a package no installed package has is refused.
225+
await protocol.installPackage({
226+
manifest: { id: SRC, name: 'Dogfood dup source', version: '0.1.0', type: 'app', namespace: 'dfdup' },
227+
});
213228
});
214229
afterAll(async () => {
215230
await stack?.stop?.();

‎packages/qa/dogfood/test/package-uninstall-revokes-named-grants.dogfood.test.ts‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { bootStack, type VerifyStack } from '@objectstack/verify';
2424
import { catalogPermissionSet } from './catalog-permission-set.js';
2525

2626
const SYS = { isSystem: true };
27-
const BASE = 'app.dogfood_uninstall_grants';
27+
const BASE = 'app.dogfood-uninstall-grants';
2828
const SET = 'dfu_task_user';
2929
const USER = 'usr_dfu_grantee';
3030

@@ -40,6 +40,9 @@ describe('dogfood: deletePackage revokes the grants naming the package\'s permis
4040
packageId: BASE,
4141
mode: 'publish',
4242
});
43+
const installBase = () => protocol.installPackage({
44+
manifest: { id: BASE, name: 'DFU grants base', version: '0.1.0', type: 'app', namespace: 'dfu' },
45+
});
4346
const grants = async () =>
4447
((await ql.find('sys_user_permission_set', { where: { permission_set: SET }, context: SYS })) ?? []) as any[];
4548

@@ -54,13 +57,17 @@ describe('dogfood: deletePackage revokes the grants naming the package\'s permis
5457
ql = await stack.kernel.getServiceAsync<any>('objectql');
5558

5659
await ql.insert('sys_user', { id: USER, email: 'dfu@example.test', name: 'DFU', email_verified: true }, { context: SYS });
60+
// [#26708] The base is created first, as Studio's "New package" does: a
61+
// save naming a package no installed package has is refused.
62+
await installBase();
5763
await publishSet();
5864
granted = await ql.insert('sys_user_permission_set', { user_id: USER, permission_set: SET }, { context: SYS });
5965

6066
uninstall = await protocol.deletePackage({ packageId: BASE });
6167
afterUninstall = { served: await catalogPermissionSet(ql, SET), grants: await grants() };
6268

63-
// The same package publishes the same set again.
69+
// The same package, installed again, publishes the same set again.
70+
await installBase();
6471
await publishSet();
6572
afterRepublish = { served: await catalogPermissionSet(ql, SET), grants: await grants() };
6673
}, 120_000);

0 commit comments

Comments
 (0)