Skip to content

feat(engine): add zhang-shasha tree edit distance for small subtree recovery - #59

Merged
HarshK97 merged 1 commit into
mainfrom
feature/zs-recovery
Aug 6, 2026
Merged

feat(engine): add zhang-shasha tree edit distance for small subtree recovery#59
HarshK97 merged 1 commit into
mainfrom
feature/zs-recovery

Conversation

@HarshK97

@HarshK97 HarshK97 commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Problem

  1. Small unmapped subtrees inside matched container pairs relied solely on sibling LCS heuristics (SimpleRecovery), which missed optimal AST node pairings whenever node labels or child ordering shifted slightly.
  2. Without fine-grained tree edit distance, recovery on compact subtrees produced unnecessary delete/insert pairs instead of tracking exact node updates and moves.

What Changed

  • Implemented the Zhang-Shasha (1989) tree edit distance algorithm in internal/engine/zs.go to compute optimal node mappings on small subtrees.
  • Updated container recovery in internal/engine/recovery.go to route subtrees under 20 nodes to Zhang-Shasha recovery before falling back to SimpleRecovery.
  • Updated internal/engine/bottom-up.go to call Recover during bottom-up container matching and root unmapped child recovery.
  • Added Zhang & Shasha (1989) and Chawathe et al. (1996) citations to README.md under Acknowledgements.
  • Updated test fixture baseline reflecting sharper AST alignment.

@HarshK97
HarshK97 merged commit 1e560be into main Aug 6, 2026
13 checks passed
@HarshK97
HarshK97 deleted the feature/zs-recovery branch August 6, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant