Skip to content

[codex] Add regression test for barrier recombination in separate_circuit#803

Draft
TSS99 wants to merge 1 commit intoQiskit:mainfrom
TSS99:codex/test-barrier-recombination
Draft

[codex] Add regression test for barrier recombination in separate_circuit#803
TSS99 wants to merge 1 commit intoQiskit:mainfrom
TSS99:codex/test-barrier-recombination

Conversation

@TSS99
Copy link
Copy Markdown

@TSS99 TSS99 commented Apr 17, 2026

Summary

  • add a regression test for separate_circuit when multiple qubits remain in the same partition after barrier splitting
  • assert that _combine_barriers rebuilds shared barriers instead of leaving duplicated single-qubit barriers behind

Root cause

separate_circuit relies on _split_barriers before partitioning, then _combine_barriers when reconstructing each subcircuit. The existing barrier coverage only exercised one-qubit subcircuits, so the suite still passed even if _combine_barriers was removed.

Fix

  • extend test_separate_circuit with a shared-partition barrier case using partition labels "AAB"
  • verify the resulting subcircuit contains two-qubit barriers in the shared partition, not separate one-qubit barriers

Tests

  • python -m tox -e py311 -- test/utils/test_transforms.py
  • python -m tox -e lint
  • temporary mutation check: commenting out _combine_barriers(tmp_circ) makes test/utils/test_transforms.py fail in the new subtest

Notes or limitations

  • this change is intentionally test-only; it does not modify runtime behavior

Fixes #626

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 17, 2026

CLA assistant check
All committers have signed the CLA.

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.

Need a test that ensures barriers are re-combined correctly in transforms.py

2 participants