Skip to content

fix(session): prevent false direct_import for nonexistent targets#157

Closed
rocketman-code wants to merge 1 commit intomainfrom
fix/cut-direct-import
Closed

fix(session): prevent false direct_import for nonexistent targets#157
rocketman-code wants to merge 1 commit intomainfrom
fix/cut-direct-import

Conversation

@rocketman-code
Copy link
Owner

Summary

When --cut is used with a target that doesn't exist in the graph, the direct_import field in the report incorrectly returns true. This happens because the check cuts.is_empty() && chains.iter().all(|c| c.len() == 2) vacuously evaluates to true when both cuts and chains are empty.

The fix adds a !chains.is_empty() guard so direct_import is only true when there are actual import chains confirming a direct dependency.

Closes #151

@rocketman-code
Copy link
Owner Author

Closing: the fix (commit 94d90c1) is already on main. The branch is based on a stale main and would be empty after rebase.

@rocketman-code rocketman-code deleted the fix/cut-direct-import branch February 22, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(session): --cut reports direct_import: true for nonexistent targets

1 participant