[Fix] Remove spurious plugin id mismatch warning (#59185)

Merged via squash.

Prepared head SHA: 82859a0f92
Co-authored-by: samzong <13782141+samzong@users.noreply.github.com>
Co-authored-by: frankekn <4488090+frankekn@users.noreply.github.com>
Reviewed-by: @frankekn
This commit is contained in:
samzong
2026-04-03 12:58:56 +08:00
committed by GitHub
parent 251fa72798
commit 2b9981bd06
3 changed files with 3 additions and 62 deletions

View File

@@ -634,32 +634,7 @@ describe("loadPluginManifestRegistry", () => {
expect(countDuplicateWarnings(loadRegistry(candidates))).toBe(0);
});
it.each([
{ name: "provider-style", manifestId: "openai", idHint: "openai-provider" },
{ name: "plugin-style", manifestId: "brave", idHint: "brave-plugin" },
{ name: "sandbox-style", manifestId: "openshell", idHint: "openshell-sandbox" },
{ name: "multi-entry-style", manifestId: "matrix", idHint: "matrix/index" },
{
name: "media-understanding-style",
manifestId: "groq",
idHint: "groq-media-understanding",
},
] as const)("accepts $name id hints without warning", ({ manifestId, idHint }) => {
const dir = makeTempDir();
writeManifest(dir, { id: manifestId, configSchema: { type: "object" } });
expect(
hasPluginIdMismatchWarning(
loadSingleCandidateRegistry({
idHint,
rootDir: dir,
origin: "bundled",
}),
),
).toBe(false);
});
it("still warns for unrelated id hint mismatches", () => {
it("does not warn for id hint mismatches when manifest id is authoritative", () => {
const dir = makeTempDir();
writeManifest(dir, { id: "openai", configSchema: { type: "object" } });
@@ -671,13 +646,7 @@ describe("loadPluginManifestRegistry", () => {
}),
]);
expect(
registry.diagnostics.some((diag) =>
diag.message.includes(
'plugin id mismatch (manifest uses "openai", entry hints "totally-different")',
),
),
).toBe(true);
expect(hasPluginIdMismatchWarning(registry)).toBe(false);
});
it.each([

View File

@@ -187,26 +187,6 @@ function mergePackageChannelMetaIntoChannelConfigs(params: {
};
}
function isCompatiblePluginIdHint(idHint: string | undefined, manifestId: string): boolean {
const normalizedHint = idHint?.trim();
if (!normalizedHint) {
return true;
}
if (normalizedHint === manifestId) {
return true;
}
// Generated idHint for multi-extension plugins takes the form "id/entryBase".
if (normalizedHint.startsWith(`${manifestId}/`)) {
return true;
}
return (
normalizedHint === `${manifestId}-provider` ||
normalizedHint === `${manifestId}-plugin` ||
normalizedHint === `${manifestId}-sandbox` ||
normalizedHint === `${manifestId}-media-understanding`
);
}
function buildRecord(params: {
manifest: PluginManifest;
candidate: PluginCandidate;
@@ -457,15 +437,6 @@ export function loadPluginManifestRegistry(
continue;
}
if (!isCompatiblePluginIdHint(candidate.idHint, manifest.id)) {
diagnostics.push({
level: "warn",
pluginId: manifest.id,
source: candidate.source,
message: `plugin id mismatch (manifest uses "${manifest.id}", entry hints "${candidate.idHint}")`,
});
}
const configSchema = "configSchema" in manifest ? manifest.configSchema : undefined;
const schemaCacheKey = (() => {
if (!configSchema) {