perf(test): remove gateway method wait debt

This commit is contained in:
Peter Steinberger
2026-04-23 10:37:42 +01:00
parent 007fb0458e
commit a8d337b360
3 changed files with 40 additions and 41 deletions

View File

@@ -378,29 +378,30 @@ describe("commands.list handler", () => {
const longToken = "x".repeat(COMMAND_NAME_MAX_LENGTH + 50);
const aliasBase = "alias".repeat(20);
const longDescription = "d".repeat(COMMAND_DESCRIPTION_MAX_LENGTH + 50);
const oversizedArgs = Array.from({ length: COMMAND_ARGS_MAX_ITEMS + 5 }, (_, argIndex) => ({
name: `${longToken}-${argIndex}`,
description: longDescription,
type: "string" as const,
choices: Array.from({ length: COMMAND_ARG_CHOICES_MAX_ITEMS + 5 }, (_, choiceIndex) => ({
value: `${longToken}-${choiceIndex}`,
label: `${longToken}-${choiceIndex}`,
})),
}));
try {
mockChatCommands.length = 0;
for (let index = 0; index < COMMAND_LIST_MAX_ITEMS + 25; index += 1) {
const isFirst = index === 0;
mockChatCommands.push({
key: `cmd-${index}`,
description: longDescription,
textAliases: Array.from(
{ length: COMMAND_ALIAS_MAX_ITEMS + 5 },
(_, aliasIndex) => `/${aliasBase}-${index}-${aliasIndex}`,
),
acceptsArgs: true,
args: Array.from({ length: COMMAND_ARGS_MAX_ITEMS + 5 }, (_, argIndex) => ({
name: `${longToken}-${argIndex}`,
description: longDescription,
type: "string",
choices: Array.from(
{ length: COMMAND_ARG_CHOICES_MAX_ITEMS + 5 },
(_, choiceIndex) => ({
value: `${longToken}-${choiceIndex}`,
label: `${longToken}-${choiceIndex}`,
}),
),
})),
key: isFirst ? longToken : `cmd-${index}`,
description: isFirst ? longDescription : "short",
textAliases: isFirst
? Array.from(
{ length: COMMAND_ALIAS_MAX_ITEMS + 5 },
(_, aliasIndex) => `/${aliasBase}-${index}-${aliasIndex}`,
)
: [`/cmd-${index}`],
acceptsArgs: isFirst,
args: isFirst ? oversizedArgs : undefined,
scope: "both",
category: "tools",
});

View File

@@ -1005,6 +1005,7 @@ describe("exec approval handlers", () => {
respond,
context,
params: {
timeoutMs: 10,
host: "gateway",
nodeId: undefined,
systemRunPlan: undefined,

View File

@@ -6,12 +6,13 @@ import { createPluginActivationSource, normalizePluginsConfig } from "../plugins
import { clearPluginDiscoveryCache } from "../plugins/discovery.js";
import { clearPluginManifestRegistryCache } from "../plugins/manifest-registry.js";
import {
evaluateBundledPluginPublicSurfaceAccess,
resetFacadeActivationCheckRuntimeStateForTest,
resolveBundledPluginPublicSurfaceAccess as resolveActivationCheckBundledPluginPublicSurfaceAccess,
throwForBundledPluginPublicSurfaceAccess,
} from "./facade-activation-check.runtime.js";
import {
__testing,
canLoadActivatedBundledPluginPublicSurface,
listImportedBundledPluginFacadeIds,
loadBundledPluginPublicSurfaceModuleSync,
resetFacadeRuntimeStateForTest,
@@ -185,7 +186,7 @@ describe("plugin-sdk facade runtime", () => {
});
it("blocks runtime-api facade loads for bundled plugins that are not activated", () => {
const access = __testing.evaluateBundledPluginPublicSurfaceAccess({
const access = evaluateBundledPluginPublicSurfaceAccess({
params: {
dirName: "discord",
artifactBasename: "runtime-api.js",
@@ -207,7 +208,7 @@ describe("plugin-sdk facade runtime", () => {
expect(access.pluginId).toBe("discord");
expect(access.reason).toBeTruthy();
expect(() =>
__testing.throwForBundledPluginPublicSurfaceAccess({
throwForBundledPluginPublicSurfaceAccess({
access,
request: {
dirName: "discord",
@@ -235,7 +236,7 @@ describe("plugin-sdk facade runtime", () => {
},
},
} as const;
const access = __testing.evaluateBundledPluginPublicSurfaceAccess({
const access = evaluateBundledPluginPublicSurfaceAccess({
params: {
dirName: "discord",
artifactBasename: "runtime-api.js",
@@ -367,24 +368,20 @@ describe("plugin-sdk facade runtime", () => {
it("keeps shared runtime-core facades available without plugin activation", () => {
setRuntimeConfigSnapshot({});
expect(
canLoadActivatedBundledPluginPublicSurface({
dirName: "speech-core",
artifactBasename: "runtime-api.js",
}),
).toBe(true);
expect(
canLoadActivatedBundledPluginPublicSurface({
dirName: "image-generation-core",
artifactBasename: "runtime-api.js",
}),
).toBe(true);
expect(
canLoadActivatedBundledPluginPublicSurface({
dirName: "media-understanding-core",
artifactBasename: "runtime-api.js",
}),
).toBe(true);
for (const dirName of ["speech-core", "image-generation-core", "media-understanding-core"]) {
expect(
resolveActivationCheckBundledPluginPublicSurfaceAccess({
dirName,
artifactBasename: "runtime-api.js",
location: null,
sourceExtensionsRoot: "",
resolutionKey: `runtime-core:${dirName}`,
}),
).toEqual({
allowed: true,
pluginId: dirName,
});
}
});
it("prefers the source runtime snapshot for facade activation checks", () => {