Skip to content

Conversation

@soroushfathi
Copy link
Contributor

@soroushfathi soroushfathi commented Oct 14, 2025

Description

Fixes #654

Checklist:

  • The pull request only contains commits that are focused and relevant to this change.
  • I have added appropriate tests that cover the new/changed functionality.
  • I have updated the documentation to reflect these changes.
  • I have added entries to the changelog for any noteworthy additions, changes, fixes, or removals.
  • I have added migration instructions to the upgrade guide (if needed).
  • The changes follow the project's style guidelines and introduce no new warnings.
  • The changes are fully tested and pass the CI checks.
  • I have reviewed my own code changes.

Summary by CodeRabbit

  • Bug Fixes

    • Improved layout preservation and native gate compliance for mirror circuit generation.
  • New Features

    • Mirror circuit generation now supports transpilation to specified targets with configurable optimization levels, ensuring circuits use only native gates for target hardware.

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

The _create_mirror_circuit function is enhanced to accept optional target and optimization_level parameters. When a target is provided, the mirrored circuit is conditionally transpiled to comply with the target's native gate set while preserving layout information, addressing the issue where mirror circuits previously ignored device-specific gate constraints.

Changes

Cohort / File(s) Summary
Core Mirror Circuit Logic
src/mqt/bench/benchmark_generation.py
Expanded _create_mirror_circuit signature to accept keyword-only target: Target | None = None and optimization_level: int = 2 parameters. Added conditional transpilation step when target is provided to enforce native gate compliance and restore initial layout. Updated call sites to propagate new arguments.
Documentation
CHANGELOG.md
Added entry under Unreleased/Fixed documenting the layout preservation and native gate compliance fix for mirror circuit generation, including PR #709 reference and contributor credits.
Test Validation
tests/test_bench.py
Enhanced test_get_benchmark_mirror_option with validation step using GatesInBasis(target) PassManager to verify all gates in mirror circuit are native to the specified target.

Sequence Diagram

sequenceDiagram
    participant Caller as Caller
    participant CreateMirror as _create_mirror_circuit
    participant Compose as Compose
    participant Transpile as Transpile
    participant RestoreLayout as Restore Layout
    
    Caller->>CreateMirror: call with target, optimization_level
    CreateMirror->>Compose: invert gates & compose
    Compose-->>CreateMirror: mirrored circuit
    
    alt target is not None
        CreateMirror->>Transpile: transpile to native gate set
        Transpile-->>CreateMirror: transpiled circuit
        CreateMirror->>RestoreLayout: restore initial_layout
        RestoreLayout-->>CreateMirror: circuit with preserved layout
    else target is None
        CreateMirror-->>CreateMirror: use circuit as-is
    end
    
    CreateMirror->>CreateMirror: add measurements & finalize
    CreateMirror-->>Caller: mirror circuit
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

The changes introduce new conditional logic with transpilation and layout handling across multiple files, requiring careful verification of gate compliance logic and test coverage. The scope is well-contained to a single function's enhancement, but the interplay between transpilation, layout preservation, and backward compatibility warrants thorough review.

Poem

🐰 A mirror now bends with quantum grace,
Native gates find their rightful place,
Through targets transpiled, layouts stay true,
Reflection reversed—the circuit's debut!
Hops of joy for bug #654

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The pull request includes an out-of-scope change to .pre-commit-config.yaml, which bumps the version of the validate-pyproject-schema-store pre-commit hook from 2025.10.03 to 2025.10.11. This configuration change is unrelated to the stated objectives in issue #654 regarding mirror circuit generation and native gate compliance. While this change is minor and unlikely to cause harm, it falls outside the scope of fixing mirror circuit behavior.
Description Check ⚠️ Warning The PR description is sparse and incomplete relative to the provided template requirements. While the description correctly references the fixed issue ("Fixes #654") and includes a completed checklist, it lacks the required summary of changes and relevant motivation/context outlined in the template. A summary should explain what was changed (e.g., updated _create_mirror_circuit to accept target parameters, added transpilation with layout preservation) and why these changes address the issue. The PR description provides only the issue number without substantive detail about the changes made.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The code changes comprehensively address all main objectives from linked issue #654. The _create_mirror_circuit function now accepts optional target and optimization_level parameters to enable transpilation to the target's native gate set, preventing creation of non-native gate inverses. The changes include logic to preserve the initial layout through transpilation, and a validation loop was added in test_get_benchmark_mirror_option to assert that mirror circuits contain only native gates (or barrier/measure gates). These changes directly resolve the issue where mirror circuits previously ignored the native gate set.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Title Check ✅ Passed The PR title "🐛 Fix native gates handling for mirror circuits" directly corresponds to the main objective of this changeset, which is to fix a bug where generated mirror circuits do not respect the device's native gate set. The textual portion of the title is specific and clear, accurately describing the primary change: modifications to the _create_mirror_circuit function to ensure mirror circuits are transpiled to use only native gates when a target is provided, along with layout preservation improvements. While the emoji is decorative noise, it does not obscure the meaning, and the actual descriptive text is concise and clearly communicates the fix to teammates scanning the commit history.

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c19b9f and 190a41e.

📒 Files selected for processing (3)
  • CHANGELOG.md (3 hunks)
  • src/mqt/bench/benchmark_generation.py (4 hunks)
  • tests/test_bench.py (1 hunks)

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/mqt/bench/benchmark_generation.py (1)

321-321: Pass target parameter to _create_mirror_circuit in native gates and mapped contexts.

The new target parameter enables transpilation of mirror circuits to native gate sets, but it's not being passed at these call sites. This means mirror circuits generated at the NATIVEGATES and MAPPED levels won't enforce native gate constraints, which appears to contradict the PR objective.

Apply this diff to fix line 321:

     compiled_circuit = pm.run(circuit)
     if generate_mirror_circuit:
-        return _create_mirror_circuit(compiled_circuit, inplace=True)
+        return _create_mirror_circuit(compiled_circuit, inplace=True, target=target, optimization_level=opt_level)
     return compiled_circuit

Apply this diff to fix line 387:

     )
     if generate_mirror_circuit:
-        return _create_mirror_circuit(mapped_circuit, inplace=True)
+        return _create_mirror_circuit(mapped_circuit, inplace=True, target=target, optimization_level=opt_level)
     return mapped_circuit

Also applies to: 387-387

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c82292 and 4a08ff5.

📒 Files selected for processing (1)
  • src/mqt/bench/benchmark_generation.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
src/mqt/bench/benchmark_generation.py

79-79: Boolean-typed positional argument in function definition

(FBT001)


79-79: Boolean default positional argument in function definition

(FBT002)

🔇 Additional comments (1)
src/mqt/bench/benchmark_generation.py (1)

78-80: LGTM! Function signature extended appropriately.

The addition of target and optimization_level parameters enables optional transpilation of mirror circuits to native gate sets, which aligns with the PR objective.

@coderabbitai
Copy link

coderabbitai bot commented Oct 14, 2025

📝 Walkthrough

Walkthrough

Adds optional target and optimization_level parameters to _create_mirror_circuit. When target is provided, the function transpiles the mirrored circuit to the target’s native gate set using the specified optimization level; otherwise it returns the untranspiled mirror. Inplace behavior and mirror construction remain unchanged. Docstring updated.

Changes

Cohort / File(s) Summary of Changes
Benchmark generation
src/mqt/bench/benchmark_generation.py
Extended _create_mirror_circuit signature with target: Target | None and optimization_level: int. Added conditional transpilation to target native gate set when target is provided. Preserved inplace handling and mirror creation logic. Updated docstring. Existing call sites unaffected due to defaults.

Sequence Diagram(s)

sequenceDiagram
    actor Caller
    participant BG as BenchmarkGeneration::_create_mirror_circuit
    participant T as Transpiler

    Caller->>BG: _create_mirror_circuit(circ, target=None|Target, optimization_level)
    activate BG
    BG->>BG: Construct mirrored circuit (inplace respected)
    alt target provided
        BG->>T: Transpile mirrored circuit to target native set<br/>with optimization_level
        T-->>BG: Transpiled circuit
        BG-->>Caller: Return transpiled mirror
    else no target
        BG-->>Caller: Return untranspiled mirror
    end
    deactivate BG
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I mirrored gates with careful care,
Then hopped to targets, native flair—
If asked, I tweak and optimize,
If not, I keep the plain disguise.
A bunny nod, a gentle spin—
Transpile or not, the bits still grin. 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The current title “Fix/mirror native gates” is ambiguous and does not clearly summarize the core change of adding optional target and optimization parameters for native gate transpilation in the mirror circuit generator. It uses a slash and a generic phrasing rather than a concise, descriptive statement of the main enhancement. Please revise the title to clearly reflect the primary change, for example “Add native gate transpilation support to mirror circuit generator,” so that it is concise and immediately conveys the enhancement.
Description Check ⚠️ Warning The description is mostly the unfilled template and lacks a summary of what was changed, the motivation and context, any dependencies, and the issue number being fixed. Key sections like a detailed change summary, dependencies, and completed checklist items (tests, changelog, CI status) are missing. Please populate the description with a clear summary of the new optional target and optimization parameters, explain why this change is needed, list any dependencies, include the issue number in “Fixes #…,” and update the checklist to reflect added tests, documentation, changelog entries, and CI status.
✅ Passed checks (1 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
src/mqt/bench/benchmark_generation.py (2)

320-321: Critical: Pass target and opt_level to mirror circuit generation.

The call to _create_mirror_circuit doesn't pass the target and opt_level parameters, so the mirror circuit won't be transpiled to the native gate set. This defeats the purpose of this PR fix.

Apply this diff:

     compiled_circuit = pm.run(circuit)
     if generate_mirror_circuit:
-        return _create_mirror_circuit(compiled_circuit, inplace=True)
+        return _create_mirror_circuit(compiled_circuit, inplace=True, target=target, optimization_level=opt_level)
     return compiled_circuit

386-387: Critical: Pass target and opt_level to mirror circuit generation.

The call to _create_mirror_circuit doesn't pass the target and opt_level parameters, so the mirror circuit won't be transpiled to the target's native gate set. This defeats the purpose of this PR fix.

Apply this diff:

     )
     if generate_mirror_circuit:
-        return _create_mirror_circuit(mapped_circuit, inplace=True)
+        return _create_mirror_circuit(mapped_circuit, inplace=True, target=target, optimization_level=opt_level)
     return mapped_circuit
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c82292 and e8eaecf.

📒 Files selected for processing (1)
  • src/mqt/bench/benchmark_generation.py (2 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
src/mqt/bench/benchmark_generation.py

79-79: Boolean-typed positional argument in function definition

(FBT001)


79-79: Boolean default positional argument in function definition

(FBT002)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/mqt/bench/benchmark_generation.py (1)

97-97: Correct parameter description.

The optimization_level parameter controls the transpiler's optimization passes, not a device property.

Apply this diff:

-        optimization_level: Optimization level of the device.
+        optimization_level: Optimization level for the transpilation pass (0-3).
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b56db85 and 87ec363.

📒 Files selected for processing (1)
  • src/mqt/bench/benchmark_generation.py (4 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
src/mqt/bench/benchmark_generation.py

79-79: Boolean-typed positional argument in function definition

(FBT001)


79-79: Boolean default positional argument in function definition

(FBT002)

🔇 Additional comments (4)
src/mqt/bench/benchmark_generation.py (4)

78-80: LGTM!

The function signature correctly adds target and optimization_level parameters to enable native gate set compliance for mirror circuits. The default optimization_level=2 aligns with the defaults used in calling functions, ensuring consistency.


116-118: LGTM! Core fix correctly addresses issue #654.

The conditional transpilation correctly ensures that the mirrored circuit respects the target's native gate set. Using routing_method=None is appropriate here—it decomposes non-native gates (e.g., sxdg) to native equivalents without altering the qubit mapping. This fixes the bug where inverse operations in mirror circuits could violate the native gate set.


321-321: LGTM! Correctly enables native gate set compliance.

The updated call now passes target and optimization_level to _create_mirror_circuit, ensuring that mirror circuits generated at the native-gates level respect the device's native gate set.


387-387: LGTM! Correctly enables native gate set compliance.

The updated call now passes target and optimization_level to _create_mirror_circuit, ensuring that mirror circuits generated at the mapped level respect the device's native gate set.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/mqt/bench/benchmark_generation.py (1)

97-97: Fix parameter description.

The description incorrectly states "Optimization level of the device." The optimization_level parameter controls the transpiler's optimization passes, not a device property.

Apply this diff:

-        optimization_level: Optimization level of the device.
+        optimization_level: Optimization level for the transpilation pass (0-3).
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 87ec363 and 2893c72.

📒 Files selected for processing (1)
  • src/mqt/bench/benchmark_generation.py (4 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
src/mqt/bench/benchmark_generation.py

79-79: Boolean-typed positional argument in function definition

(FBT001)


79-79: Boolean default positional argument in function definition

(FBT002)

🔇 Additional comments (4)
src/mqt/bench/benchmark_generation.py (4)

78-80: LGTM! Function signature correctly extended.

The new target and optimization_level parameters enable target-aware transpilation of mirror circuits. The default optimization_level=2 correctly aligns with calling functions.

Note: Static analysis flags the boolean inplace positional argument (FBT001, FBT002), but this is acceptable for a private helper function.


88-89: LGTM! Docstring accurately describes native gate compliance.

The description correctly explains that the mirrored circuit respects the target's native gate set when a target is provided.


321-321: LGTM! Caller correctly passes target parameters.

The call correctly forwards target and optimization_level to enable native gate compliance for mirror circuits. This addresses the core issue from #654 where mirror circuits ignored the native gate set.


387-387: LGTM! Caller correctly passes target parameters.

The call correctly forwards target and optimization_level, ensuring mirror circuits respect the native gate set at the mapped benchmark level as well.

@soroushfathi
Copy link
Contributor Author

@burgholzer
After applying the recent modifications, I encountered a layout mismatch error in the mirror benchmark test (test_get_benchmark_mirror_option).

The test fails on the following assertion:

assert qc_mirror.layout.initial_layout == qc_base.layout.initial_layout

The error shows that the base circuit’s layout contains both logical and ancilla qubits (e.g., q[0..2] and ancilla[0..23]), while the mirrored circuit’s layout only contains the device qubits (q[0..26]).

It seems that when the mirrored circuit is transpiled again (with target specified), the original TranspileLayout object — including the initial_layout — is not preserved and gets replaced by a new layout corresponding to the physical device mapping.

I’d appreciate any suggestions on the correct or recommended way to preserve the original circuit layout through the mirror-generation and transpilation steps.
I’m here for further discussion or to try other possible solutions if needed.

@burgholzer
Copy link
Member

I just pushed a commit that should hopefully fix everything and preserve the layout.

This looks pretty good by now.
Would you mind adding a changelog entry as well as some additional assertions to the existing tests that make sure the resulting circuit only contains native gates?

@soroushfathi
Copy link
Contributor Author

soroushfathi commented Oct 17, 2025

I just pushed a commit that should hopefully fix everything and preserve the layout.

This looks pretty good by now. Would you mind adding a changelog entry as well as some additional assertions to the existing tests that make sure the resulting circuit only contains native gates?

Sure! I’ll add the changelog entry and some extra assertions to ensure the mirrored circuit only contains native gates. Thanks for the feedback!

renovate bot added 2 commits October 17, 2025 19:01
This PR contains the following updates:

| Update | Change |
|---|---|
| lockFileMaintenance | All locks refreshed |

🔧 This Pull Request updates lock files to use the latest dependency
versions.

---

### Configuration

📅 **Schedule**: Branch creation - "before 4am on monday" (UTC),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config
help](https://redirect.github.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/munich-quantum-toolkit/bench).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE0My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJweXRob24iXX0=-->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…o v2025.10.11 (munich-quantum-toolkit#710)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|
[henryiii/validate-pyproject-schema-store](https://redirect.github.com/henryiii/validate-pyproject-schema-store)
| repository | patch | `2025.10.03` -> `2025.10.11` |

Note: The `pre-commit` manager in Renovate is not supported by the
`pre-commit` maintainers or community. Please do not report any problems
there, instead [create a Discussion in the Renovate
repository](https://redirect.github.com/renovatebot/renovate/discussions/new)
if you have any questions.

---

### Release Notes

<details>
<summary>henryiii/validate-pyproject-schema-store
(henryiii/validate-pyproject-schema-store)</summary>

###
[`v2025.10.11`](https://redirect.github.com/henryiii/validate-pyproject-schema-store/compare/2025.10.03...2025.10.11)

[Compare
Source](https://redirect.github.com/henryiii/validate-pyproject-schema-store/compare/2025.10.03...2025.10.11)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "every weekend" (UTC), Automerge - At
any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/).
View the [repository job
log](https://developer.mend.io/github/munich-quantum-toolkit/bench).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDMuMSIsInVwZGF0ZWRJblZlciI6IjQxLjE0My4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJwcmUtY29tbWl0Il19-->

Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
@codecov
Copy link

codecov bot commented Oct 17, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/mqt/bench/benchmark_generation.py (1)

130-134: Possible classical register name collision (“meas”).

If the original circuit already had a creg named "meas" (removed measures don’t remove regs), add_register will raise. Use a unique name.

-    new_creg = ClassicalRegister(len(active_qubits), "meas")
-    target_qc.add_register(new_creg)
+    # Use a unique name to avoid clashes with existing classical registers.
+    creg_name = "meas_mirror"
+    if any(creg.name == creg_name for creg in target_qc.cregs):
+        creg_name = f"{creg_name}_{len(target_qc.cregs)}"
+    new_creg = ClassicalRegister(len(active_qubits), creg_name)
+    target_qc.add_register(new_creg)
     target_qc.measure(active_qubits, new_creg)
♻️ Duplicate comments (1)
src/mqt/bench/benchmark_generation.py (1)

96-97: Docstring: fix optimization_level wording.

It’s a transpilation setting, not a device property.

-        target: Target device for transpilation. If provided, ensures native gate set compliance.
-        optimization_level: Optimization level of the device.
+        target: Target object specifying native gate set and device properties; if provided, ensures native gate set compliance.
+        optimization_level: Optimization level for the transpilation passes (0–3).
📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 31bea30 and 3be8a1b.

📒 Files selected for processing (1)
  • src/mqt/bench/benchmark_generation.py (4 hunks)
🧰 Additional context used
🪛 Ruff (0.14.0)
src/mqt/bench/benchmark_generation.py

79-79: Boolean-typed positional argument in function definition

(FBT001)


79-79: Boolean default positional argument in function definition

(FBT002)

🔇 Additional comments (1)
src/mqt/bench/benchmark_generation.py (1)

331-331: Wiring looks correct; please add a native‑gate assertion in tests.

Passing target and opt_level through to the mirror ensures native gate compliance. Add an assertion that all non‑measure ops in the mirror are in target.operation_names.

Example test snippet:

gate_names = {inst.operation.name for inst in qc_mirror.data if inst.operation.name != "measure"}
assert gate_names <= set(target.operation_names)

Also applies to: 397-397

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3be8a1b and d9d7320.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • CHANGELOG.md (1 hunks)
🔇 Additional comments (1)
.pre-commit-config.yaml (1)

132-132: Pre-commit hook update should be separated or its inclusion clarified.

The validate-pyproject-schema-store version bump to 2025.10.11 is confirmed in a separate commit (962e6f1) with its own update message, distinct from the mirror circuit fix commits. While the update itself is benign, it represents maintenance work logically separate from the PR's core objective. Verify whether this bundling aligns with your contribution guidelines, or consider moving it to its own commit/PR.

soroushfathi and others added 2 commits October 18, 2025 00:42
Ensure mirror circuits only contain gates native to the target device, allowing barriers and measurements as exceptions. This validation helps maintain hardware compatibility for benchmark circuits.
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: ASSERTIVE

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3be8a1b and d9d7320.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (2)
  • .pre-commit-config.yaml (1 hunks)
  • CHANGELOG.md (1 hunks)
🔇 Additional comments (2)
.pre-commit-config.yaml (1)

132-132: Routine pre-commit hook version update.

The pre-commit hook for validating pyproject schemas is bumped to a recent October 2025 release, which is consistent with the autoupdate_schedule: quarterly setting.

CHANGELOG.md (1)

16-18: CHANGELOG entry content is clear and well-formatted.

The entry accurately describes the fix and follows the project's changelog conventions with appropriate emoji, issue reference, and contributor attribution.

@soroushfathi
Copy link
Contributor Author

I just pushed a commit that should hopefully fix everything and preserve the layout.

This looks pretty good by now. Would you mind adding a changelog entry as well as some additional assertions to the existing tests that make sure the resulting circuit only contains native gates?

I have added mentioned changes.

@burgholzer burgholzer changed the title Fix/mirror native gates 🐛 Fix native gates handling for mirror circuits Oct 17, 2025
@burgholzer burgholzer added the fix Fixes something that isn't working label Oct 17, 2025
Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

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

Just pushed a couple of fixes and clean ups.
This should be good to go now! 🚀
Many thanks for the contribution! Much appreciated 🙏🏼

@burgholzer burgholzer enabled auto-merge (squash) October 17, 2025 21:58
@burgholzer burgholzer merged commit b31cac4 into munich-quantum-toolkit:main Oct 17, 2025
16 of 17 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in MQT Applications Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Fixes something that isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Mirror circuits ignore native gate set

2 participants