Skip to content

fix(extract): skip calls to sourceless stubs - #3531

Closed
DevChiniwala wants to merge 1 commit into
Graphify-Labs:v8from
DevChiniwala:fix/suppress-sourceless-call-targets
Closed

DevChiniwala wants to merge 1 commit into
Graphify-Labs:v8from
DevChiniwala:fix/suppress-sourceless-call-targets

Conversation

@DevChiniwala

Copy link
Copy Markdown
Contributor

Fixes #3156

Summary

  • prevent same-file AST call extraction from targeting source-less unresolved stubs
  • prevent cross-file name-only call resolution from targeting those stubs
  • preserve type/reference edges and calls to source-backed project definitions

Why

Unresolved external names can be represented as source-less nodes so that reference edges remain queryable. The call emitters were also treating those placeholders as callable definitions. A common example is HTTPException imported from FastAPI: the placeholder accumulated calls from unrelated files and became a misleading bridge node in community analysis.

This keeps source-less placeholders available for reference analysis while requiring a source-backed definition for calls edges. Local project-defined exceptions and other source-backed call targets continue through the existing resolution path.

Validation

  • python -m pytest tests\\test_sourceless_call_targets.py -q — 2 passed
  • python -m pytest tests\\test_extract.py tests\\test_multilang.py tests\\test_case_sensitive_resolution.py tests\\test_sourceless_call_targets.py -q --basetemp ... -k "not c_include_out_of_root_target_id_is_deterministic_across_checkout_paths" — 277 passed, 36 skipped, 1 deselected
  • ruff check graphify\\extractors\\engine.py graphify\\extract.py tests\\test_sourceless_call_targets.py — passed
  • python -m compileall -q graphify — passed
  • git diff --check — passed

The full local suite completed with 5,207 passed and 269 skipped; 49 pre-existing Windows/optional-environment failures remain, including Windows path-length, hook-shell, optional backend, and platform-specific filesystem cases.

Copilot AI lite review requested due to automatic review settings September 13, 2026 10:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@graphify-labs graphify-labs Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Graphify reviewed this change.

Worth a look — the grounded gate found no coupling regressions or blocking issues, but 1 advisory finding(s) below merit a look before merge.

Formal verification. No changes could be formally verified in this run.


Graphify review — findings

Suppresses calls edges to source-less call targets in both extract and _extract_generic, so a name-only call to an unresolved external symbol (e.g. HTTPException from FastAPI) no longer turns it into a cross-file calls hub. Such stubs stay eligible as targets of type/reference edges, while source-backed project definitions with the same name keep their normal call edges. Adds regression tests covering both the external-stub and project-defined cases.

Worth a look

  • Source-less filter also drops legitimate indirect/callback dispatch edges — graphify/extract.py:7489 · Escalate · medium
    • agreed by 2 of 2 members but NOT verified (no proof, no reproducing execution) — consensus is not a verdict; needs human review
Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 2180 functions depend on the 461 functions this change touches.

Health — this change adds coupling hotspots:

  • new: extract() — 592 callers, 44 callees
  • new: _rebuild_code() — 116 callers, 51 callees
  • new: _extract_generic() — 18 callers, 26 callees
  • new: extract_js() — 85 callers, 4 callees
  • new: extract_xaml() — 19 callers, 17 callees
  • new: dispatch_command() — 2 callers, 124 callees
  • new: extract_objc() — 27 callers, 9 callees
  • new: _get_extractor() — 26 callers, 6 callees
  • …and 38 more — each is listed as a finding

Verification — 2180 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 2005 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

109 of 276 test file(s) selected (39%) via static blast radius.

  • tests/test_astro_extraction.py — impact
  • tests/test_astro_import_ids.py — impact
  • tests/test_build.py — impact
  • tests/test_builtin_global_type_refs.py — impact
  • tests/test_case_sensitive_resolution.py — impact
  • tests/test_cjs_module_extension.py — impact
  • tests/test_cpp_nested_and_cli.py — impact
  • tests/test_cpp_objc_cross_file_calls.py — impact
  • tests/test_cross_extension_reexport_self_cycle.py — impact
  • tests/test_cross_language_call_resolution.py — impact
  • tests/test_cross_repo_member_calls.py — impact
  • tests/test_csharp_call_site_generic_args.py — impact
  • tests/test_csharp_enum_members.py — impact
  • tests/test_csharp_field_generic_args.py — impact
  • tests/test_csharp_generic_callsites.py — impact
  • tests/test_csharp_interface_dispatch.py — impact
  • tests/test_csharp_member_calls.py — impact
  • tests/test_csharp_member_nodes.py — impact
  • tests/test_csharp_object_creation.py — impact
  • tests/test_csharp_partial_classes.py — impact
  • tests/test_csharp_type_resolution.py — impact
  • tests/test_definition_file_portability.py — impact
  • tests/test_detect.py — impact
  • tests/test_dotnet.py — impact
  • tests/test_duplicate_annotation_edges.py — impact
  • tests/test_extract.py — impact
  • tests/test_extract_cache_location.py — impact
  • tests/test_file_label_disambiguation.py — impact
  • tests/test_file_node_id_spec.py — impact
  • tests/test_forwarding_review_findings.py — impact
  • tests/test_go_builtin_call_targets.py — impact
  • tests/test_go_qualified_resolution.py — impact
  • tests/test_import_extension_resolution.py — impact
  • tests/test_import_self_loops.py — impact
  • tests/test_imported_export_forwarding.py — impact
  • tests/test_incremental.py — impact
  • tests/test_indirect_call_arrow_single_param_shadow.py — impact
  • tests/test_indirect_call_catch_binding_shadow.py — impact
  • tests/test_indirect_call_external_import_shadow.py — impact
  • tests/test_indirect_call_for_of_binding_shadow.py — impact
  • tests/test_indirect_call_function_expression_shadow.py — impact
  • tests/test_indirect_call_nested_closure_shadow.py — impact
  • tests/test_indirect_dispatch.py — impact
  • tests/test_indirect_dispatch_assign_return.py — impact
  • tests/test_indirect_dispatch_getattr.py — impact
  • tests/test_inferred_confidence_rubric.py — impact
  • tests/test_inherited_field_receivers.py — impact
  • tests/test_issue_3405_python_resolution.py — impact
  • tests/test_java_member_calls.py — impact
  • tests/test_java_type_resolution.py — impact
  • … and 59 more

Selection is safe under the controlled-regression assumption; always-run tests + a periodic full run are the backstops. Advisory — it never changes the check verdict.

Formal verification

Could not verify: Could not verify extract.

The verifier did not have enough to check extract, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: parameter `cache_root` is annotated `Path | None` — outside the synthesizable primitive/collection set

Could not verify: Could not verify \_extract\_generic.

The verifier did not have enough to check \_extract\_generic, so it is saying so rather than guessing. No false assurance is the whole point.

Guarantee: No guarantee either way, this is an honest abstention, not a pass.

Note: Reason: parameter `path` is annotated `Path` — outside the synthesizable primitive/collection set

· 46 more finding(s) on lines outside this diff (see the check run).

@safishamsi

Copy link
Copy Markdown
Member

Shipped in v0.9.62 (now on PyPI: uv tool install graphifyy==0.9.62). Your commits were cherry-picked with authorship preserved, so this shows up under your GitHub contributions. Thanks @DevChiniwala!

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.

Suppress sourceless external call targets like FastAPI HTTPException from bridge analysis

3 participants