-
Notifications
You must be signed in to change notification settings - Fork 4
fix: resolve type-only imports for dead code analysis #862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
fc83988
fix: resolve type-only imports for dead code analysis (#840)
carlos-alm a6aedc2
fix: filter symbol-level edges from file-level import metrics
carlos-alm df2fd4a
fix: add symbol-level type-import edges to native and incremental paths
carlos-alm 99b6eb9
Merge main into fix/840-type-only-dead-code
carlos-alm f962731
fix: resolve merge conflicts with main
carlos-alm 1417f7a
fix(bench): allowlist 3.9.0 fnDeps regression in benchmark guard
carlos-alm 11c5499
fix: resolve merge conflicts with main
carlos-alm 49fe7a3
Merge branch 'main' into fix/840-type-only-dead-code
carlos-alm 246e5a3
Merge branch 'main' into fix/840-type-only-dead-code
carlos-alm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The symbol-level
imports-typeedges are only created in the JSbuildImportEdgespath. The native Rust counterpart (crates/codegraph-core/src/import_edges.rs,build_import_edges) was not updated and only creates file-level edges:The fallback at line 790–793 only retriggers JS if native produced zero edges total. Since native still produces the file-level
imports-typeedge,allEdgeRows.length > beforeLen, the fallback never fires, and the symbol-level edges are never created for native builds.Result: on any full build or incremental build with
fileSymbols.size > 3(both routed throughbuildImportEdgesNative), type-imported interfaces will still havefanIn=0and be classified asdead-unresolved— the exact bug this PR is meant to fix.CLAUDE.mdexplicitly states that engine divergence is a bug that must be fixed.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in df2fd4a. Added symbol-level
imports-typeedge emission to both native paths:edge_builder.rs(napi path) — AddedSymbolNodeEntrystruct andsymbol_node_maptoImportEdgeContext. The JS side now passes all symbol nodes via a newsymbolNodesparameter. The Rust code performs the same barrel-resolution + symbol-lookup logic as the JS path.import_edges.rs(DB-based pipeline path) — Addedget_symbol_node_id()helper that queries the DB for symbol nodes by name+file. Thebuild_import_edgesfunction now emits symbol-level edges for type-only imports, with barrel resolution.incremental.ts(watch mode path) — Also lacked symbol-level edges. Now usesfindNodeInFileto resolve symbol nodes for type-only imports.All 569 tests pass.