mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-15 14:50:48 +00:00
fix: resolve small triage issues
This commit is contained in:
@@ -432,6 +432,40 @@ describe("loadPluginManifestRegistry", () => {
|
||||
expect(channelConfigWarnings).toHaveLength(1);
|
||||
});
|
||||
|
||||
it("suppresses missing channel config diagnostics for inactive external channel plugins", () => {
|
||||
const dir = makeTempDir();
|
||||
writeManifest(dir, {
|
||||
id: "external-chat",
|
||||
channels: ["external-chat"],
|
||||
configSchema: { type: "object" },
|
||||
});
|
||||
const candidate = createPluginCandidate({
|
||||
idHint: "external-chat",
|
||||
rootDir: dir,
|
||||
origin: "global",
|
||||
});
|
||||
|
||||
const disabledRegistry = loadPluginManifestRegistry({
|
||||
config: { plugins: { entries: { "external-chat": { enabled: false } } } },
|
||||
candidates: [candidate],
|
||||
});
|
||||
expect(
|
||||
disabledRegistry.diagnostics.some((diagnostic) =>
|
||||
diagnostic.message.includes("without channelConfigs metadata"),
|
||||
),
|
||||
).toBe(false);
|
||||
|
||||
const allowlistRegistry = loadPluginManifestRegistry({
|
||||
config: { plugins: { allow: ["other-plugin"] } },
|
||||
candidates: [candidate],
|
||||
});
|
||||
expect(
|
||||
allowlistRegistry.diagnostics.some((diagnostic) =>
|
||||
diagnostic.message.includes("without channelConfigs metadata"),
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("suppresses duplicate warnings for explicit installed globals overriding bundled plugins", () => {
|
||||
const bundledDir = makeTempDir();
|
||||
const globalDir = makeTempDir();
|
||||
|
||||
@@ -568,10 +568,20 @@ function pushProviderAuthEnvVarsCompatDiagnostic(params: {
|
||||
function pushNonBundledChannelConfigDescriptorDiagnostic(params: {
|
||||
record: PluginManifestRecord;
|
||||
diagnostics: PluginDiagnostic[];
|
||||
normalized?: ReturnType<typeof normalizePluginsConfigWithResolver>;
|
||||
}): void {
|
||||
if (params.record.origin === "bundled" || params.record.format === "bundle") {
|
||||
return;
|
||||
}
|
||||
const configuredEntry = params.normalized?.entries[params.record.id];
|
||||
if (
|
||||
params.normalized?.enabled === false ||
|
||||
configuredEntry?.enabled === false ||
|
||||
params.normalized?.deny.includes(params.record.id) ||
|
||||
(params.normalized?.allow.length && !params.normalized.allow.includes(params.record.id))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const declaredChannels = params.record.channels
|
||||
.map((channelId) => channelId.trim())
|
||||
.filter((channelId) => channelId.length > 0);
|
||||
@@ -597,6 +607,7 @@ function pushNonBundledChannelConfigDescriptorDiagnostic(params: {
|
||||
function pushManifestCompatibilityDiagnostics(params: {
|
||||
record: PluginManifestRecord;
|
||||
diagnostics: PluginDiagnostic[];
|
||||
normalized?: ReturnType<typeof normalizePluginsConfigWithResolver>;
|
||||
}): void {
|
||||
pushProviderAuthEnvVarsCompatDiagnostic(params);
|
||||
pushNonBundledChannelConfigDescriptorDiagnostic(params);
|
||||
@@ -856,7 +867,7 @@ export function loadPluginManifestRegistry(
|
||||
if (PLUGIN_ORIGIN_RANK[candidate.origin] < PLUGIN_ORIGIN_RANK[existing.candidate.origin]) {
|
||||
records[existing.recordIndex] = record;
|
||||
seenIds.set(manifest.id, { candidate, recordIndex: existing.recordIndex });
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics });
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -881,7 +892,7 @@ export function loadPluginManifestRegistry(
|
||||
if (candidateWins) {
|
||||
records[existing.recordIndex] = record;
|
||||
seenIds.set(manifest.id, { candidate, recordIndex: existing.recordIndex });
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics });
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
|
||||
}
|
||||
if (
|
||||
isIntentionalInstalledBundledDuplicate({
|
||||
@@ -909,7 +920,7 @@ export function loadPluginManifestRegistry(
|
||||
|
||||
seenIds.set(manifest.id, { candidate, recordIndex: records.length });
|
||||
records.push(record);
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics });
|
||||
pushManifestCompatibilityDiagnostics({ record, diagnostics, normalized });
|
||||
}
|
||||
|
||||
const registry = { plugins: records, diagnostics: dedupePluginDiagnostics(diagnostics) };
|
||||
|
||||
Reference in New Issue
Block a user