Skip to content

armgit / ECC

Public Imported from GitHub
0

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

fix(install): discard orphan dependencies of skipped requests

Dante381b9b7bf430
diff --git a/scripts/lib/install-manifests.js b/scripts/lib/install-manifests.js
index 85cd4448b..ddef462a1 100644
--- a/scripts/lib/install-manifests.js
+++ b/scripts/lib/install-manifests.js
@@ -694,12 +694,26 @@ function resolveInstallPlan(options = {}) {
}
visitingIds.delete(moduleId);
resolvedIds.add(moduleId);
- selectedIds.add(moduleId);
return true;
}
+ // Resolution may visit supported dependencies before a later required edge fails.
+ // Select only the closure of successful requests, so failed requests leave no
+ // orphan modules while shared dependencies remain available to successful ones.
+ function selectResolvedModule(moduleId) {
+ if (!resolvedIds.has(moduleId) || selectedIds.has(moduleId)) {
+ return;
+ }
+ selectedIds.add(moduleId);
+ for (const dependencyId of manifests.modulesById.get(moduleId).dependencies) {
+ selectResolvedModule(dependencyId);
+ }
+ }
+
for (const moduleId of effectiveRequestedIds) {
- resolveModule(moduleId, null);
+ if (resolveModule(moduleId, null)) {
+ selectResolvedModule(moduleId);
+ }
}
const selectedModules = manifests.modules.filter(module => selectedIds.has(module.id));
diff --git a/tests/lib/install-manifests.test.js b/tests/lib/install-manifests.test.js
index 97bdb6177..e14f61225 100644
--- a/tests/lib/install-manifests.test.js
+++ b/tests/lib/install-manifests.test.js
@@ -770,6 +770,37 @@ function runTests() {
}
})) passed++; else failed++;
+ if (test('retains dependencies only when reachable from a successful request', () => {
+ const repoRoot = createTestRepo();
+ try {
+ const module = (id, dependencies = [], targets = ['claude']) => ({
+ id, kind: 'skills', description: id, paths: [id], targets,
+ dependencies, defaultInstall: false, cost: 'light', stability: 'stable'
+ });
+ writeJson(path.join(repoRoot, 'manifests', 'install-modules.json'), {
+ version: 1,
+ modules: [
+ module('parent', ['child', 'unsupported']),
+ module('child', ['leaf']),
+ module('leaf'),
+ module('unsupported', [], ['cursor']),
+ module('successful', ['child'])
+ ]
+ });
+ writeJson(path.join(repoRoot, 'manifests', 'install-profiles.json'), {
+ version: 1, profiles: { core: { description: 'Core', modules: ['parent'] } }
+ });
+ const plan = modules => resolveInstallPlan({ repoRoot, moduleIds: modules, target: 'claude' });
+ assert.deepStrictEqual(plan(['parent']).selectedModuleIds, []);
+ assert.deepStrictEqual(plan(['parent']).skippedModuleIds, ['parent', 'unsupported']);
+ assert.deepStrictEqual(plan(['parent', 'successful']).selectedModuleIds, ['child', 'leaf', 'successful']);
+ assert.deepStrictEqual(plan(['successful', 'parent']).selectedModuleIds, ['child', 'leaf', 'successful']);
+ assert.deepStrictEqual(plan(['parent', 'child']).selectedModuleIds, ['child', 'leaf']);
+ } finally {
+ cleanupTestRepo(repoRoot);
+ }
+ })) passed++; else failed++;
+
if (test('rejects missing, malformed, and unsupported manifest fixtures', () => {
const repoRoot = createTestRepo();
try {