Repository navigation
Conversation
Cover the rejection paths of the Pauli-op reader (an input, contradicting or non-stochastic classical parts, no flow, a dependent postselection of probability 0), commutant measurements that would anticommute, a rotation about a dormant Z, expansions after the last measurement, and a big-endian host. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Contributor
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The test fixture cannot detect removal of the pairwise-commutation guard because Z1 is already rejected by the independent-X check.
1 open issue
What changed in this PR
This tests-only PR expands coverage of previously untested statevector backend branches without changing production code.
Changes:
- Adds tests for Pauli-operation validation, relation reduction, postselection, and commutant measurements.
- Covers dormant-Z rotation removal and scheduling expansions after the last measurement.
- Verifies that shot sampling rejects big-endian hosts.
| File | Description |
|---|---|
test/unit/statevector/test_shots.py |
Tests rejection of big-endian hosts. |
test/unit/statevector/test_schedule.py |
Tests expansions after the final measurement. |
test/unit/statevector/test_plan.py |
Tests removal of dormant-Z rotations. |
test/unit/statevector/test_pbc.py |
Adds validation, relation, flow, postselection, and commutation tests. |
Review effort: Balanced
Comment on lines
+90
to
+93
| # NOTE: X1 and Z1 both commute with a rotation about Z0, but not with each other. | ||
| ops = PauliOps( | ||
| kind=np.array([ROTATION], dtype=np.uint8), | ||
| x=np.array([[0, 0]], dtype=bool), |
Contributor
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
This branch has not been deployed
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.

Adds unit tests for the branches of
tsim.statevectorthat no test reached. Tests only; no source changes.Coverage of
src/tsim/statevectorCI's coverage runs with JIT on, so it can't see inside numba kernels:
shared.pyshows 35% there. To get the real figure I combined a JIT-on run with aNUMBA_DISABLE_JIT=1run, using pure-Python stand-ins for thectpop/bitcast intrinsics (local only, not committed).pbc.pyplan.pyschedule.pyshots.pyshared.pyNew tests:
read_pauli_opsrejects a component with an input._Relationsrejects contradicting equalities, an equality that reduces to0 = 1, and a sign left after reducing. It also handles a sign of one variable._rotation_axesrejects a component with no flow._frameaccepts a dependent postselection that holds with certainty and rejects one of probability 0.ShotSamplerrejects a big-endian host.Still uncovered (left on purpose)
These need contrived setups:
pbc.py:289: an output touching a quantum spider. zxparam'sadd_edgerefuses to create that edge.shared.py:595: a hash-probe collision in lane grouping.shared.py:701: pruning before the first action, which needs an f-only postselected output inside a quantum component.shots.py:409: a nonzero deviation in a call split into parts.shots.py:438: an empty part.Follow-up option: add pure-Python fallbacks for the numba intrinsics under
numba.config.DISABLE_JITand a JIT-off coverage pass to CI, so Codecov reports the kernels honestly.🤖 Generated with Claude Code