fix(plugins): stage runtime deps for selected slots

This commit is contained in:
Vincent Koc
2026-04-28 21:37:17 -07:00
parent 9023b120a1
commit d49ebe7bde
2 changed files with 43 additions and 0 deletions

View File

@@ -1013,6 +1013,12 @@ describe("scanBundledPluginRuntimeDeps config policy", () => {
includeConfiguredChannels: false,
expectedDeps: [],
},
{
name: "includes selected memory slot bundled plugins behind restrictive allowlists",
config: { plugins: { allow: ["browser"], slots: { memory: "alpha" } } },
includeConfiguredChannels: false,
expectedDeps: ["alpha-runtime@1.0.0"],
},
{
name: "does not let explicit plugin entries bypass restrictive allowlists",
config: { plugins: { allow: ["browser"], entries: { alpha: { enabled: true } } } },
@@ -2562,6 +2568,40 @@ describe("ensureBundledPluginRuntimeDeps", () => {
expect(installRoot).not.toBe(pluginRoot);
});
it("installs runtime deps for the default memory slot bundled plugin", () => {
const packageRoot = makeTempDir();
const pluginRoot = writeBundledPluginPackage({
packageRoot,
pluginId: "memory-core",
deps: { chokidar: "^5.0.0" },
});
const calls: BundledRuntimeDepsInstallParams[] = [];
const result = ensureBundledPluginRuntimeDeps({
env: {},
config: {},
installDeps: (params) => {
calls.push(params);
},
pluginId: "memory-core",
pluginRoot,
});
expect(result).toEqual({
installedSpecs: ["chokidar@^5.0.0"],
retainSpecs: ["chokidar@^5.0.0"],
});
const installRoot = resolveBundledRuntimeDependencyInstallRoot(pluginRoot, { env: {} });
expect(calls).toEqual([
{
installRoot,
missingSpecs: ["chokidar@^5.0.0"],
installSpecs: ["chokidar@^5.0.0"],
},
]);
expect(installRoot).not.toBe(pluginRoot);
});
it("repairs external staged deps even when packaged plugin-local deps are present", () => {
const packageRoot = makeTempDir();
const extensionsRoot = path.join(packageRoot, "dist", "extensions");

View File

@@ -1420,6 +1420,9 @@ function isBundledPluginConfiguredForRuntimeDeps(params: {
}
const entry = plugins.entries[params.pluginId];
const manifest = readBundledPluginRuntimeDepsManifest(params.pluginDir, params.manifestCache);
if (plugins.slots.memory === params.pluginId || plugins.slots.contextEngine === params.pluginId) {
return true;
}
let hasExplicitChannelDisable = false;
let hasConfiguredChannel = false;
for (const channelId of manifest.channels) {