feat(diff): compare call-graph edges in snapshot diff (closes #297) - #298
Merged
Conversation
Snapshots stored 25,876 edges on disk but _diff_backend() only ever compared nodes, so any structural change that neither added nor removed a function was invisible. Edge identity is (file, impl_for, fn) per endpoint, not the raw node id. Node ids embed a line number, so id-keyed edges reported every edge of a function that merely shifted lines as removed and re-added: on the real 425-file polyglot workspace a whole-codebase line shift produced 3,178 false reports from zero real changes. Keying through the node map drops that to 0 while still detecting genuine edge additions. Resolved edges only. 82% of real edges are unresolved stdlib calls (append, strip, get) and would drown the signal, so they are tallied rather than enumerated. Pairs form a set: one edge is recorded per call site, and call-site count is not graph shape. via_self is a qualifier and stays out of identity. Detail lists are capped at 100 with a truncated flag; counts stay exact. Legacy node fields are untouched — commands/diff.py, dashboard, formatters and MCP read them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
In an edge diff `from`/`to` already mean an edge's endpoints, so reusing them for the old/new snapshot sides of the unresolved tally reads as a bug at a glance. No consumers yet — renaming now is free. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
This was referenced Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Closes #297.
Masalah
Snapshot menyimpan 25.876 edge ke disk, tapi
_diff_backend()hanya membandingkannodes— kataedgestidak muncul sekali pun di fungsi itu. Perubahan struktural yang tidak menambah/menghapus fungsi tak terlihat sepenuhnya.Yang berubah
_diff_backend()sekarang mengembalikanadded_edges,removed_edges,added_edge_count,removed_edge_count,unresolved_edges;summarydidiff_snapshots()+diff_current_vs_last()dapatedges_added/edges_removed.Keputusan desain — spec asli issue SALAH, dikoreksi di sini
Issue menulis identitas edge =
(from, to). Itu node id yang memuat nomor baris, jadi fungsi yang cuma bergeser baris melaporkan semua edge-nya hilang+muncul. Terbukti pada registry nyata 12.982 edge:(from,to)id mentah (spec asli)(file, impl_for, fn)(PR ini)Pemilihan kunci diukur atas 2.429 node:
(file,fn)→ 38 tabrakan;(file, impl_for, fn)→ 9 (0,37%), dan ke-9 nya sudah ditandaiduplicate_define: trueoleh CodeLens sendiri (closurevisit/_walkyang memang didefinisikan berulang). Detail + bukti di komentar issue.Lainnya: resolved-only (82% edge nyata = call stdlib
append/strip/get, dihitung bukan dienumerasi — 10.512 unresolved saya cocok persis dengantype_resolution.edges_unresolvedyang dilaporkan scanner sendiri); set bukan multiset;via_selfkualifier; detail cap 100 +truncated, count eksak.Verifikasi (dijalankan, bukan diklaim)
tests/test_diff_engine_edges.py) —diff_engine.pysebelumnya nol coverage. Test geral-baris terbukti gagal kalau fix dicabut (dicek langsung).smart-tax-assistance/app, 425 file, 191 Rust / 101 TSX / 127 C++): geser baris 3.878 dari 4.188 id → 0/0. Hapus 3 edge nyata → tepat 3 terdeteksi dengan nama + file benar.impact --check diff→summarymemuatedges_added: 0, edges_removed: 2.main, daftar identik — nol regresi. Ke-19 pre-existing (audit(ci): triage 13 test failures unmasked by segfault fix (#266) #271 Group B pagination + Windows-env).Found, not fixed (Tier 2)
diff_engine.pytidak punya test sama sekali sebelum PR ini;_diff_frontend()masih nol coverage.Command count tetap 12. Tidak ada engine/command baru →
skip-design-doc.🤖 Generated with Claude Code