Skip to content

fix(build): cover every extract language in the cross-language edge guard (#5247) - #5260

Open
Yi-111-a wants to merge 1 commit into
Graphify-Labs:v8from
Yi-111-a:fix/edge-lang-family-drift
Open

Yi-111-a wants to merge 1 commit into
Graphify-Labs:v8from
Yi-111-a:fix/edge-lang-family-drift

Conversation

@Yi-111-a

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #5247.

build._EDGE_LANG_FAMILY (the cross-language phantom-edge guard from #1749) says it mirrors extract._LANG_FAMILY_BY_EXT, but it had drifted: 37 extensions that extract assigns a family had none in build, so the guard never fired for an edge touching them. That includes .dart, .vue/.svelte/.astro/.ejs, .kts/.gradle, .vb/.razor/.cshtml/.xaml, .sql, .sh/.bash, .ps1/.psm1/.psd1, .zig, .ex/.exs, .jl, .r, .sol, Erlang, COBOL, .luau and the alternate PHP extensions.

This PR adds the missing extensions to _EDGE_LANG_FAMILY and keeps build's own family names (js, jvm, cs, php, lua, ...), so SFCs stay with JS/TS, Kotlin scripts/Gradle with the JVM, and VB/Razor/XAML with C#. Nothing that was already in the table changes.

Type of change

  • Bug fix
  • New feature
  • Documentation
  • Tests or CI
  • Refactor
  • Security fix

Verification & Invariants

Invariant: an imports/imports_from/references edge between two known code languages of different interop families, or an INFERRED cross-family calls edge, is dropped in build_from_json. That only holds if every language extract knows has a family in the guard table.

  • New test_edge_lang_family_covers_every_extract_language fails if _LANG_FAMILY_BY_EXT gains an extension that _EDGE_LANG_FAMILY lacks. It also fails if a build family spans two extract families, so the guard can never drop an edge that call resolution treats as same-language. The family names differ between the two tables, so the test compares groupings, not names.
  • New test_cross_language_import_into_dart_is_dropped: a py -> dart imports_from edge is dropped and a dart -> dart import survives.
  • Both tests fail on v8 without the change and pass with it.

Limitations, left out on purpose to keep this narrow:

  • build still has .pyi, .hh, .hxx, which extract's table lacks. That is the opposite direction and does not weaken the guard.

  • build keeps Swift separate from C/ObjC (extract groups them as native). That is stricter than extract, and the new test allows it.

  • On current v8, the issue's three-file CLI repro already binds from app import db to app/__init__.py (I checked before and after this change), so the end-to-end symptom no longer shows there. The table gap is still real for any edge that does reach build pointing at one of these extensions, which is what the regression test covers.

  • Read the CONTRIBUTING.md guide.

  • Reproduced the issue and identified the invariant.

  • Made the smallest fix necessary.

  • Added a regression test (if bug fix) or isolated boundary test.

  • Kept the PR description synchronized with the final implementation.

  • Documented any limitations / unsupported cases explicitly.

How was this tested?

uv run pytest tests/test_build.py -k "edge_lang_family or dart"   # 2 failed on v8, 2 passed with fix
uv run pytest tests                                                # 11189 passed, 307 skipped
uv run ruff check graphify/build.py tests/test_build.py            # clean

The full run also had failures that this change does not cause:

Graphify-specific checklist

  • I updated generated skill artifacts (uv run python -m tools.skillgen --bless) when changing their source fragments. (n/a, no fragments touched)
  • I confirmed that AST/structural extraction remains deterministic (no ambient state dependencies like ENV variables).
  • I reviewed changes for security implications (no unsafe interpolation into shell/Python).
  • I confirmed no API keys or local-only graph data are included.
  • (If applicable) I disclosed AI authorship in my commit messages. This change was written with the help of an AI coding agent and reviewed before submitting.

…uard (Graphify-Labs#5247)

build._EDGE_LANG_FAMILY is meant to mirror extract._LANG_FAMILY_BY_EXT but
had drifted: 37 extensions extract knows (.dart, .vue/.svelte/.astro/.ejs,
.kts/.gradle, .vb/.razor/.cshtml/.xaml, .sql, .sh, .ps1, .zig, .ex, .jl,
alternate PHP extensions, ...) had no family, so the Graphify-Labs#1749 guard never
dropped a cross-language imports/references/calls edge touching them.

Add them, using build's own family names, and add a test that fails if
extract gains a language the guard does not cover or if a build family
ever spans two extract families.

Written with the help of an AI coding agent.
@Yi-111-a
Yi-111-a requested a review from safishamsi as a code owner November 16, 2026 16:55

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

No issues found by static checks — no coupling regressions or blocking issues in the code graph. That is not the same as safe to merge: see what was not checked.

Not checked: tests were not run; no formal proof of the changed code.


Graphify review — findings

Extends the cross-language phantom-edge guard in build to cover every extension extract already classifies, so an import like a Python from app import db no longer binds to a Dart lib/app.dart. Previously, extensions missing from _EDGE_LANG_FAMILY (Vue/Svelte, Kotlin script, VB/Razor, COBOL, Erlang, Zig, Elixir, Dart, SQL, shell, PowerShell, and others) had no family, so the guard never fired for edges touching them and they were kept. Adds tests that fail if the two tables drift apart and that a py→dart import is dropped while dart→dart survives.

No blocking issues surfaced.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 2312 functions depend on the 316 functions this change touches.

Health — this change adds coupling hotspots:

  • worse: build_from_json() — 320 callers, 25 callees

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

Test selection

Test selection

158 of 581 test file(s) selected (27%) via static blast radius.

  • tests/test_4874_jvm_resolution.py — impact
  • tests/test_4978_reconcile_cost.py — impact
  • tests/test_5072_splittable_under_cap_retry.py — impact
  • tests/test_affected_cli.py — impact
  • tests/test_affected_path_file_node.py — impact
  • tests/test_affected_seed_reference_forms.py — impact
  • tests/test_alias_folding.py — impact
  • tests/test_analyze.py — impact
  • tests/test_atomic_canvas_export.py — impact
  • tests/test_atomic_writes.py — impact
  • tests/test_backend_opt_in.py — impact
  • tests/test_benchmark.py — impact
  • tests/test_benchmark_raw_graph.py — impact
  • tests/test_benchmark_real_query.py — impact
  • tests/test_build.py — impact, changed-test
  • tests/test_build_located_semantic_identity.py — impact
  • tests/test_build_merge_dedup_scope.py — impact
  • tests/test_build_merge_ghost_fold_4955.py — impact
  • tests/test_build_merge_hyperedges_and_prune.py — impact
  • tests/test_build_merge_shrink_guard.py — impact
  • tests/test_c_include_resolution.py — impact
  • tests/test_carried_hyperedge_remap.py — impact
  • tests/test_charmap_encoding.py — impact
  • tests/test_chunking.py — impact
  • tests/test_claude_cli_backend.py — impact
  • tests/test_cli_export.py — impact
  • tests/test_cluster.py — impact
  • tests/test_community_labels_skill.py — impact
  • tests/test_compact_graph_json.py — impact
  • tests/test_confidence.py — impact
  • tests/test_confidence_score_output.py — impact
  • tests/test_corrupt_graph_json.py — impact
  • tests/test_cpp_forward_declarations.py — impact
  • tests/test_cpp_member_declaration_identity.py — impact
  • tests/test_cpp_objc_cross_file_calls.py — impact
  • tests/test_cross_extension_reexport_self_cycle.py — impact
  • tests/test_cross_repo_external_call_guards.py — impact
  • tests/test_csharp_method_owner_labels.py — impact
  • tests/test_csharp_object_creation.py — impact
  • tests/test_dedup.py — impact
  • tests/test_dedup_remaps_hyperedges.py — impact
  • tests/test_dedup_shrink_refuses_force_write.py — impact
  • tests/test_dedup_survivor_richness.py — impact
  • tests/test_definition_file_portability.py — impact
  • tests/test_duplicate_annotation_edges.py — impact
  • tests/test_edge_also_seen.py — impact
  • tests/test_evidence_binding.py — impact
  • tests/test_export.py — impact
  • tests/test_export_control_characters.py — impact
  • tests/test_export_direction.py — impact
  • … and 108 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.

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

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant