fix(transformers): do not reorder measurements sharing a key - #8226
Open
Sanjays2402 wants to merge 1 commit into
Open
fix(transformers): do not reorder measurements sharing a key#8226Sanjays2402 wants to merge 1 commit into
Sanjays2402 wants to merge 1 commit into
Conversation
synchronize_terminal_measurements moved a measurement to the final moment even when a later measurement reused the same key. Reordering two measurements with the same key changes the record order for that key, so the transformed circuit is not logically equivalent to the input. find_terminal_measurements now tracks measurement keys seen in later moments (mirroring the existing seen_control_keys handling) and does not classify a measurement as terminal when a later measurement reuses its key. align_left/align_right already refuse this reordering. Adds a regression test using the circuit from the issue report.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8226 +/- ##
=======================================
Coverage 99.60% 99.60%
=======================================
Files 1118 1118
Lines 101667 101673 +6
=======================================
+ Hits 101261 101267 +6
Misses 406 406 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6329
synchronize_terminal_measurementsmoved a measurement to the final moment even when a later measurement reused the same key. Reordering two measurements that share a key changes the record order for that key, so the result is not logically equivalent to the input (align_left/align_rightalready refuse this reordering).find_terminal_measurementsnow tracks measurement keys seen in later moments, mirroring the existingseen_control_keyshandling, and no longer treats such a measurement as terminal. Regression test uses the circuit from the issue.