Repository navigation
Conversation
…headers off the alias index (Graphify-Labs#5218) Angle includes (#include <...>) carried no include metadata, so _resolve_c_include_edges never looked at them and their bare-stem target went through the legacy alias index. <liba/Bus.h> then missed liba/include/liba/Bus.h, and <functional> bound to a unique project header named functional.h. Angle includes are now tagged include_kind "angle". The corpus resolver handles them with the existing path-suffix rule when they have a directory component, and the alias lookup skips an angle include that names a C/C++ standard header, like the Python stdlib guard (Graphify-Labs#4261).
|
Thanks for the pull request, @Yi-111-a. A maintainer will review it soon. Want to talk it through while it is in review? Come join us on our Discord server. For longer-form discussion there is also GitHub Discussions. A couple of things that speed up review: make sure the test suite passes on Python 3.10 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
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.
Not checked: tests were not run; formal verification proved 0 of 4 changed function(s) (2 sampled, not proven, 2 not verified).
Formal verification. PR-changed functions: 2/4 verified (0 proven, 2 may-equivalent, 0 distinguished) · 2 not verified (2 vacuous).
Not verified on this run: build\_from\_json (vacuous: never exercised), \_import\_c (vacuous: never exercised).
Graphify review — findings
Fixes C/C++ angle includes binding to the wrong project header: <functional> no longer resolves to a same-named libc/functional.h, because _is_std_angle_include now keeps standard-header targets out of the bare-stem alias index in both finalize_raw_graph_endpoints and build_from_json. Only standard names from the new C_STANDARD_INCLUDE_NAMES set get that treatment, so a bare non-standard <name> can still alias to a same-named project header. Tags angle includes with include_kind: "angle" in _import_c, and _resolve_c_include_edges now resolves directory-qualified ones like <liba/Bus.h> to the matching corpus header by path suffix. Bare <name> angle includes are skipped there, so they stay unresolved external stubs.
Worth a look
- Bare non-standard angle includes still alias to same-named project headers —
graphify/build.py:2052· Escalate · medium- NOT verified (no proof, no reproducing execution) — needs human review
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 6122 functions depend on the 765 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
extract()— 1241 callers, 78 callees - worse:
build_from_json()— 319 callers, 26 callees - worse:
build()— 94 callers, 6 callees - worse:
finalize_raw_graph_endpoints()— 12 callers, 6 callees
Verification — 6122 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: 5406 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
397 of 575 test file(s) selected (69%) via static blast radius.
tests/test_4874_jvm_resolution.py— impacttests/test_4909_reference_binding_scale.py— impacttests/test_4978_reconcile_cost.py— impacttests/test_4992_ts_import_types.py— impacttests/test_5072_splittable_under_cap_retry.py— impacttests/test_affected_cli.py— impacttests/test_affected_overrides.py— impacttests/test_affected_path_file_node.py— impacttests/test_affected_seed_reference_forms.py— impacttests/test_alias_folding.py— impacttests/test_analyze.py— impacttests/test_astro_extraction.py— impacttests/test_astro_import_ids.py— impacttests/test_atomic_canvas_export.py— impacttests/test_atomic_writes.py— impacttests/test_backend_opt_in.py— impacttests/test_benchmark.py— impacttests/test_benchmark_raw_graph.py— impacttests/test_benchmark_real_query.py— impacttests/test_blade_extractor.py— impacttests/test_build.py— impacttests/test_build_located_semantic_identity.py— impacttests/test_build_merge_dedup_scope.py— impacttests/test_build_merge_ghost_fold_4955.py— impacttests/test_build_merge_hyperedges_and_prune.py— impacttests/test_build_merge_shrink_guard.py— impacttests/test_builtin_global_type_refs.py— impacttests/test_c_include_resolution.py— impact, changed-testtests/test_cache.py— impacttests/test_carried_hyperedge_remap.py— impacttests/test_case_only_decl_ids_4904.py— impacttests/test_case_sensitive_resolution.py— impacttests/test_charmap_encoding.py— impacttests/test_chunking.py— impacttests/test_cjs_module_extension.py— impacttests/test_claude_cli_backend.py— impacttests/test_cli_export.py— impacttests/test_cluster.py— impacttests/test_cobol_extractor.py— impacttests/test_community_labels_skill.py— impacttests/test_compact_graph_json.py— impacttests/test_confidence.py— impacttests/test_confidence_score_output.py— impacttests/test_corrupt_graph_json.py— impacttests/test_cpp_alias_member_resolution.py— impacttests/test_cpp_anonymous_namespace_receivers.py— impacttests/test_cpp_conditional_initializers.py— impacttests/test_cpp_forward_declarations.py— impacttests/test_cpp_forward_receiver_completion.py— impacttests/test_cpp_inherited_member_resolution.py— impact- … and 347 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 build\_from\_json.
The verifier did not have enough to check build\_from\_json, 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: no capturable inputs from the test suite; property tier: not verifiable: all 11 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous
No difference found (not proven): No behavior difference found in finalize\_raw\_graph\_endpoints (not a proof).
The verifier ran both versions of finalize\_raw\_graph\_endpoints on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
Could not verify: Could not verify \_import\_c.
The verifier did not have enough to check \_import\_c, 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: no capturable inputs from the test suite; property tier: not verifiable: all 264 sampled inputs raised on both versions — the function never executed, so 'no divergence' would be vacuous (mostly AttributeError — names the real obstacle, not a sampling gap)
No difference found (not proven): No behavior difference found in \_resolve\_c\_include\_edges (not a proof).
The verifier ran both versions of \_resolve\_c\_include\_edges on many inputs and saw identical behavior every time. Strong evidence the change is safe, but evidence, not a proof.
Guarantee: Empirical: differential testing (both versions run on many generated inputs). A divergence on an untested input remains possible, so this is 'no counterexample found', not 'proven equivalent'.
Note: An input the sampler did not try could still differ.
· 4 more finding(s) on lines outside this diff (see the check run).
What does this PR do?
Fixes #5218.
#include <...>edges carried no include metadata, so_resolve_c_include_edgesskipped them and their bare-stem target went through the legacy alias index inbuild.py. On the repro from the issue this gives:Changes:
_import_ctags angle includes withinclude_kind: "angle"andraw_include, the same way quoted ones are tagged._resolve_c_include_edgesaccepts angle includes, but only when they have a directory component (<liba/Bus.h>). Those go through the existing path-suffix, case and tie-break rules. A bare<name>names no path, so the resolver leaves it alone.build.py: a new_is_std_angle_includecheck keeps the alias lookup (in bothbuild_from_jsonandfinalize_raw_graph_endpoints) away from an angle include of a C/C++ standard header. The header names live inC_STANDARD_INCLUDE_NAMESinextractors/resolution.py, next to_PYTHON_STDLIB_MODULE_NAMES. This is option 2 from the issue, the C/C++ version of the Import builder resolves bare to a same-stem local module (captures stdlib) #4261 guard.After the change:
Type of change
Verification & Invariants
Invariant: an angle include binds to a corpus header only when its written path matches that header, and a standard header name never binds to a project file by stem alone.
Three tests were added to
tests/test_c_include_resolution.py, and all three fail onv8without the fix:<liba/Bus.h>resolves to theBus.hfile node, both inextract()and afterbuild().<functional>stays an externalfunctionalstub when the corpus has exactly onefunctional.h, and<chrono>is unchanged.<config.h>is not path-resolved by the corpus resolver and carries theanglemetadata.The existing
test_angle_bracket_system_includes_not_bound_locally(<stdio.h>with two localstdio.h) still passes.Limitations:
<config.h>) behaves as before: it can still heal through the alias index when exactly one project file claims the stem. I left this alone because projects often include their own headers this way through-I.<boost/asio.hpp>,<sys/types.h>) still falls back to its bare stem like before. Only standard header names are guarded.#import <...>path inextractors/objc.pyis not changed.cache.py, to avoid conflicts with the schema note.How was this tested?