v0.24.0 fix(callgraph): Rust qualifier-aware resolver eliminates phantom callers#19
Conversation
…r change) Add CalleeQualifier enum and extract_callee() wrapper to helpers.rs. Swap the call_expression arm in mod.rs to call extract_callee() instead of extract_callee_name() directly; qualifier is discarded (metadata stays None) so runtime behavior is identical. Subsequent tasks layer in Rust-specific qualifier extraction.
…etadata
Walk scoped_identifier trees to collect path segments, strip reserved
prefixes (crate/super/self), and serialize non-bare qualifiers as
{"q":"path","v":"<segments>"} in edges.metadata. Bare calls (identifier
or post-strip-empty path) produce None metadata, preserving backward
compatibility with non-Rust edges and old DB rows.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-up) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds Chain+Receiver early-exit in Phase 2 inline resolution: when parse_callee_metadata returns Chain or Receiver, the edge is dropped before the same-file / same-language lookup, eliminating phantom callers from builder chains (e.g. OpenOptions::new().create() falsely binding to snapshot::create). Integration test in tests/integration_call_qualifier.rs confirms FAIL→PASS for the chain-builder case. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… impls
`impl crate::db_a::Db { fn helper() }` stored qualified_name
`crate::db_a::Db.helper`, but the SelfRecv payload from the caller's
impl block was `Db` (bare name), making the LIKE pattern `Db.%` miss.
Strip `::` path prefix in both parser walks (treesitter.rs parent_class
capture and relations/mod.rs child_rust_impl) so the rightmost segment
`Db` is used consistently. Confirmed with new cross-file split-impl test.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Guard that JS caller→helper bare-name edges survive unfiltered — the qualifier resolver is Rust-only and must not touch other languages. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ession comments Final-review cleanup: by T18 every CalleeMeta variant + parse_callee_metadata + path_filter_candidates + self_filter_candidates + CalleeQualifier is consumed; the #[allow(dead_code)] suppressors only mask future regressions. Wildcard arm comment in index_files.rs Phase 2 dispatch updated to reflect actual semantics (None / unrecognized q → fallthrough), not the now-irrelevant T16 reference.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (17)
📝 WalkthroughWalkthroughThis PR implements a Rust-specific "bare-name call qualifier" system to disambiguate function calls during code-graph analysis, then releases it as v0.24.0. The parser extracts qualifiers from Rust call syntax (path segments, self/impl receivers, or builder chains), serializes them as JSON metadata, and the indexer applies specialized filtering rules to route calls to the correct target while avoiding phantom edges to unrelated same-named functions. All manifests and changelog are updated accordingly. ChangesBare-name Call Qualifier for Rust
Release v0.24.0 — Manifest and Changelog
🎯 3 (Moderate) | ⏱️ ~25 minutes
✨ 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 |
Summary
Captures qualifier metadata on Rust call expressions (
Type::method,crate::path::fn,self.method,Self::method, builder chains) and uses it at edge-resolution time to eliminate phantom callers inimpact_analysisandfind_dead_code.Core changes (parser → wire → resolver):
CalleeQualifierenum (Bare / Path / SelfType / SelfRecv / Receiver / Chain);extract_calleeRust-only dispatch onscoped_identifier+field_expression; reserved-prefix strip (crate/super/self);current_rust_implplumbed throughwalk_for_relations.edges.metadataTEXT column already existed):{"q":"path","v":"snapshot"}/{"q":"self","v":"Db"}/{"q":"chain"}etc.parse_callee_metadata+path_filter_candidates(file segment + qualified_name segment match) +self_filter_candidates(qualified_nameLIKE 'Type.%', not file-restricted). Dispatch: Chain/Receiver → drop; Path-no-match → drop; Path-match → use filtered set; Self/SelfType-match → use filtered set; Bare → existing fallback chain unchanged.impl crate::path::Db { ... }producesDb.methodqualified_names instead ofcrate::path::Db.method— was breaking same-type LIKE matching for split impl blocks.Verification
impact run_full_index: 36 → 33 transitive callers (3 documented phantoms removed:decompress_with_cap,try_acquire_index_lock,from_project_root— all calledFile::create/OpenOptions::create(), notsnapshot::create)routing_benchP@1: 22/22 = 100% (no regression)--no-default-features+--all-features)--all-featuresMigration
Existing
.code-graph/databases keep working (qualifier-aware resolution is a no-op whenedges.metadata IS NULL). Runcode-graph-mcp index --rebuildto populate qualifier metadata on existing Rust files; incremental indexing picks it up automatically as files change.Diff stats
18 files, +917 / -22 lines. 21 commits (TDD-cycled per parser feature + per resolver rule).
Out of scope (future followups)
selector_expression/ JSfield_expression/ C#member_access_expression/ PHPscoped_call_expressionqualifier capture — Go has cleanest signal (explicit imports), would benefit most.Class::methodqualified_identifierscope (tracked separately).let p = Path::new(); p.exists()recoveringp's type) — different problem class.Test plan
cargo test --no-default-features— all greencargo test --all-features— all greencargo +1.95.0 clippy --all-targets --all-features -- -D warnings— no warningscargo bench --bench routing_bench— P@1 22/22, no regression[skip-memory-check]
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Type::method,crate::path::fn) from incorrectly attributing calls to unrelated functions.implblock path parsing.Chores
code-graph-mcp index --rebuildto populate enhanced metadata.