Skip to content

Commit 37db6bb

Browse files
committed
test: Split the default-listing case into explicit telemetry on/off cases, mark critical
The old single case asserted telemetry off (report-problem absent) via the suite's own default, never setting telemetry explicitly. internal's own tool-loading.cases.ts carried a near-duplicate asserting the opposite (report-problem present, since its hosted deploy runs telemetry on by default) - same scenario, diverging only because of which suite's default happened to apply, not a real behavioral difference worth two separate hand-maintained tests in two repos. Now: two cases, each forcing telemetry via withClient's own option instead of relying on any suite/environment default, both critical so internal gets both automatically. Each asserts the full tools list, not just report-problem's presence - confirms toggling telemetry changes only that one tool, nothing else shifts. Also adds 'should handle mixed categories and specific tools in tools param' (moved from internal's tool-loading.cases.ts as-is, marked critical) - pure tools_loader selector-merging logic with no hosting dependency and no existing similar case here.
1 parent f079c2e commit 37db6bb

1 file changed

Lines changed: 49 additions & 7 deletions

File tree

src/test_kit/cases/registration.cases.ts

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,53 @@ function onlyStdio(ctx: CaseCtx): boolean {
3131
*/
3232
export const registrationCases: Case[] = [
3333
{
34-
name: 'should match spec default: actors,docs,apify/rag-web-browser when no params provided',
35-
critical: false,
36-
run: withClient(undefined, async (client) => {
34+
// telemetry explicitly forced off (not relying on the suite's own default) so this case's
35+
// expectation is deterministic regardless of which repo/environment registers it — see
36+
// apify-mcp-server-internal's report-problem telemetry-gating investigation (#776 follow-up).
37+
name: 'should match spec default: actors,docs,apify/rag-web-browser when no params provided (telemetry off)',
38+
critical: true,
39+
run: withClient({ telemetry: { enabled: false } }, async (client) => {
3740
const tools = await client.listTools();
3841
const names = getToolNames(tools);
3942

4043
// Should be equivalent to tools=actors,docs,apify/rag-web-browser
4144
// Note: UI tools (search-actors-widget, fetch-actor-details-widget) are only available in apps mode
42-
// report-problem is telemetry-gated and telemetry is off in this suite, so it is not listed.
4345
const expectedActorsTools = ['fetch-actor-details', 'search-actors', 'call-actor'];
4446
const expectedDocsTools = ['search-apify-docs', 'fetch-apify-docs'];
4547
const expectedActors = [actorNameToToolName('apify/rag-web-browser')];
4648

4749
const expectedTotal = expectedActorsTools.concat(expectedDocsTools, expectedActors);
48-
expect(names).toHaveLength(expectedTotal.length + 4);
50+
expect(names).toHaveLength(expectedTotal.length + AUTO_INJECTED_TOOL_NAMES.length);
4951

5052
expectToolNamesToContain(names, expectedActorsTools);
5153
expectToolNamesToContain(names, expectedDocsTools);
5254
expect(names).not.toContain(HELPER_TOOLS.PROBLEM_REPORT);
5355
expectToolNamesToContain(names, expectedActors);
5456
expectToolNamesToContain(names, AUTO_INJECTED_TOOL_NAMES);
55-
// get-actor-run should be automatically included when call-actor is present
56-
expect(names).toContain(HELPER_TOOLS.ACTOR_RUNS_GET);
57+
}),
58+
},
59+
{
60+
// Same scenario, telemetry explicitly forced on - the only expected difference from the
61+
// case above is report-problem's presence; everything else in the tools list is identical.
62+
name: 'should match spec default: actors,docs,apify/rag-web-browser when no params provided (telemetry on)',
63+
critical: true,
64+
run: withClient({ telemetry: { enabled: true } }, async (client) => {
65+
const tools = await client.listTools();
66+
const names = getToolNames(tools);
67+
68+
const expectedActorsTools = ['fetch-actor-details', 'search-actors', 'call-actor'];
69+
const expectedDocsTools = ['search-apify-docs', 'fetch-apify-docs'];
70+
const expectedActors = [actorNameToToolName('apify/rag-web-browser')];
71+
const expectedFeedbackTools = [HELPER_TOOLS.PROBLEM_REPORT];
72+
73+
const expectedTotal = expectedActorsTools.concat(expectedDocsTools, expectedActors, expectedFeedbackTools);
74+
expect(names).toHaveLength(expectedTotal.length + AUTO_INJECTED_TOOL_NAMES.length);
75+
76+
expectToolNamesToContain(names, expectedActorsTools);
77+
expectToolNamesToContain(names, expectedDocsTools);
78+
expect(names).toContain(HELPER_TOOLS.PROBLEM_REPORT);
79+
expectToolNamesToContain(names, expectedActors);
80+
expectToolNamesToContain(names, AUTO_INJECTED_TOOL_NAMES);
5781
}),
5882
},
5983
{
@@ -208,6 +232,24 @@ export const registrationCases: Case[] = [
208232
}),
209233
};
210234
})(),
235+
{
236+
// A category selector ('docs') mixed with individual tool-name selectors, in one `tools`
237+
// param - proves selection is precise (search-actors, part of the same "actors" concept
238+
// as call-actor, must stay excluded) rather than silently widening to a whole category.
239+
name: 'should handle mixed categories and specific tools in tools param',
240+
critical: true,
241+
run: withClient({ tools: ['docs', 'fetch-actor-details', 'call-actor'] }, async (client) => {
242+
const names = getToolNames(await client.listTools());
243+
244+
expect(names).toContain('search-apify-docs'); // from docs category
245+
expect(names).toContain('fetch-apify-docs'); // from docs category
246+
expect(names).toContain('fetch-actor-details'); // specific tool
247+
expect(names).toContain('call-actor'); // specific tool
248+
249+
// Should NOT include other actors-category tools
250+
expect(names).not.toContain('search-actors');
251+
}),
252+
},
211253
{
212254
name: 'loads docs while dropping retired selectors',
213255
critical: false,

0 commit comments

Comments
 (0)