Repository navigation
fix(detectorkit): PropagateScopes stands down when the root is absent from the graph - #40
Conversation
The seeding lookup's error was discarded, so a root that is not in the graph (most plausibly an ID held from before PromoteToModule replaced it) seeded nothing, walked nothing, and still ran the closing runtime default over every unscoped dependency. Development-only packages presented as shipped, silently. An absent root is now a no-op for the whole pass. A root that is present with zero direct dependencies is unchanged: that is not an error, and the default still applies, which the existing orphan test pins. Closes #38 Co-Authored-By: Claude Fable 5.1 <[email protected]>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthrough
ChangesScope propagation behavior
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Absent graph roots now leave dependency scopes unchanged instead of defaulting them to runtime, while valid empty roots retain existing runtime default behavior. The intended behavior is covered with no active merge risk identified. Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Closes #38.
What was wrong
PropagateScopesdiscarded the error fromg.DirectDependencies(rootID). When the root is not in the graph, the seeding loop is empty and the breadth-first walk never runs, but the closing pass still ran and stamped every unscoped dependency in the graph runtime. No scope had propagated from any root, and the caller got no signal. The result is wrong in the unsafe direction: development-only packages present as shipped.Reproduced before the change with the snippet from the issue (
dev.PrimaryScope()came backruntime).The fix
An absent root is now a no-op for the whole pass: nothing is seeded, so nothing is defaulted. This is the minimal, non-breaking option from the issue. The function keeps its signature, since every current caller ignores scope-propagation failure and adding an error return is a deliberate API decision rather than a bug fix.
A root that is present with zero direct dependencies is deliberately unchanged. That lookup succeeds with an empty list, so the runtime default still applies, and
TestPropagateScopesDefaultsOrphansToRuntimecontinues to pin that side. The new test pins both sides of the distinction in one place.Verification
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests