perf(core): speed up routing, pairing, slack, and security scans

This commit is contained in:
Peter Steinberger
2026-03-02 21:07:34 +00:00
parent 3a08e69a05
commit 5a32a66aa8
11 changed files with 462 additions and 38 deletions

View File

@@ -188,19 +188,30 @@ export function loadPluginManifestRegistry(params: {
}
const configSchema = manifest.configSchema;
const manifestMtime = safeStatMtimeMs(manifestRes.manifestPath);
const schemaCacheKey = manifestMtime
? `${manifestRes.manifestPath}:${manifestMtime}`
: manifestRes.manifestPath;
const schemaCacheKey = (() => {
if (!configSchema) {
return undefined;
}
const manifestMtime = safeStatMtimeMs(manifestRes.manifestPath);
return manifestMtime
? `${manifestRes.manifestPath}:${manifestMtime}`
: manifestRes.manifestPath;
})();
const existing = seenIds.get(manifest.id);
if (existing) {
// Check whether both candidates point to the same physical directory
// (e.g. via symlinks or different path representations). If so, this
// is a false-positive duplicate and can be silently skipped.
const existingReal = safeRealpathSync(existing.candidate.rootDir, realpathCache);
const candidateReal = safeRealpathSync(candidate.rootDir, realpathCache);
const samePlugin = Boolean(existingReal && candidateReal && existingReal === candidateReal);
const samePath = existing.candidate.rootDir === candidate.rootDir;
const samePlugin = (() => {
if (samePath) {
return true;
}
const existingReal = safeRealpathSync(existing.candidate.rootDir, realpathCache);
const candidateReal = safeRealpathSync(candidate.rootDir, realpathCache);
return Boolean(existingReal && candidateReal && existingReal === candidateReal);
})();
if (samePlugin) {
// Prefer higher-precedence origins even if candidates are passed in
// an unexpected order (config > workspace > global > bundled).