Skip to content

fix: Pytket barrier operations not being decoded#1069

Merged
aborgna-q merged 1 commit intomainfrom
ab/fix-barrier-decoder
Aug 25, 2025
Merged

fix: Pytket barrier operations not being decoded#1069
aborgna-q merged 1 commit intomainfrom
ab/fix-barrier-decoder

Conversation

@aborgna-q
Copy link
Collaborator

A dumb typo in the prelude decoder caused it to never get called for barrier operations, so they were always kept as opaque.

This PR fixes the decoder and adds checks to the tests to ensure we are not missing translations in the roundtrip tests.

@aborgna-q aborgna-q requested a review from lmondada August 25, 2025 09:13
@aborgna-q aborgna-q requested a review from a team as a code owner August 25, 2025 09:13
Comment on lines 114 to 116
fn op_types(&self) -> Vec<PytketOptype> {
vec![PytketOptype::noop, PytketOptype::Measure]
vec![PytketOptype::noop, PytketOptype::Barrier]
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bugfix. op_types declares which operations the decoder should be called for, so we were never translating the barriers.

@codecov
Copy link

codecov bot commented Aug 25, 2025

Codecov Report

❌ Patch coverage is 55.55556% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.03%. Comparing base (29f9af4) to head (360e06d).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tket-qsystem/src/pytket/tests.rs 53.84% 6 Missing ⚠️
tket/src/serialize/pytket/tests.rs 53.84% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1069      +/-   ##
==========================================
+ Coverage   78.98%   79.03%   +0.04%     
==========================================
  Files         115      115              
  Lines       13389    13415      +26     
  Branches    12607    12633      +26     
==========================================
+ Hits        10575    10602      +27     
+ Misses       2160     2156       -4     
- Partials      654      657       +3     
Flag Coverage Δ
python 92.83% <ø> (ø)
rust 78.17% <55.55%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@aborgna-q aborgna-q added this pull request to the merge queue Aug 25, 2025
Merged via the queue into main with commit 63af8f5 Aug 25, 2025
19 of 20 checks passed
@aborgna-q aborgna-q deleted the ab/fix-barrier-decoder branch August 25, 2025 09:21
@hugrbot hugrbot mentioned this pull request Aug 25, 2025
github-merge-queue bot pushed a commit that referenced this pull request Aug 25, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.12.4](tket-py-v0.12.3...tket-py-v0.12.4)
(2025-08-25)


### Bug Fixes

* Pytket barrier operations not being decoded
([#1069](#1069))
([4b90ffd](4b90ffd))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

---------

Co-authored-by: Agustín Borgna <agustin.borgna@quantinuum.com>
@hugrbot hugrbot mentioned this pull request Sep 15, 2025
github-merge-queue bot pushed a commit that referenced this pull request Sep 15, 2025
## 🤖 New release

* `tket`: 0.14.0 -> 0.15.0 (✓ API compatible changes)
* `tket-qsystem`: 0.20.1 -> 0.21.0 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `tket`

<blockquote>

##
[0.15.0](tket-v0.14.0...tket-v0.15.0)
- 2025-09-15

### Bug Fixes

- [**breaking**] Fix rotation -> float param type conversion
([#1061](#1061))
- Pytket barrier operations not being decoded
([#1069](#1069))
- Always load parameter expressions as half turns in the decoder
([#1083](#1083))
- Move attribute to come after all the cases.
([#1112](#1112))

### New Features

- Capture pytket's output permutation explicitly in the hugr
connectivity ([#1075](#1075))
- Add ResourceScope ([#1052](#1052))
- [**breaking**] Remove unnecessary Arc from PytketDecoder method
([#1114](#1114))
- [**breaking**] Remove deprecated definitions
([#1113](#1113))
</blockquote>

## `tket-qsystem`

<blockquote>

##
[0.21.0](tket-qsystem-v0.20.1...tket-qsystem-v0.21.0)
- 2025-09-15

### Bug Fixes

- [**breaking**] Fix rotation -> float param type conversion
([#1061](#1061))
- Pytket barrier operations not being decoded
([#1069](#1069))
- *(qystem)* fix angle bug in CZ decomposition
([#1080](#1080))
- Always load parameter expressions as half turns in the decoder
([#1083](#1083))

### New Features

- Add a `borrow_array` type replacement pass
([#975](#975))
- Add gpu module ([#1090](#1090))
- [**breaking**] Remove unnecessary Arc from PytketDecoder method
([#1114](#1114))
- [**breaking**] Remove deprecated definitions
([#1113](#1113))

### Refactor

- [**breaking**] Factor out wasm extension code into compute module
([#1089](#1089))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

---------

Co-authored-by: Agustín Borgna <121866228+aborgna-q@users.noreply.github.com>
Co-authored-by: Alec Edgington <54802828+cqc-alec@users.noreply.github.com>
@hugrbot hugrbot mentioned this pull request Sep 16, 2025
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.

2 participants