Repository navigation
fix(5207): merge ADR/RFC/REQ reference-id concepts across files - #5348
Deepjyoti-Sarmah wants to merge 2 commits into
Conversation
ADR-0007 cited from several files stayed one node per file: its label fell under the entropy gate, and 'ADR 7' / 'ADR-0007' normalized to different keys. Concept nodes whose whole label is a known reference id now share a key that ignores spelling and zero padding, and skip the entropy gate. document and rationale nodes keep the cross-file block.
|
Thanks for the pull request, @Deepjyoti-Sarmah. 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.11 and 3.13, and that the change keeps extraction deterministic. |
There was a problem hiding this comment.
Graphify code review 
Reviewed · 852a6aa8dcd7
Only static checks ran on this change. They found no blocking issues.
Code graph and static checks · 1025 functions depend on this change
Impact & health
Impact — 1025 functions depend on the 102 functions this change touches.
Health — this change adds coupling hotspots:
- worse:
deduplicate_entities()— 128 callers, 34 callees
Formal checks — 1025 functions this change can affect weren't formally checked in this review. Formal checks are informational only.
Gate & verification
✅ PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.
Advisory (not blocking):
- verification_scope: 471 function(s) in the blast radius were not formally verified this run
Test selection
41 of 594 test file(s) selected (7%) 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_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_chunking.py— impacttests/test_corrupt_graph_json.py— impacttests/test_cpp_forward_declarations.py— impacttests/test_cross_extension_reexport_self_cycle.py— impacttests/test_dedup.py— impacttests/test_dedup_prefix_derived_words.py— impacttests/test_dedup_reference_ids.py— impact, changed-testtests/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_failed_ast_replacement.py— impacttests/test_file_id_collision_4854.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_linked_worktree_reconcile.py— impacttests/test_merge_sweeps_reextract_orphans.py— impacttests/test_no_dedup_flag.py— impacttests/test_non_string_node_ids.py— impacttests/test_prune_source_aliases.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_shrink_guard_dedup_merge_4940.py— impacttests/test_shrink_guard_replaced_sources.py— impacttests/test_swift_import_resolution.py— impacttests/test_symlinked_root_source_file.py— impacttests/test_unverified_semantic_shrink.py— impacttests/test_validate.py— impacttests/test_watch.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.
Every flagged function
deduplicate_entities()ingraphify/dedup.py:1150· 128 callers, 34 callees: fans out to 34 callees (efferent coupling); 128 callers depend on it (afferent coupling)
What does this PR do?
Fixes #5207 for reference ids.
ADR-0007cited from several files now ends up as one concept node, not one per file.Each file's mention gets its own path-prefixed id, as the extraction spec requires.
deduplicate_entitiesshould then merge them by label, and two things stopped it:concept)ADR-0007×3ADR 7/ADR-0007/ADR-007adr 7andadr 0007, so pass 1 never groups themRFC-12,REQ-42,packages/auth×3Lowering the gate to 2.0 merges the first row, which confirms the gate is the cause. Across 1–999 the gate rejects
ADR-1…ADR-9andADR-0001…ADR-0011(36 padded labels), the first and most-cited records.The change, in pass 1:
The key ignores separator, case and zero padding. The prefix list is fixed, so other short labels keep the gate.
Options I tried
adr_0007. Depends on model output, can't be pinned in CI, and would reachdocumentnodes, which 0.9.108 blocks on purpose.Type of change
Verification & Invariants
Invariant:
conceptnodes whose whole label names the same ADR/RFC/REQ number merge into one node across files, whatever the spelling; nothing else merges that did not before.Merge Danger
Door: two-way. One helper and two lines in
graphify/dedup.py. No id, spec, schema or cache change; reverting the commit restores 0.9.112.Blast Radius: small. Only
conceptnodes labelled exactlyADR|RFC|REQ <number>merge where they did not.documentandrationalekeep the cross-file block (#3094, 0.9.108), and the incrementalprotected_idsrules are unchanged.Limitations
document/rationalementions of an ADR stay one per file, by design.@acme/authvspackages/auth) still split; that needs a workspace map.PROJ-123) are not covered.How was this tested?
tests/test_dedup_reference_ids.py(12):On 0.9.112
340268a7: 7 fail, 5 pass (the guards). On this branch: 12 pass.Full suite, same venv:
The 76 are the same tests on both trees: subprocess
python -m graphifytests run the shared venv's editable install, which points at another checkout.deduplicate_entitieson 30,000 synthetic concept nodes, 3 runs each: 11.4–12.1 s before, 11.6–11.7 s after. Output 23,113 → 22,675 nodes; the 438 are ADR mentions that now merge.Graphify-specific checklist
uv run python -m tools.skillgen --bless) when changing their source fragments. (N/A: no skill change.)