Skip to content

Fix AST uses edge confidence (#3539) - #3541

Open
hopstreax wants to merge 1 commit into
Graphify-Labs:v8from
hopstreax:investigate/3539-ast-uses-confidence
Open

hopstreax wants to merge 1 commit into
Graphify-Labs:v8from
hopstreax:investigate/3539-ast-uses-confidence

Conversation

@hopstreax

Copy link
Copy Markdown
Contributor

Summary

Fixes #3539

AST cross-file uses edges were incorrectly emitted as INFERRED / 0.95 / 0.8 even though they are deterministically extracted from explicit Python AST syntax.

This PR updates these edges to use the EXTRACTED confidence tier.

Changes

  • Emit Python AST cross-file uses edges as EXTRACTED with confidence_score: 1.0.
  • Set their graph weight to 1.0, consistent with other structurally extracted relationships.
  • Update existing uses tests to reflect the corrected confidence tier.
  • Add regression coverage for uses edge metadata.
  • Add regression coverage for references + uses collapse preserving the extracted metadata.
  • Leave build.py, Apex, and other language extractors unchanged.

Validation

  • Focused uses tests: 10 passed
  • test_extract.py: 223 passed, 8 skipped
  • Confidence, relation-collapse, build/dedup, symbol-resolution, and language tests all pass.
  • git diff --check: clean.

The one unrelated failure encountered in the broader extraction suite is a pre-existing Windows MAX_PATH fixture-path issue.

@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.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

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


Graphify review — findings

Reclassifies cross-file Python import uses edges from INFERRED/0.95 (weight 0.8) to EXTRACTED/1.0 (weight 1.0), on the grounds that these edges come from explicit source syntax rather than inference. Renames the test helper _inferred_uses to _uses_edges and updates the existing suite to match, and adds test_3539_ast_uses_edge_metadata_is_extracted plus test_3539_references_and_uses_collapse_retains_extracted_metadata covering the new metadata and the references/uses collapse in build_from_json.

No blocking issues surfaced. 3 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 2169 functions depend on the 570 functions this change touches.

Health — this change adds coupling hotspots:

  • new: extract() — 591 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: _resolve_js_module_path() — 34 callers, 9 callees
  • new: dispatch_command() — 2 callers, 124 callees
  • new: extract_objc() — 27 callers, 9 callees
  • …and 35 more — each is listed as a finding

Verification — 2169 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: 1227 function(s) in the blast radius were not formally verified this run

Test selection

Test selection

34 of 275 test file(s) selected (12%) via static blast radius.

  • tests/test_astro_extraction.py — impact
  • tests/test_build.py — impact
  • tests/test_cjs_module_extension.py — impact
  • tests/test_cpp_nested_and_cli.py — impact
  • tests/test_dotnet.py — impact
  • tests/test_extract.py — impact, changed-test
  • tests/test_forwarding_review_findings.py — impact
  • tests/test_import_extension_resolution.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_js_exported_scalar_bindings.py — impact
  • tests/test_languages.py — impact
  • tests/test_multilang.py — impact
  • tests/test_package_json_subpath_imports.py — impact
  • tests/test_pascal.py — impact
  • tests/test_pascal_resolution.py — impact
  • tests/test_phantom_external_import.py — impact
  • tests/test_python_import_resolution.py — impact
  • tests/test_python_parse_memoization.py — impact
  • tests/test_python_underscore_resolution.py — impact
  • tests/test_rationale.py — impact
  • tests/test_resolve_memoization.py — impact
  • tests/test_ruby_resolution.py — impact
  • tests/test_scala_self_type.py — impact
  • tests/test_source_key_memoization.py — impact
  • tests/test_src_layout_import_resolution.py — impact
  • tests/test_swift_computed_properties.py — impact
  • tests/test_trailing_newline_not_a_syntax_error.py — impact
  • tests/test_ts_new_expression_calls.py — impact
  • tests/test_typescript_module_extensions.py — impact
  • tests/test_unmapped_at_alias_resolution.py — impact
  • tests/test_vue_extraction.py — impact
  • tests/test_walk_python_tree_iterative.py — impact

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 \_resolve\_cross\_file\_imports.

The verifier did not have enough to check \_resolve\_cross\_file\_imports, 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: non-vacuity: domain too small (only 2 distinct inputs exercised, need 3) — 'no divergence' would be near-vacuous

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

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.

AST extractor: all 'uses' edges hardcoded to INFERRED/0.95 even when structurally EXTRACTED

1 participant