Skip to content

Commit 76054c0

Browse files
committed
test(dogfood): a booted clash's package-less by-name read refuses naming both holders
The AI-family boot pin asserted the first-registered package's agent and tool were served at GET /meta/TYPE/NAME. That read now answers 409 RESOURCE_CONFLICT naming both holders; the ?package= read serves each package's own, and the skill prompt list is unchanged. Claude-Session: https://claude.ai/code/session_01ADHkmTH1oAwgDMigQ9pj37 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 9e37aef commit 76054c0

1 file changed

Lines changed: 40 additions & 9 deletions

File tree

‎packages/qa/dogfood/test/bare-name-one-holder-ai-family.dogfood.test.ts‎

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,12 @@
1616
// `AppPlugin` packages, `alpha` and `beta`, shipping one agent, one skill
1717
// and one tool under the same names — boots, and logs ONE bare-name
1818
// warning line naming all three, both packages and the rename for each;
19-
// the readers keep serving the first-registered package's item, as
20-
// before: `/meta/agent/NAME`, the skill an MCP client's `prompts/get`
21-
// resolves and `/meta/tool/NAME`;
19+
// the skill an MCP client's `prompts/get` resolves stays the
20+
// first-registered package's (the merged list), and [#31680, ADR-0150 D3]
21+
// the by-name read that names no package — `/meta/agent/NAME`,
22+
// `/meta/skill/NAME`, `/meta/tool/NAME` — refuses `409 RESOURCE_CONFLICT`
23+
// naming both holders, where it served the first registered; the read
24+
// that names the package (`?package=`) serves each package's own;
2225
// - `POST /marketplace/install-local` of a third package declaring the held
2326
// agent name, of a fourth declaring the held skill name, and of a fifth
2427
// declaring the held tool name, is 422 PLUGIN_REGISTER_FAILED naming both
@@ -125,6 +128,29 @@ describe('one package holder per agent, skill and tool name, on a booted showcas
125128
return d?._packageId ?? d?.item?._packageId;
126129
};
127130

131+
/**
132+
* [#31680, ADR-0150 D3] The by-name read that names no package, of a name two
133+
* packages hold: refused `409 RESOURCE_CONFLICT`, naming both holders.
134+
*/
135+
const expectMetaRefused = async (type: string, name: string) => {
136+
const r = await stack.apiAs(admin, 'GET', `/meta/${type}/${name}`);
137+
const body = (await r.json()) as any;
138+
expect([r.status, codeOf(body)], JSON.stringify(body)).toEqual([409, 'RESOURCE_CONFLICT']);
139+
// The meta door's error envelope: `{ error: <sentence>, code }`.
140+
const message = String(typeof body?.error === 'string' ? body.error : body?.error?.message ?? body?.message ?? '');
141+
expect(message).toContain('com.qa.bare.alpha');
142+
expect(message).toContain('com.qa.bare.beta');
143+
};
144+
145+
/** The package whose item `GET /meta/TYPE/NAME?package=PKG` serves. */
146+
const metaPackageAt = async (type: string, name: string, pkg: string): Promise<string | undefined> => {
147+
const r = await stack.apiAs(admin, 'GET', `/meta/${type}/${name}?package=${pkg}`);
148+
expect(r.status).toBe(200);
149+
const body = (await r.json()) as any;
150+
const d = body?.data ?? body;
151+
return d?._packageId ?? d?.item?._packageId;
152+
};
153+
128154
/** The skill an MCP client's `prompts/get` of `name` resolves: the MCP prompt projection over the merged `skill` list. */
129155
const skillPromptTitle = async (name: string): Promise<string | undefined> => {
130156
const r = await stack.apiAs(admin, 'GET', '/meta/skill');
@@ -166,11 +192,16 @@ describe('one package holder per agent, skill and tool name, on a booted showcas
166192
expect(line).toContain('package "com.qa.bare.alpha"');
167193
expect(line).toContain('package "com.qa.bare.beta"');
168194
expect(await packageIds(), 'both packages booted').toEqual(expect.arrayContaining(['com.qa.bare.alpha', 'com.qa.bare.beta']));
169-
// Unchanged by the rule: the readers keep serving the first-registered package's item.
170-
expect(await metaPackage('agent', AGENT)).toBe('com.qa.bare.alpha');
171-
expect(await metaPackage('skill', SKILL)).toBe('com.qa.bare.alpha');
195+
// Unchanged by the rule: the skill prompt is the first-registered package's.
172196
expect(await skillPromptTitle(SKILL)).toBe('alpha skill');
173-
expect(await metaPackage('tool', TOOL)).toBe('com.qa.bare.alpha');
197+
// [#31680, ADR-0150 D3] The by-name read that names no package refuses the
198+
// held name naming both holders (it served the first registered); the read
199+
// that names the package serves that package's own.
200+
for (const [type, name] of [['agent', AGENT], ['skill', SKILL], ['tool', TOOL]] as const) {
201+
await expectMetaRefused(type, name);
202+
expect(await metaPackageAt(type, name, 'com.qa.bare.alpha')).toBe('com.qa.bare.alpha');
203+
expect(await metaPackageAt(type, name, 'com.qa.bare.beta')).toBe('com.qa.bare.beta');
204+
}
174205
});
175206

176207
it('install-local of a third package declaring a held agent name is 422 PLUGIN_REGISTER_FAILED naming both holders and the rename; nothing is installed', async () => {
@@ -183,7 +214,7 @@ describe('one package holder per agent, skill and tool name, on a booted showcas
183214
expect(message).toContain('com.qa.bare.beta');
184215
expect(message).toContain(`"gamma_${AGENT}"`);
185216
expect(await packageIds(), 'the package list is unchanged').toEqual(before);
186-
expect(await metaPackage('agent', AGENT)).toBe('com.qa.bare.alpha');
217+
await expectMetaRefused('agent', AGENT);
187218
});
188219

189220
it('install-local of a package declaring a held skill name is refused the same way; the skill prompt is untouched', async () => {
@@ -209,7 +240,7 @@ describe('one package holder per agent, skill and tool name, on a booted showcas
209240
expect(message).toContain('com.qa.bare.beta');
210241
expect(message).toContain(`"zeta_${TOOL}"`);
211242
expect(await packageIds(), 'the package list is unchanged').toEqual(before);
212-
expect(await metaPackage('tool', TOOL)).toBe('com.qa.bare.alpha');
243+
await expectMetaRefused('tool', TOOL);
213244
});
214245

215246
it('CONTROL — install-local of a package declaring fresh agent, skill and tool names installs', async () => {

0 commit comments

Comments
 (0)