fix: resolve bare-name TESTED_BY sources and run resolution in postprocess#601
Open
SHudici wants to merge 1 commit into
Open
fix: resolve bare-name TESTED_BY sources and run resolution in postprocess#601SHudici wants to merge 1 commit into
SHudici wants to merge 1 commit into
Conversation
…ocess TESTED_BY edges are derived from test-to-production CALLS edges at parse time, so their production endpoint inherits the bare name of any call the parser couldn't resolve cross-file. That is the dominant case in practice (tests almost always import the code they test): on a mid-size production repo, 79% of TESTED_BY edges (6.8k of 8.5k) carried bare sources, so qualified-name consumers (tests_for, review context, transitive test lookup) returned nothing for most functions. Two changes: - GraphStore.resolve_bare_tested_by_sources() resolves bare TESTED_BY sources with the same strategy as resolve_bare_call_targets (unique node name, else IMPORTS_FROM disambiguation - here via the test file's imports). Both methods now share one private helper; the CALLS behavior is unchanged and covered by a regression test. - The resolution pair now actually runs: resolve_bare_call_targets was defined but never called from any pipeline, so bare endpoints survived every build. Resolution is wired into all three postprocess paths (_run_postprocess for the MCP build tool, run_postprocess for the re-run tool, and the shared run_post_processing) ahead of the derived steps, so flows and communities see qualified edges too. It runs at the "minimal" level as well - it is a cheap correctness step (one indexed pass over bare edges), not an enrichment. Failures are isolated as build warnings, matching the existing step-isolation contract. Ambiguous names without import evidence stay bare rather than guessing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
Problem
TESTED_BY edges are derived from test→production CALLS edges at parse time, so their production endpoint inherits the bare name of any call the parser couldn't resolve cross-file. That is the dominant case in practice — tests almost always import the code they test. On a mid-size production repo we measured 79% of TESTED_BY edges (6.8k of 8.5k) carrying bare sources, so every qualified-name consumer (
tests_for, review context, transitive test lookup) returned 0 results for most functions.Compounding this:
GraphStore.resolve_bare_call_targets— the existing post-hoc resolver for bare CALLS targets — is defined but never called from any pipeline, so bare endpoints survived every build untouched.Fix
GraphStore.resolve_bare_tested_by_sources(): resolves bare TESTED_BY sources with the same strategy as the CALLS resolver (unique node name → resolve; multiple candidates → prefer the one whose file the test file imports; otherwise stay bare rather than guess). Both methods now share one private helper; CALLS behavior is unchanged and pinned by a regression test._run_postprocessfor the MCP build tool,run_postprocessfor the re-run tool, sharedrun_post_processingfor watch mode), ahead of the derived steps so flows and communities see qualified edges too. It runs at theminimallevel as well — it's a cheap correctness pass over an indexed subset, not an enrichment. Failures degrade to build warnings per the existing step-isolation contract.Measured effect (same production repo, 4.7k nodes / 39k edges)
tests_foron a well-tested function: 0 results → 15 resultsTesting
New tests: resolver units (unique name, ambiguous-stays-bare, import disambiguation via the test file, unknown name untouched, CALLS regression), shared-pipeline wiring (resolves + reports
bare_edges_resolved, failure isolated to a warning), and build-tool level gating (minimalresolves,noneskips). Full suite passes.Composes with #598 (TESTED_BY read direction) but does not require it; this PR is cut independently from main.
🤖 Generated with Claude Code