Skip to content

fix: 🐛 make number of qubits obligatory - #162

Merged
robertodr merged 23 commits into
mainfrom
fix/obligatory-number-of-qubits-modes
Aug 6, 2026
Merged

fix: 🐛 make number of qubits obligatory #162
robertodr merged 23 commits into
mainfrom
fix/obligatory-number-of-qubits-modes

Conversation

@adamglos92

@adamglos92 adamglos92 commented Jul 27, 2026

Copy link
Copy Markdown
Member

By opening this PR I confirm that I have read CONTRIBUTING.md and I agree to the terms of the Contributor License Agreement.

Summary

Makes number of qubits argument obligatory to avoid confusing interface

Closes #83
Closes #160

Changes

  • ...

Checklist

  • Tests added or updated to cover the changes
  • Documentation updated (docstrings, docs/, CONTRIBUTING.md) if needed
  • CHANGELOG / release notes updated if applicable

AI/LLM disclosure

  • I did not use LLM tooling, or used it only privately for ideation
  • I used the following tool to help write this PR description:
  • I used the following tool to generate or modify code: Claude Code Sonnet 5

@adamglos92 adamglos92 self-assigned this Jul 27, 2026
@ludmilaasb
ludmilaasb marked this pull request as ready for review August 5, 2026 13:29
@ludmilaasb ludmilaasb self-assigned this Aug 5, 2026
@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.58%. Comparing base (2e86432) to head (6ac6b0a).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #162      +/-   ##
==========================================
+ Coverage   94.77%   97.58%   +2.80%     
==========================================
  Files          14       14              
  Lines         708      745      +37     
  Branches       90       99       +9     
==========================================
+ Hits          671      727      +56     
+ Misses         22       13       -9     
+ Partials       15        5      -10     
Flag Coverage Δ
cpp 97.58% <100.00%> (+2.80%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@ludmilaasb
ludmilaasb marked this pull request as draft August 5, 2026 13:40
@ludmilaasb

Copy link
Copy Markdown
Member

Tests fixed, fixing the documentation

@ludmilaasb ludmilaasb added the test-in-draft Run CI even in Draft mode label Aug 5, 2026
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Docs preview: https://pr-162.monoprop-docs.pages.dev

@robertodr robertodr changed the title fix: 🐛 Making number of qubits obligatory fix: 🐛 make number of qubits obligatory Aug 5, 2026
Comment thread src/monoprop/monomial_propagator.py Outdated
Comment thread src/monoprop/monomial_propagator.py Outdated
robertodr
robertodr previously approved these changes Aug 5, 2026

@robertodr robertodr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, please review the suggested removal of two comments that look like slop to me

robertodr and others added 3 commits August 5, 2026 20:24
Co-authored-by: Roberto Di Remigio Eikås <robertodr@users.noreply.github.com>
Signed-off-by: Ludmila Botelho <39570941+ludmilaasb@users.noreply.github.com>
@ludmilaasb
ludmilaasb marked this pull request as ready for review August 6, 2026 07:35
… to 100%

Adds targeted unit tests for previously-untested validation and error
paths in circuit.py, fermi.py, majorana.py, qiskit_conversion.py, and
utils.py (new tests/test_utils.py). No functional changes.

Assisted-by: ClaudeCode:claude-sonnet-5
…modes' into fix/obligatory-number-of-qubits-modes
Comment thread src/monoprop/circuit.py Outdated
@ludmilaasb
ludmilaasb requested a review from robertodr August 6, 2026 08:18
Co-authored-by: Ludmila Botelho <39570941+ludmilaasb@users.noreply.github.com>
Signed-off-by: Roberto Di Remigio Eikås <robertodr@users.noreply.github.com>
robertodr
robertodr previously approved these changes Aug 6, 2026
@robertodr

robertodr commented Aug 6, 2026

Copy link
Copy Markdown
Member

do we have an explicit test that covers Matteo's case in #160 ?

from monoprop.majorana import MajoranaOperator
from monoprop.majorana_propagator import MajoranaPropagator

NUM_MODES = 4
BAD_INDEX = 99  # >= 2 * NUM_MODES
op = MajoranaOperator({(0, BAD_INDEX): 1.0}, num_modes=NUM_MODES)

EDIT yes we do

@ludmilaasb ludmilaasb removed the test-in-draft Run CI even in Draft mode label Aug 6, 2026
@github-actions github-actions Bot added documentation Improvements or additions to documentation python labels Aug 6, 2026
@robertodr
robertodr enabled auto-merge (squash) August 6, 2026 09:20
@robertodr
robertodr merged commit dbb3732 into main Aug 6, 2026
23 checks passed
@robertodr
robertodr deleted the fix/obligatory-number-of-qubits-modes branch August 6, 2026 09:28
@sonarqubecloud

sonarqubecloud Bot commented Aug 6, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MajoranaOperator.__init__ should validate the indices of the input terms Circuit can be composed of gate defined over different number of qubits?

3 participants