open-standards/wai/quantum-conformance/accept/v2_unknown_sections.wqc
Transaction Science d06afe78dd wai-quantum circuit2: a strict I-JSON reader, the rules stated in full, an accept corpus
A second review of the I-JSON fix upheld two defects.

- The Rust reader left the number-range rule to serde_json. Built without
  float_roundtrip, its fast path is not correctly rounded, so near the largest
  double the reader and the referee disagreed both ways, and in WQC2 on the
  class; and whether wai-rs features that enable float_roundtrip were linked
  changed the verdict.
- The spec claimed I-JSON, but neither reader refused noncharacters.

wai-quantum now reads a contract or measurement section with a strict reader of
its own (src/ijson.rs) that decides every rule from the text: UTF-8; one JSON
value with JSON whitespace; no member name twice, compared after unescaping; no
surrogate or noncharacter, raw or escaped; no number of magnitude
2^1024 − 2^970 or more, decided by std's correctly rounding parse; at most 127
levels. A number keeps its literal, and an unsigned integer is one written with
no sign, fraction or exponent. The serde dependency added for the visitor is
gone. The referee decides the range rule on the literal's digits, integers
only, and names the rule it refuses by.

quantum-sim §2 states the rules in full, says that only the class is normative
when a section breaks several, and that a reader reads integers exactly. §8
adds the noncharacter to the newly refused payloads and notes the numbers just
below the limit that some earlier builds refused.

`accept_corpus()` holds payloads at the edges of the rules that a reader must
accept, each with its circuit and measurement; the corpus gains `accept/` and
`accept.json`. `gen`, `verify`, the referee and the browser check read it. The
reject corpus gains the boundary cases (the integer 2^1024 − 2^970, a literal
just above it, the WQC2 n_qubits forms on both sides of the class order),
noncharacters, a lone low surrogate, a BOM, NaN and a raw control character,
and the referee and the crate check each JSON case's rule. The wasm32-wasip2
leg runs the reader's tests.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-09 17:46:02 -04:00

176 B