fix(code-index): disclose ambiguous calls as caller gaps - #3067
Open
devin-ai-integration[bot] wants to merge 2 commits into
Open
devin-ai-integration[bot] wants to merge 2 commits into
devin-ai-integration[bot] wants to merge 2 commits into
Conversation
Cross-file resolution returned no binding when more than one inherent candidate remained, and same-file resolution dropped ambiguous references before they reached cross-file resolution. Neither left a gap row, so callers, callees and impact answers looked complete. Ambiguous same-file references are now retained like unbound ones, and cross-file resolution reports ambiguous calls as unresolved-call gaps in both whole-set and sparse resolution. Fixes #3012 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
A retained same-file ambiguous call could bind a shadowed import, or get no gap row in Python and TypeScript. Mark it ambiguous_local so sealing reports it as a gap and never binds it cross-file. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
callers/callees/impact answers report themselves as partial.Motivation
Fixes #3012.
resolve_cross_file_referencereturnedNonewhen more than one inherent candidate remained, and same-file resolution inresolve_file_referencesdropped ambiguous references (_ => {}). Neither path left a gap row, so an incomplete radius looked complete.Changes
production/helpers.rs:resolve_cross_file_referencereturnsReferenceResolutionV1::{Bound, Ambiguous}; per-file resolution collects ambiguousCallsreferences as gaps.CrossFileResolutionV1.implementor_gapsis renamed togapsand carries these rows too;resolve_selected_cross_file_referencesreturns the full resolution.production/sparse_resolution.rs: the sparse (incremental) path adds those gaps to the owning file'sunresolved_calls, so incremental and full seals agree.chunks.rs/chunks/artifacts.rs: deleted the same-file ambiguity special case. Ambiguous references are now retained with a newCodeIndexUnresolvedReferenceV1.ambiguous_localflag (serde-skipped when false, so existing artifacts are unchanged). Sealing treats a flagged reference asAmbiguousbefore any import lookup, so it is always a gap and can never bind a shadowed import. Java overloads keep their existing path.qualified_reference_selects_its_namespace_and_bare_name_stays_ambiguousnow asserts the ambiguous bare name is retained, not dropped.Choice made: ambiguous candidates are disclosed as gaps, not emitted as low-confidence edges. The issue proposed either option; gaps add no false edges to graph answers.
Test plan
relation_coverage::a_type_path_call_with_two_inherent_candidates_makes_both_callers_partial(cross-fileClock::tick()with cfg-gated impls in two files): fails on master, passes with the fix.relation_coverage::a_same_file_call_with_two_candidates_makes_both_callers_partial(Ruby) anda_same_file_python_call_with_two_candidates_makes_its_callees_partial(Python): fail without the same-file change, pass with it.relation_coverage::locally_ambiguous_definitions_shadow_an_imported_name: no false caller on the importedpkg.lib.scale. Fails on the first commit, passes now.cargo test -p tracedecay-code-index: all pass (285 + 209 + 4 + 3)cargo clippy -p tracedecay-code-index --all-targets -- -D warnings: cleancargo fmt --all -- --check: cleancargo nextest runleft to CI.Checklist
CHANGELOG.mdupdated (release-please manages it).envfiles includedLink to Devin session: https://app.devin.ai/sessions/fd546572dcdb49cbbf8f10b6dec5ec80
Open in Devin Desktop: https://app.devin.ai/desktop/session/fd546572dcdb49cbbf8f10b6dec5ec80?variant=devin
Requested by: @ScriptedAlchemy