Skip to content

Conversation

@aborgna-q
Copy link
Collaborator

Fixes #1297
Depends on #1295

We now store the subgraph input parameters in the payload, since pytket may remove values from the params field of a barrier command.

BREAKING CHANGE: Added input_parameter fields to OpaqueSubgraphPayload

@aborgna-q aborgna-q requested a review from a team as a code owner December 5, 2025 14:35
@aborgna-q aborgna-q requested review from doug-q and removed request for a team December 5, 2025 14:35
@codecov
Copy link

codecov bot commented Dec 5, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.60%. Comparing base (0db6426) to head (6bae53b).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1298      +/-   ##
==========================================
+ Coverage   79.57%   79.60%   +0.02%     
==========================================
  Files         160      160              
  Lines       20578    20601      +23     
  Branches    19612    19635      +23     
==========================================
+ Hits        16375    16399      +24     
+ Misses       3222     3221       -1     
  Partials      981      981              
Flag Coverage Δ
python 92.92% <ø> (ø)
qis-compiler 100.00% <ø> (ø)
rust 78.93% <100.00%> (+0.02%) ⬆️

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.

Base automatically changed from ab/fix-unconnected-subgraphs to main December 8, 2025 14:32
@aborgna-q aborgna-q force-pushed the ab/pytket-barrier-params branch from 78235ac to 062517f Compare December 8, 2025 14:47
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Here is the main change, the payloads now include the input_params, and we read that field when decoding.

Copy link
Contributor

@doug-q doug-q left a comment

Choose a reason for hiding this comment

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

Great!

#[case::false_branch("false_branch", Some(vec![
("TKET1.tk1op", 1), ("tket.quantum.H", 1), ("tket.quantum.QAlloc", 1), ("tket.quantum.MeasureFree", 1)
]))]
#[should_panic = "xfail"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this new test case related to the rest of the patch? I don't see how.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, the test wasn't actually generating parametric barriers.

I added a qubit parameter to func2 in the guppy program, so now the call gets encoded as a barrier on a qubit with a rotation parameter.

@hugrbot
Copy link
Collaborator

hugrbot commented Dec 9, 2025

This PR contains breaking changes to the public Rust API.
Please deprecate the old API instead (if possible), or mark the PR with a ! to indicate a breaking change.

cargo-semver-checks summary
    Building tket v0.16.0 (current)
     Built [  43.071s] (current)
   Parsing tket v0.16.0 (current)
    Parsed [   0.098s] (current)
  Building tket v0.16.0 (baseline)
     Built [  41.231s] (baseline)
   Parsing tket v0.16.0 (baseline)
    Parsed [   0.095s] (baseline)
  Checking tket v0.16.0 -> v0.16.0 (assume minor change)
   Checked [   0.080s] 159 checks: 156 pass, 3 fail, 0 warn, 41 skip

--- failure enum_struct_variant_field_added: pub enum struct variant field added ---

Description:
An enum's exhaustive struct variant has a new field, which has to be included when constructing or matching on this variant.
      ref: https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.45.0/src/lints/enum_struct_variant_field_added.ron

Failed in:
field input_params of variant OpaqueSubgraphPayload::External in /home/runner/work/tket2/tket2/PR_BRANCH/tket/src/serialize/pytket/opaque/payload.rs:92
field input_params of variant OpaqueSubgraphPayload::Inline in /home/runner/work/tket2/tket2/PR_BRANCH/tket/src/serialize/pytket/opaque/payload.rs:120

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.45.0/src/lints/inherent_method_missing.ron

Failed in:
OpaqueSubgraphPayload::parse_external_id, previously in file /home/runner/work/tket2/tket2/BASELINE_BRANCH/tket/src/serialize/pytket/opaque/payload.rs:225

--- failure method_parameter_count_changed: pub method parameter count changed ---

Description:
A publicly-visible method now takes a different number of parameters.
      ref: https://doc.rust-lang.org/cargo/reference/semver.html#fn-change-arity
     impl: https://github.com/obi1kenobi/cargo-semver-checks/tree/v0.45.0/src/lints/method_parameter_count_changed.ron

Failed in:
tket::serialize::pytket::opaque::OpaqueSubgraphPayload::new_external now takes 2 parameters instead of 1, in /home/runner/work/tket2/tket2/PR_BRANCH/tket/src/serialize/pytket/opaque/payload.rs:127
tket::serialize::pytket::opaque::OpaqueSubgraphPayload::new_inline now takes 3 parameters instead of 2, in /home/runner/work/tket2/tket2/PR_BRANCH/tket/src/serialize/pytket/opaque/payload.rs:149

   Summary semver requires new major version: 3 major and 0 minor checks failed
  Finished [  86.628s] tket
  Building tket-qsystem v0.22.0 (current)
     Built [  43.260s] (current)
   Parsing tket-qsystem v0.22.0 (current)
    Parsed [   0.029s] (current)
  Building tket-qsystem v0.22.0 (baseline)
     Built [  43.642s] (baseline)
   Parsing tket-qsystem v0.22.0 (baseline)
    Parsed [   0.029s] (baseline)
  Checking tket-qsystem v0.22.0 -> v0.22.0 (assume minor change)
   Checked [   0.047s] 159 checks: 159 pass, 41 skip
   Summary no semver update required
  Finished [  89.137s] tket-qsystem

@aborgna-q aborgna-q added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main with commit 133c885 Dec 9, 2025
23 of 24 checks passed
@aborgna-q aborgna-q deleted the ab/pytket-barrier-params branch December 9, 2025 12:27
@hugrbot hugrbot mentioned this pull request Dec 8, 2025
github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
Fixes #1303 
Depends on #1298

Stores the output list of qubit/bit parameters when encoding a region's
output, so we can use them when decoding circuits.
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.

pytket barriers cannot store parameters

4 participants