Skip to content

Commit 83c6e2f

Browse files
author
Guillaume Lessard
committed
fix(release): smoke test called a function that does not exist
The dry run caught this before a tag did. Every wheel job ran: from qector_decoder_v3 import get_decoder_info and `get_decoder_info` does not exist. The only occurrence in the tree is inside a changelog string, and it is absent from expected_symbols.txt, so the public-surface contract does not carry it either. The Windows job failed with "cannot import name 'get_decoder_info' ... Did you mean: 'get_decoder_pool'?" and all six would have failed identically on the first `v0.7.0` tag. Replace it with a test that proves something. Importing shows the extension loads; it does not show the compiled core decodes correctly. The wheel now builds a repetition-code layout, decodes a syndrome through UnionFindDecoder and BlossomDecoder, and asserts H @ c == s (mod 2) - the syndrome-faithfulness property every decoder here must satisfy - so a wheel that compiles but decodes wrongly cannot reach PyPI. Kept strictly ASCII. The block is fed to `python -` on stdin, and the Windows runner decodes that with the system codepage, where a stray non-ASCII byte is a decode error rather than cosmetic. Verified locally against the installed wheel: both decoders return H @ c == s. Note the dry run also settled the open question about wheel construction: the Windows wheel BUILT successfully under `--no-default-features --features abi3,cuda`, so maturin does supply extension-module from [tool.maturin] features. That risk is closed; only the smoke test was broken.
1 parent 4e705c8 commit 83c6e2f

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

.github/workflows/release-build.yml

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,34 @@ jobs:
103103
python -m pip install --upgrade pip
104104
pip install dist/*.whl --force-reinstall
105105
python - <<'PY'
106+
import numpy as np
106107
import qector_decoder_v3 as qd
108+
107109
print("version:", qd.__version__)
108-
from qector_decoder_v3 import get_decoder_info
109-
print("decoder info:", get_decoder_info())
110+
111+
# Actually decode. Importing proves the extension loads; it does not
112+
# prove the compiled core works. Check syndrome faithfulness
113+
# (H @ c == s, mod 2), the property every decoder in this project must
114+
# satisfy, so a wheel that builds but decodes wrongly cannot reach PyPI.
115+
# Kept strictly ASCII: this heredoc is fed to `python -` on stdin, and
116+
# on the Windows runner that is decoded with the system codepage, where
117+
# a stray non-ASCII byte is a decode error rather than cosmetic.
118+
c2q = [[0, 1], [1, 2], [2, 3], [3, 4]]
119+
n_qubits = 5
120+
syndrome = np.array([0, 1, 0, 0], dtype=np.uint8)
121+
122+
H = np.zeros((len(c2q), n_qubits), dtype=np.uint8)
123+
for i, check in enumerate(c2q):
124+
for q in check:
125+
H[i, q] ^= 1
126+
127+
for name in ("UnionFindDecoder", "BlossomDecoder"):
128+
dec = getattr(qd, name)(c2q, n_qubits)
129+
corr = np.asarray(dec.decode(syndrome), dtype=np.uint8).reshape(-1)
130+
assert corr.shape == (n_qubits,), f"{name}: got shape {corr.shape}"
131+
assert (((H @ corr) % 2) == syndrome).all(), f"{name} is not syndrome-faithful"
132+
print(f"{name}: H@c == s OK")
133+
110134
qd.set_license_key("QECT-COMM-smoke")
111135
info = qd.get_license_info()
112136
assert isinstance(info, dict), f"expected dict, got {type(info)}"

0 commit comments

Comments
 (0)