perf(test): trim bundled facade hot paths

This commit is contained in:
Peter Steinberger
2026-04-07 00:59:18 +01:00
parent fbebf6147c
commit 8c38c662c1
4 changed files with 263 additions and 194 deletions

View File

@@ -2814,38 +2814,6 @@ module.exports = {
expectSetupLoaded: true,
expectedChannels: 1,
},
{
name: "can prefer setupEntry for configured channel loads during startup",
fixture: {
id: "setup-runtime-preferred-test",
label: "Setup Runtime Preferred Test",
packageName: "@openclaw/setup-runtime-preferred-test",
fullBlurb: "full entry should be deferred while startup is still cold",
setupBlurb: "setup runtime preferred",
configured: true,
startupDeferConfiguredChannelFullLoadUntilAfterListen: true,
},
load: ({ pluginDir }: { pluginDir: string }) =>
loadOpenClawPlugins({
cache: false,
preferSetupRuntimeForChannelPlugins: true,
config: {
channels: {
"setup-runtime-preferred-test": {
enabled: true,
token: "configured",
},
},
plugins: {
load: { paths: [pluginDir] },
allow: ["setup-runtime-preferred-test"],
},
},
}),
expectFullLoaded: false,
expectSetupLoaded: true,
expectedChannels: 1,
},
{
name: "does not prefer setupEntry for configured channel loads without startup opt-in",
fixture: {
@@ -2887,6 +2855,26 @@ module.exports = {
expect(registry.channels).toHaveLength(expectedChannels);
});
it("prefers setupEntry for configured channel loads during startup when opted in", () => {
expect(
__testing.shouldLoadChannelPluginInSetupRuntime({
manifestChannels: ["setup-runtime-preferred-test"],
setupSource: "./setup-entry.cjs",
startupDeferConfiguredChannelFullLoadUntilAfterListen: true,
cfg: {
channels: {
"setup-runtime-preferred-test": {
enabled: true,
token: "configured",
},
},
},
env: {},
preferSetupRuntimeForChannelPlugins: true,
}),
).toBe(true);
});
it("blocks before_prompt_build but preserves legacy model overrides when prompt injection is disabled", async () => {
useNoBundledPlugins();
const plugin = writePlugin({

View File

@@ -248,6 +248,7 @@ export const __testing = {
resolvePluginSdkAliasCandidateOrder,
resolvePluginSdkAliasFile,
resolvePluginRuntimeModulePath,
shouldLoadChannelPluginInSetupRuntime,
shouldPreferNativeJiti,
toSafeImportPath,
getCompatibleActivePluginRegistry,