arch-diff
Structural diff for Go backends — how the call-flow changes across two git refs, and what a change orphaned or revived.
A git diff shows which lines changed. It does not show whether the
structure changed. The most review-critical regressions in a layered backend
are structural and invisible in a text diff:
- A handler that used to call a repo through a service now calls it directly.
- A domain package gains a dependency on infra.
- A refactor removes the last caller of a function, leaving it dead — fully tested, compiling, and looking alive in the diff.
arch-diff runs the archview engine on two git refs, runs a reachability pass on each, and diffs both the graph and the reachable-set. The result is a PR comment that shows architectural impact and dead code in seconds.
Report-only
arch-diff never fails your build. It reports; it does not gate. Policy enforcement is a separate concern.
What it surfaces
In priority order:
- Newly dead — reachable in base, dead in head. Your PR orphaned it. The headline.
- New layer-crossing edge — e.g.
OrderHandler.Create → InventoryRepo.Decrement, with the path it replaced. - Removed layer-crossing edge — e.g. a service hop that disappeared.
- Revived — dead in base, reachable in head.
- Changed — body hash differs.
- New / removed nodes.
How it works
git worktree addfor each ref into an isolated temp dir.- Load each worktree with the archview call-graph engine (raw, unpruned).
- Resolve roots (routes,
main, optionally exported API) from config. - Run reachability from roots, marking every node reachable or dead.
- Set-diff the two graphs, and separately diff the two reachable-sets.
- Render markdown plus a mermaid subgraph of the changed region.
Graphs are deterministic per commit SHA, so each is cached by SHA; the base branch is computed once and reused.
Node identity
Diff quality depends entirely on stable, location-independent node IDs. An ID is the package path + receiver + method — never file or line. Inserting a blank line above a function changes no ID, so only genuine structural change is visible.
github.com/x/eularix/internal/order/handler.(*OrderHandler).CreateStatus
arch-diff is in active development (the archview engine and stable IDs are done; reachability, dead-code deltas, and the GitHub Action are landing). See the roadmap.