Gate-level circuit diff: qubit-lane LCS alignment per step
TheYuchen
94e47b0
Backend:
- New services/circuit_diff.py: lane_sequences() tokenizes each
qubit's gate sequence (name + 3dp param fingerprint; unbound
params keep symbol names; 2q gates on both lanes with c/t role
tags, symmetric ops undecorated; measures kept, barriers skipped)
and diff_lanes() aligns before/after lanes with a standard LCS
diff (kept/removed/added in merged order). Hard cap 12 qubits /
600 combined ops -> truncated marker.
- Executor: copy the circuit BEFORE dispatch (handlers may mutate
ctx["circuit"] in place -- the historical QuBound measure_all bug
shape), stamp gate_diff into StepResult.transformation when the
step changed the circuit. Best-effort: any diff failure is logged
and omitted, never breaks a run.
- tests/test_gate_diff.py: 14 torch-free unit tests incl. an
executor wiring test that mutates in place.
Frontend:
- New CircuitDiff.tsx inside SignatureCard, collapsed <details>
("Gate-level diff / N removed / M added"): one mono-labelled row
per qu…