pub fn compute_diff(
old: &GraphSnapshot,
new: &GraphSnapshot,
opts: &DiffOptions,
) -> DiffOutputExpand description
Entry point: computes the semantic diff between old and new.
The algorithm is the same one the pre-DB20 MCP GraphComparator used:
- Build two
qualified_name -> NodeSnapmaps, skipping nodes without qualified names (call sites, imports, etc.). - Walk the “new” map: nodes absent from “old” are added candidates;
nodes present on both sides are checked for signature / body changes
(producing
SignatureChangedorModified). - Walk the “old” map: nodes absent from “new” are removed candidates.
- Run heuristic rename detection between the remaining removed and
added sets (same kind, signature similarity >= 0.7, location scoring,
confidence threshold 0.9). Matched pairs emit
Renamedrecords and are removed from the added/removed pools. - Emit the remaining
AddedandRemovedrecords.
Output is pre-filter; callers apply their own include_unchanged /
change_types / symbol_kinds filters.