Repository navigation
Conversation
Every Swift file that imports a module (`import Foundation`) mints the same module node id by design, and the extractors already exempt module/namespace nodes from collision disambiguation. deduplicate_entities still reported each such group as a lost-node ID collision, printing a spurious WARNING for every extra importing file. That noise trains users to ignore the real data-loss warning. _report_id_collision now stays silent only when every member of the group is a module (or namespace) node of the same type under the same label. A module colliding with a namespace, with any other type, or with a differently named module still warns. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for the pull request, @idachev. 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 1 changed function(s) (1 sampled, not proven).
Formal verification. PR-changed functions: 1/1 verified (0 proven, 1 may-equivalent, 0 distinguished) · 0 not verified.
Graphify review — findings
Silences the "minted by two different files" ID-collision warning in deduplicate_entities for shared module/namespace nodes, such as the Foundation node every Swift file importing it creates. This matches how the extractors already exempt those types from collision disambiguation. The exemption applies only when the whole colliding group has the same type (module or namespace) and the same label. A module colliding with a namespace, a module colliding with a non-module node, or two differently named modules still warns. New Swift import tests cover the no-warning case plus the three still-warns controls.
No blocking issues surfaced. 1 lower-confidence candidate did not survive cross-model review.
Analysis details — impact, health, verification
Impact & health
Graphify review
Impact — 604 functions depend on the 93 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
deduplicate_entities()— 107 callers, 30 callees
Verification — 604 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: 304 function(s) in the blast radius were not formally verified this run
Test selection
Test selection
28 of 453 test file(s) selected (6%) via static blast radius.
tests/test_build.py— impacttests/test_build_located_semantic_identity.py— impacttests/test_build_merge_dedup_scope.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_chunking.py— impacttests/test_corrupt_graph_json.py— impacttests/test_cross_extension_reexport_self_cycle.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_ext_tagged_id_clash.py— impacttests/test_global_graph.py— impacttests/test_go_qualified_resolution.py— impacttests/test_issue_3472_source_file_collision.py— impacttests/test_js_member_collisions.py— impacttests/test_merge_sweeps_reextract_orphans.py— impacttests/test_no_dedup_flag.py— impacttests/test_non_string_node_ids.py— impacttests/test_prune_sweeps_orphans.py— impacttests/test_python_underscore_resolution.py— impacttests/test_r_extractor.py— impacttests/test_semantic_origin_stamp.py— impacttests/test_swift_import_resolution.py— impact, changed-testtests/test_unverified_semantic_shrink.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
No difference found (not proven): No behavior difference found in \_report\_id\_collision (not a proof).
The verifier ran both versions of \_report\_id\_collision 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).
bercedev
left a comment
There was a problem hiding this comment.
Tests check out: the shared-module test fails on v8, all 7 pass here. The ("module", "namespace") set matches the exemption in extractors/resolution.py (node.get("type") in ("module", "namespace")), and the module-vs-namespace and two-different-labels cases still warn, so the real data-loss warning is intact. LGTM.
|
Landed in v0.9.96, now on PyPI (pip install graphifyy==0.9.96). No id-collision warning for shared module nodes. Thanks for the fix, @idachev. |
What does this PR do?
Every Swift file that imports a module (
import Foundation) mints the same module node id by design, and the extractors already exempt module and namespace nodes from collision disambiguation.deduplicate_entitiesstill reported each such group as a lost-node ID collision, so a build printed one spuriousWARNING: node '...' is minted by two different filesfor every extra importing file. That noise teaches users to ignore the real data-loss warning._report_id_collisionnow stays silent only when every node in the group is amodule(ornamespace) node of the same type under the same label. A module colliding with a namespace, with any other node type, or with a differently named module still warns.Refs #4754
Found during the work on #4754 (it is Phase 5 of the RFC in that Swift PR), but independent of it: this PR does not depend on the Swift PR, and the Swift PR does not depend on this one.
Type of change
Verification & Invariants
Invariant: the collision warning fires exactly when dropping a node loses an entity. A shared module node is one entity, so dropping a duplicate of it loses nothing; any other collision is still reported. Only a warning changes: no node, edge, cache or persisted state is affected.
How was this tested?
Tests in
tests/test_swift_import_resolution.py:test_shared_module_import_prints_no_collision_warning(two Swift files importingFoundation; fails on v8), and the controlstest_mixed_module_collision_still_warns,test_module_namespace_collision_still_warnsandtest_differently_named_modules_collision_still_warns.Limitation: the exemption is by node type and label only. Two different modules that happen to share a label and an id are treated as one entity, the same way the extractors already treat them.
Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. Not applicable: no skillgen fragments changed.🤖 Generated with Claude Code