[Bug] on_loss validation error shows '{}' instead of the gate name
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start in qir_simulation.rs around lines 631–632, where the issue says the error string is built, and trace how the gate name reaches the on_loss validation message. Reproduce the Python example with NoiseConfig and LossPolicy.DEGRADE to confirm the literal {}. Done when the error names the gate (for example, cx) and the repro no longer reports the placeholder.
Written by the indexing model from the issue text.
Description
- Symptom: Bad error
- Release
5a7b2ee32: Non-regression - Where: n/a · NoiseConfig API
Summary. Setting an unsupported on_loss policy (e.g. cx.on_loss = LossPolicy.DEGRADE) gives an error saying 'for the {} gate' instead of naming the gate.
Python repro
"""F31 (cosmetic): the on_loss validation error contains a literal, unformatted '{}' instead of the gate name."""
import sys
from qdk.simulation import NoiseConfig, LossPolicy
n = NoiseConfig()
try:
n.cx.on_loss = LossPolicy.DEGRADE
except AttributeError as e:
print(repr(str(e)), " (expected: 'for the cx gate')")
if "{}" in str(e):
print("VERDICT: REPRODUCED - error message contains an unformatted {} placeholder")
sys.exit(1)
print("VERDICT: NOT REPRODUCED - gate name is formatted into the message")
sys.exit(0)
print("VERDICT: INCONCLUSIVE - DEGRADE was accepted for cx")
sys.exit(2)
| Build | Result | Evidence |
|---|---|---|
release 5a7b2ee32 |
bug present | error message contains an unformatted {} placeholder |
main 42c843a20 |
bug present | error message contains an unformatted {} placeholder |
Observed: 'The on_loss attribute for the {} gate only supports the following policies:\n SKIP\n PROPAGATE\n RESIDUAL_S_DAGGER'
Expected: the gate name ('cx') formatted into the message
Probable cause. qir_simulation.rs ~631-632 passes a '{}' placeholder to String::from instead of formatting in the gate name.
Originally reported as A140
- Dominant language
- Rust
- Stars
- 1k
- Forks
- 226
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 72
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/qdk
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
Maintainers usually reply within 1 day
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
enhancement needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug bulk-filed needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
libracoder/kiri#935 ·
Maintainers usually reply within 1 day
-
Node's `index.d.ts` declares no constructor for `VirtxError`, so TypeScript rejects its argumentsOpen
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
kashsuks/Pinel#172 · 1 comment ·
Maintainers usually reply within 1 day