[Bug] on_loss validation error shows '{}' instead of the gate name

オープン 初心者向け
#4,187 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python, rust
領域
backend

調査の方向性

issueにエラー文字列を組み立てていると記載されている qir_simulation.rs の631~632行付近から始め、ゲート名が on_loss の検証メッセージに渡る経路を追ってください。NoiseConfig と LossPolicy.DEGRADE を使ってPythonの例を再現し、文字列としての {} を確認してください。エラーにゲート名(例:cx)が表示され、再現時にプレースホルダーが報告されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

bug low-priority
  • 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

主要言語
Rust
スター
1k
フォーク
226
平均マージ
2日 9時間
マージ済み PR(30日)
72

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/qdk のほかの issue

microsoft/qdk の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。