AlignDiff Open AlignDiff

Concept and worked evidence

Semantic code diff that keeps related code together

A semantic code diff uses program structure to reduce misleading delete-and-insert noise. AlignDiff pairs related functions, classes, methods, and other supported structures before showing detailed line changes.

AlignDiff marketing preview showing structure-aware code comparison
AlignDiff public beta · Python, JavaScript, and TypeScript · source stays in the browser

Definition

What “semantic diff” means here

AlignDiff is structure-aware rather than a proof of behavioural equivalence. It parses supported source files, identifies named structures, proposes pairs, and then calculates the detailed text changes inside each pair.

That distinction matters: a structural match can show that two functions are likely counterparts after a move or rename, but it cannot prove that the refactor preserves runtime behaviour.

Line diff versus structure-aware diff

Movement and editing are different review questions

Source-order line diff

Compares rows in their current position. A moved function can appear as one large deletion followed by one large insertion.

Structure-aware comparison

Pairs likely counterparts first. Movement remains visible, while edits inside the moved function can be reviewed in the same horizontal lane.

Actual AlignDiff result pairing a moved and modified Python function, a renamed helper, and inserted code
Actual AlignDiff output from the checkout refactor example. The image is product output, not a hand-built approximation.

When it is useful

Use structural comparison when source order is hiding the real edit

Moved functions

Separate relocation from changes made inside the function.

Renamed structures

Inspect a likely rename without losing the corresponding body.

Large refactors

Reduce navigation cost when many blocks move in the same pull request.

Current boundaries

Useful evidence, not an automatic approval

  • The browser beta currently supports Python, JavaScript, and .ts TypeScript.
  • TSX, JSX, saved comparisons, accounts, and share links are not currently supported.
  • Malformed or unsupported syntax can fall back to a bounded text comparison.
  • Possible or incorrect pairings still require human review and can be adjusted manually.