fix: honor bundled web provider compat discovery

This commit is contained in:
Peter Steinberger
2026-05-26 23:21:26 +01:00
parent ba6bbf1065
commit 01a8160f7f
2 changed files with 34 additions and 0 deletions

View File

@@ -122,6 +122,35 @@ describe("web provider public artifact manifest fallback", () => {
});
});
it("keeps deprecated bundledDiscovery compat discovery outside plugin allowlists", () => {
const resolveExplicitWebSearchProviders =
mocks.resolveBundledExplicitWebSearchProvidersFromPublicArtifacts as unknown as {
mockImplementation: (
implementation: (params: {
onlyPluginIds: readonly string[];
}) => { id: string; pluginId: string }[],
) => void;
};
resolveExplicitWebSearchProviders.mockImplementation((params) =>
params.onlyPluginIds.map((pluginId) => ({ id: pluginId, pluginId })),
);
const providers = resolveBundledWebSearchProvidersFromPublicArtifacts({
config: {
plugins: {
allow: ["some-other-plugin"],
bundledDiscovery: "compat",
},
},
onlyPluginIds: ["fallback-search"],
});
expect(providers).toEqual([{ id: "fallback-search", pluginId: "fallback-search" }]);
expect(mocks.resolveBundledExplicitWebSearchProvidersFromPublicArtifacts).toHaveBeenCalledWith({
onlyPluginIds: ["fallback-search"],
});
});
it("keeps manifest bundled web-fetch public artifact candidates inside allowlist discovery", () => {
mocks.loadPluginMetadataSnapshot.mockReturnValueOnce({
diagnostics: [],

View File

@@ -31,6 +31,11 @@ function filterAllowlistedBundledPluginIds(
config: PluginLoadOptions["config"] | undefined,
pluginIds: readonly string[],
) {
// Deprecated shipped compat marker: old allowlist configs used this to keep
// bundled web provider discovery available while plugin IDs were tightened.
if (config?.plugins?.bundledDiscovery === "compat") {
return [...pluginIds];
}
const allow = config?.plugins?.allow;
if (!Array.isArray(allow) || allow.length === 0) {
return [...pluginIds];