Repository navigation
fix(tree): support src and file aliases to prevent empty tree viewer - #5030
Adityakk9031 wants to merge 1 commit into
Conversation
|
Thanks for the pull request, @Adityakk9031. 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.
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; formal verification proved 0 of 2 changed function(s) (2 sampled, not proven).
Formal verification. PR-changed functions: 2/2 verified (0 proven, 2 may-equivalent, 0 distinguished) · 0 not verified.
Graphify review — findings
Adds src to the file-path aliases that _fold_node_aliases folds into source_file, so nodes carrying src keep their file association when a graph is built. Teaches build_tree to resolve a path from src, file, path or filepath when source_file is missing, so alias-only graphs render a populated tree instead of "(empty graph)". It runs its own alias loop with src checked first, while the build-time fold checks src last. New tests cover src folding and alias-only tree rendering.
No blocking issues surfaced. 4 lower-confidence candidates did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 2160 functions depend on the 211 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
build_tree()— 22 callers, 5 callees
Verification — 2160 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: 1502 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
150 of 526 test file(s) selected (29%) via static blast radius.
tests/test_4874_jvm_resolution.py— impacttests/test_4978_reconcile_cost.py— impacttests/test_affected_cli.py— impacttests/test_affected_path_file_node.py— impacttests/test_affected_seed_reference_forms.py— impacttests/test_alias_folding.py— impact, changed-testtests/test_analyze.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_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_c_include_resolution.py— impacttests/test_carried_hyperedge_remap.py— impacttests/test_charmap_encoding.py— impacttests/test_chunking.py— impacttests/test_claude_cli_backend.py— impacttests/test_cli_export.py— impacttests/test_cluster.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_objc_cross_file_calls.py— impacttests/test_cross_extension_reexport_self_cycle.py— impacttests/test_cross_repo_external_call_guards.py— impacttests/test_csharp_method_owner_labels.py— impacttests/test_csharp_object_creation.py— impacttests/test_dedup.py— impacttests/test_dedup_remaps_hyperedges.py— impacttests/test_dedup_shrink_refuses_force_write.py— impacttests/test_dedup_survivor_richness.py— impacttests/test_definition_file_portability.py— impacttests/test_duplicate_annotation_edges.py— impacttests/test_edge_also_seen.py— impacttests/test_evidence_binding.py— impacttests/test_export.py— impacttests/test_export_control_characters.py— impacttests/test_export_direction.py— impacttests/test_export_idempotent_writes.py— impacttests/test_export_path_length.py— impacttests/test_ext_tagged_id_clash.py— impact- … and 100 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
No difference found (not proven): No behavior difference found in \_fold\_node\_aliases (not a proof).
The verifier ran both versions of \_fold\_node\_aliases 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.
No difference found (not proven): No behavior difference found in build\_tree (not a proof).
The verifier ran both versions of build\_tree 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.
· 1 more finding(s) on lines outside this diff (see the check run).
…llow-up) tree_html.build_tree folded aliases in a different order (src first) than build._fold_node_aliases (src last), so a node carrying two conflicting file aliases could key on different paths in the viewer vs the built graph. Use the same order and pop the consumed alias, as the build-side fold does. Co-Authored-By: Claude Opus 4.8 <[email protected]>
|
Landed on |
Summary
In
graphify/build.py,_fold_node_aliasesnormalized("file", "path", "filepath")ontosource_file, but did not include"src". In addition,graphify.tree_html.build_treefiltered strictly onn.get("source_file")without normalizing alias fields, causing graphs whose nodes carrysrcor other file aliases to discard all nodes and return(empty graph).Changes
graphify/build.py(_fold_node_aliases): added"src"to the alias list so thatbuild_from_jsonfoldssrcontosource_file.graphify/tree_html.py(build_tree): normalize node aliases (src,file,path,filepath) ontosource_filebefore filteringfile_nodes.tests/test_alias_folding.py: addedtest_node_src_folds_to_source_file.tests/test_tree_html.py: addedtest_build_tree_accepts_src_and_file_aliases.Test Plan
pytest tests/test_alias_folding.py tests/test_tree_html.py-> 47 passed.