Skip to content

Fix main red: clippy, stale QEC snapshots, GHZ lattice-surgery reset bug - #313

Merged
arniber21 merged 1 commit into
mainfrom
07-20-fix_main_red_clippy_unused_imports_stale_qec_snapshots_untrack_insta_scratch_files
Jul 20, 2026
Merged

Fix main red: clippy, stale QEC snapshots, GHZ lattice-surgery reset bug#313
arniber21 merged 1 commit into
mainfrom
07-20-fix_main_red_clippy_unused_imports_stale_qec_snapshots_untrack_insta_scratch_files

Conversation

@arniber21

@arniber21 arniber21 commented Jul 20, 2026

Copy link
Copy Markdown
Owner

What's in this PR

cargo test --workspace (and clippy) were red on main. Three independent issues:

  1. Clippy: 7 unused-import errors in quon_na/src/movement/{duals,emit,geometry,plan}.rs, left over from the NA: Carve movement / zoned / compaction monoliths by interface #215 movement-monolith carve-up.

  2. Stale QEC report snapshots: the accepted .snap goldens for qec_repetition_d3_hybrid/qec_surface_d3_hybrid predated QEC: implement magic-state-consuming logical T and CCZ operations #283/QEC: magic-state-consuming logical T and CCZ operations (#283) #288's new resource-report fields (t_count, tdag_count, ccz_count, magic_state_demand) and never got re-accepted, so cargo test -p quon_na failed. Also found two .snap.new insta scratch files tracked in git by mistake (from that same PR) — insta pending-snapshot files are meant for local review via cargo insta review, never committed. Untracked them and added *.snap.new to .gitignore.

  3. Real correctness bug: quonc/tests/samples_catalog.rs::ci_smoke_entries_typecheck_with_quonc failed on the new GHZ benchmark sample (samples/neutral-atom/benchmarks/surface_d3_ghz.qn, from Samples: reconfigurable neutral-atom QEC benchmark suite #284/Samples: reconfigurable neutral-atom QEC benchmark suite (#284) #292) with quantum.na verification failed: cycle 425: atom 36 is reused ... after measure at cycle 346 without an intervening reset.

    Root cause: quon_qec/src/patch_ops.rs's MeasureAncilla handling (the live logical-CX lattice-surgery lowering) measures only the ancilla patch's top-row atoms when a logical CX finishes, but never resets any of the ancilla's atoms — unlike the seam-atom measure+reset pairing rough_merge_round/smooth_merge_round/split_seam_round already do correctly. Chaining two logical CX ops (as the GHZ sample does: logical_cx(a,b) then logical_cx(b,c)) leaves the first ancilla's atoms parked, un-reset, in the trap grid; the verifier correctly catches it the first time the second CX's movement/geometry planning has to move one of those atoms out of the way.

    Fixed by resetting the ancilla's full atom footprint (all data + check atoms, not just the measured top row — by the Horsman gadget's design the ancilla is fully disentangled from control/target by this point, so this is physically sound) right after the logical-Z measurement. Applied the identical fix to the lattice_surgery.rs reference-only path for consistency. Updated the two tests whose terminal-length assertions assumed measure-only (quon_qec/src/expand.rs, quon_qec/tests/patch_ops.rs).

Verification

All run locally, not just asserted:

  • cargo fmt --check — clean
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo test --workspace — 0 failures (confirmed 3x, including a full rebuild)
  • .venv/bin/python -m pytest python -q — 78 passed, 1 skipped
  • pnpm --dir website build — clean
  • Reproduced the original GHZ failure with the pre-fix binary, then confirmed the post-fix binary compiles the same sample cleanly (quantum.na verification passed).

🤖 Generated with Claude Code

Chained logical CX ops (e.g. GHZ-style a-b-c programs) left the first
ancilla's atoms measured-but-never-reset, tripping the quantum.na
dialect verifier the first time a later op's movement/geometry pass
had to touch one of them. Fix in both the live patch_ops.rs path and
the lattice_surgery.rs reference path; update the two tests whose
terminal-length assertions assumed measure-only.
@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quon Ready Ready Preview, Comment Jul 20, 2026 8:25pm

Copy link
Copy Markdown
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arniber21 arniber21 changed the title QEC: reset ancilla footprint after logical-CX MeasureAncilla Fix main red: clippy, stale QEC snapshots, GHZ lattice-surgery reset bug Jul 20, 2026
@arniber21
arniber21 marked this pull request as ready for review July 20, 2026 20:25
@arniber21
arniber21 merged commit 30d505e into main Jul 20, 2026
18 checks passed
@arniber21
arniber21 deleted the 07-20-fix_main_red_clippy_unused_imports_stale_qec_snapshots_untrack_insta_scratch_files branch August 5, 2026 06:11
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