Skip to content

fix(pasqal-connector): accept the calibrated triangle and keep its register layout - #2179

Open
jacktrnr wants to merge 1 commit into
mainfrom
fix/1854-pasqal-min-distance
Open

jacktrnr wants to merge 1 commit into
mainfrom
fix/1854-pasqal-min-distance

Conversation

@jacktrnr

Copy link
Copy Markdown
Contributor

Closes #1854

What

Two defects in packages/extension/scripts/pasqal-connector/pulse_contract.py:

  1. Min-distance check had no tolerance. The strict dist < min_atom_distance comparison rejected AnalogDevice's own calibrated TriangularLatticeLayout triangle: the layout stores trap coordinates rounded to COORD_PRECISION decimals, so adjacent spacing is 4.9999999836 µm vs. the 5 µm minimum. The check now allows DISTANCE_TOL = 10**-COORD_PRECISION µm. That is Pulser's own coordinate-precision tolerance, the same one BaseDevice._validate_atom_distance uses. The physical bound is unchanged, and a 4.9 µm pair is still rejected with the existing error.
  2. The register layout was dropped. Every register was rebuilt with Register.from_coordinates, so layout was lost, and AnalogDevice (requires_layout) needs it for QPU submission. The new build_register function defines the register from the device's calibrated layout when every atom sits on a distinct trap. Matching uses Pulser's get_traps_from_coordinates, at Pulser's precision. Qubit ids keep the q<i> names. Off-lattice registers build exactly as before, with no layout.

No schema change: pulse.toml atoms keeps its meaning.

Tests (RED first, then GREEN)

New TestCalibratedLayoutRegister in tests/test_pulse_contract.py. It reads the triangle (traps 0, 1, 4) off pulser.AnalogDevice.calibrated_register_layouts and never hardcodes it:

  • the premise holds: the rounded spacing is below min_atom_distance
  • the calibrated triangle passes the contract (was a ContractError)
  • the built sequence's register has layout set, equal to the calibrated layout, and register_is_from_calibrated_layout is True
  • the layout survives to_abstract_repr / from_abstract_repr, the serialization used for cloud submission
  • qubit ids stay q0..q2; an on-lattice pair gets the layout; an off-lattice pair builds with no layout
  • a genuinely too-close pair (4.9 µm) is still rejected

The tests make no network calls, need no credentials, and submit nothing.

Local run with the pinned requirements.txt (pulser 1.8.0):
python3 -m unittest discover -s tests → 80 tests OK (72 before + 8 new). node packages/extension/scripts/assert_provisioned_python.mjs → all PASS.

Note: CI (.github/workflows/ci.yml) does not currently run the connector's Python unittest suite. It runs only the provisioning gate. The suite was run locally.

🤖 Generated with Claude Code

…yout

The contract's min-atom-distance check compared strictly against the
device's min_atom_distance, so it rejected AnalogDevice's own calibrated
TriangularLatticeLayout triangle (rounded trap coordinates give
4.9999999836 um vs 5 um). It now allows Pulser's own coordinate-precision
slack (10^-COORD_PRECISION um), the same tolerance Pulser's register
validation uses. The physical bound is unchanged; 4.9 um is still rejected.

The contract also rebuilt every register from bare coordinates, dropping
the layout that AnalogDevice requires for QPU submission. Registers whose
atoms all sit on traps of a calibrated layout are now defined from that
layout, so the built sequence carries it (and it survives the abstract-repr
round trip used for submission). Off-lattice registers build as before.

Closes #1854

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 7e21f868-2119-4442-bc67-87a30f119aef
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@jacktrnr
jacktrnr marked this pull request as ready for review November 23, 2026 22:17
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.

fix(pasqal-connector): contract min-distance check rejects the device's calibrated triangle (no tolerance) and drops the register layout

1 participant