Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -333,37 +333,48 @@ describe('agent, skill and tool names held per namespace, on a booted showcase',
expect(await metaAt('tool', TOOL, 'com.qa.bare.alpha')).toEqual(['com.qa.bare.alpha', 'alpha tool']);
});

it('CONTROL — install-local of a package declaring fresh agent, skill and tool names installs, and every AI door serves it', async () => {
const { status, body } = await installLocal(inline('epsilon', {
agents: [agent('epsilon', 'epsilon_agent')],
skills: [skill('epsilon', 'epsilon_skill')],
tools: [tool('epsilon', 'epsilon_tool')],
}));
expect(status, JSON.stringify(body)).toBeLessThan(300);
expect(await packageIds()).toContain('com.qa.bare.epsilon');
expect(await metaPackage('agent', 'epsilon_agent')).toBe('com.qa.bare.epsilon');
expect(await metaPackage('skill', 'epsilon_skill')).toBe('com.qa.bare.epsilon');
expect(await metaPackage('tool', 'epsilon_tool')).toBe('com.qa.bare.epsilon');
expect(await promptText('epsilon-epsilon_skill')).toContain('epsilon skill instructions');
expect(await promptText('epsilon_skill'), 'one holder: the bare name still answers').toContain('epsilon skill instructions');
// The install is SETUP (loading), so it runs in a hook and the `it` times only the reads it judges.
describe('CONTROL — install-local of a package declaring fresh agent, skill and tool names', () => {
beforeAll(async () => {
const { status, body } = await installLocal(inline('epsilon', {
agents: [agent('epsilon', 'epsilon_agent')],
skills: [skill('epsilon', 'epsilon_skill')],
tools: [tool('epsilon', 'epsilon_tool')],
}));
expect(status, JSON.stringify(body)).toBeLessThan(300);
}, 60_000);

it('installs, and every AI door serves it', async () => {
expect(await packageIds()).toContain('com.qa.bare.epsilon');
expect(await metaPackage('agent', 'epsilon_agent')).toBe('com.qa.bare.epsilon');
expect(await metaPackage('skill', 'epsilon_skill')).toBe('com.qa.bare.epsilon');
expect(await metaPackage('tool', 'epsilon_tool')).toBe('com.qa.bare.epsilon');
expect(await promptText('epsilon-epsilon_skill')).toContain('epsilon skill instructions');
expect(await promptText('epsilon_skill'), 'one holder: the bare name still answers').toContain('epsilon skill instructions');
});
});

it('[#31701, #31985] install-local of a package of a THIRD namespace declaring the held agent, skill and tool names installs; the bare read then names all three holders', async () => {
const { status, body } = await installLocal(inline('gamma', { agents: [agent('gamma')], skills: [skill('gamma')], tools: [tool('gamma')] }));
expect(status, JSON.stringify(body)).toBeLessThan(300);
expect(await packageIds()).toContain('com.qa.bare.gamma');
expect(await metaAt('agent', AGENT, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma agent']);
expect(await metaAt('skill', SKILL, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma skill']);
expect(await metaAt('tool', TOOL, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma tool']);
const all = ['com.qa.bare.alpha', 'com.qa.bare.beta', 'com.qa.bare.gamma'];
await expectMetaRefused('agent', AGENT, all);
await expectMetaRefused('skill', SKILL, all);
await expectMetaRefused('tool', TOOL, all);
expect(await metaAt('tool', TOOL, 'com.qa.bare.alpha')).toEqual(['com.qa.bare.alpha', 'alpha tool']);
// The first packages' items are unchanged.
expect(await metaAt('agent', AGENT, 'com.qa.bare.alpha')).toEqual(['com.qa.bare.alpha', 'alpha agent']);
expect(await promptText(`alpha-${SKILL}`)).toContain('alpha skill instructions');
expect(await promptText(`gamma-${SKILL}`)).toContain('gamma skill instructions');
describe('[#31701, #31985] install-local of a package of a THIRD namespace declaring the held agent, skill and tool names', () => {
beforeAll(async () => {
const { status, body } = await installLocal(inline('gamma', { agents: [agent('gamma')], skills: [skill('gamma')], tools: [tool('gamma')] }));
expect(status, JSON.stringify(body)).toBeLessThan(300);
}, 60_000);

it('installs; the bare read then names all three holders', async () => {
expect(await packageIds()).toContain('com.qa.bare.gamma');
expect(await metaAt('agent', AGENT, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma agent']);
expect(await metaAt('skill', SKILL, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma skill']);
expect(await metaAt('tool', TOOL, 'com.qa.bare.gamma')).toEqual(['com.qa.bare.gamma', 'gamma tool']);
const all = ['com.qa.bare.alpha', 'com.qa.bare.beta', 'com.qa.bare.gamma'];
await expectMetaRefused('agent', AGENT, all);
await expectMetaRefused('skill', SKILL, all);
await expectMetaRefused('tool', TOOL, all);
expect(await metaAt('tool', TOOL, 'com.qa.bare.alpha')).toEqual(['com.qa.bare.alpha', 'alpha tool']);
// The first packages' items are unchanged.
expect(await metaAt('agent', AGENT, 'com.qa.bare.alpha')).toEqual(['com.qa.bare.alpha', 'alpha agent']);
expect(await promptText(`alpha-${SKILL}`)).toContain('alpha skill instructions');
expect(await promptText(`gamma-${SKILL}`)).toContain('gamma skill instructions');
});
});

/**
Expand All @@ -377,24 +388,39 @@ describe('agent, skill and tool names held per namespace, on a booted showcase',
* other. FROM (this branch before `main`'s #32741 was merged in): the
* first-installed holder's exact address served the package-less row as its
* own; the second served its own.
*
* The two row saves and the three installs are this pin's SETUP, so they run
* in the `beforeAll` below and the `it`s time only the reads they judge
* (clocked windows measure behaviour, never loading). Measured: each
* install-local re-syncs the whole showcase (123 object schemas, 33 flows),
* ~0.9 s apiece on an idle box; the setup was ~2.8 s of a ~3.1 s test, and
* under merge-queue shard load the single `it` crossed vitest's default 5 s
* test clock (2.2–4.4 s green, 5.0–5.1 s red). The hook's budget is a
* loading budget, like the boot hook's above.
*/
it('[#31985] a package-less tool row saved before two namespaces\' packages install the name is declined at each holder\'s exact address, both install orders, before and after the hydrator; the bare read refuses naming both', async () => {
describe('[#31985] a package-less tool row saved before two namespaces\' packages install the name', () => {
const UP = 'qa_row_tool_up';
const DOWN = 'qa_row_tool_down';
for (const name of [UP, DOWN]) {
const saved = await stack.apiAs(admin, 'PUT', `/meta/tool/${name}`, tool('env', name));
expect(saved.status, await saved.text()).toBeLessThan(300);
}
for (const [p, tools] of [['kappa', [UP]], ['lambda', [UP, DOWN]], ['iota', [DOWN]]] as const) {
const { status, body } = await installLocal(inline(p, { tools: tools.map((n) => tool(p, n)) }));
expect(status, `${p}: ${JSON.stringify(body)}`).toBeLessThan(300);
}

beforeAll(async () => {
for (const name of [UP, DOWN]) {
const saved = await stack.apiAs(admin, 'PUT', `/meta/tool/${name}`, tool('env', name));
expect(saved.status, await saved.text()).toBeLessThan(300);
}
for (const [p, tools] of [['kappa', [UP]], ['lambda', [UP, DOWN]], ['iota', [DOWN]]] as const) {
const { status, body } = await installLocal(inline(p, { tools: tools.map((n) => tool(p, n)) }));
expect(status, `${p}: ${JSON.stringify(body)}`).toBeLessThan(300);
}
}, 60_000);

const layeredAt = async (name: string, pkg: string) => {
const r = await stack.apiAs(admin, 'GET', `/meta/tool/${name}/layers?package=${pkg}`);
const body = (await r.json()) as any;
return [r.status, body?.overlay ?? null, body?.effective?.label];
};
for (const when of ['before the hydrator', 'after the hydrator']) {

// In declaration order: the second runs the hydrator (`GET /meta/tool`) first.
it.each(['before the hydrator', 'after the hydrator'])('%s: it is declined at each holder\'s exact address, both install orders; the bare read refuses naming both', async (when) => {
if (when === 'after the hydrator') expect((await stack.apiAs(admin, 'GET', '/meta/tool')).status).toBe(200);
for (const [name, holders] of [[UP, ['kappa', 'lambda']], [DOWN, ['lambda', 'iota']]] as const) {
for (const p of holders) {
Expand All @@ -404,7 +430,7 @@ describe('agent, skill and tool names held per namespace, on a booted showcase',
}
await expectMetaRefused('tool', name, holders.map((p) => `com.qa.bare.${p}`));
}
}
});
});
});

Expand Down
Loading