You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
internal/dependency: Manager.visited persists across top-level traversals, silently skipping dependencies #417
internal/dependency/manager.go keeps a single visited map (claim() / lines ~53-70 before the interface churn in #170) for the whole lifetime of a dependency.Manager. Every top-level traversal — AddAll, RefreshAll, and AddDependency's addPackage — consults it before recursing, but none of them resets it at entry.
A second top-level call on the same Manager therefore sees every ref as already claimed and returns immediately with no error and no sources: a dependency-schema generation silently becomes a no-op.
Impact
Today most commands build a Manager and run exactly one traversal, so the bug does not fire in the common one-command case. It bites:
a retry of a traversal after a transient network/registry failure in the same process — the retry looks successful but generates nothing;
any embedding or future refactor that runs two traversals on one Manager (the CollectSources-based merged-generation path landing in Project typescript support #170 has exactly this shape, and its resetVisited history comment documents the hazard);
tests that reuse a manager fixture across cases.
Silent skip plus zero error output makes this a hard-to-diagnose failure mode when it does fire.
Suggested fix
Add a resetVisited() that reinitializes the map under the existing visitedMu, and call it at the start of each top-level traversal (AddAll/RefreshAll, AddDependency). ~15 lines plus a regression test asserting a second AddAll returns the same sources as the first instead of nothing.
Notes
A fix for this is already present on stevendborrelli:project-typescript-support (part of PR #170). Filing separately so it can land independently: cherry-pick the hunk onto main if desired, or close this on #170 merge if the fix-in-place in that PR is considered sufficient.
Problem
internal/dependency/manager.gokeeps a singlevisitedmap (claim()/ lines ~53-70 before the interface churn in #170) for the whole lifetime of adependency.Manager. Every top-level traversal —AddAll,RefreshAll, andAddDependency'saddPackage— consults it before recursing, but none of them resets it at entry.A second top-level call on the same
Managertherefore sees every ref as already claimed and returns immediately with no error and no sources: a dependency-schema generation silently becomes a no-op.Impact
Today most commands build a
Managerand run exactly one traversal, so the bug does not fire in the common one-command case. It bites:Manager(theCollectSources-based merged-generation path landing in Project typescript support #170 has exactly this shape, and itsresetVisitedhistory comment documents the hazard);Silent skip plus zero error output makes this a hard-to-diagnose failure mode when it does fire.
Suggested fix
Add a
resetVisited()that reinitializes the map under the existingvisitedMu, and call it at the start of each top-level traversal (AddAll/RefreshAll,AddDependency). ~15 lines plus a regression test asserting a secondAddAllreturns the same sources as the first instead of nothing.Notes
A fix for this is already present on
stevendborrelli:project-typescript-support(part of PR #170). Filing separately so it can land independently: cherry-pick the hunk onto main if desired, or close this on #170 merge if the fix-in-place in that PR is considered sufficient.