open-standards/wai/quantum-conformance/answers/README.md
Transaction Science 8a3141366d determinism-tiers §5: CI validates the browser packages; the READMEs run CI's wasmtime
§5 said the browser crate's SIMD validation was done by hand, "which CI does
not check". Since "wai-web-wasm: the packages validate with relaxed SIMD and
threads off", wai-web-wasm.yml validates both bundles and
reach/record/wai_web_bg.wasm with relaxed SIMD and threads disabled. §5 now
says so, and says what CI still does not check: that they hold no other SIMD
instruction. The changelog gains the CI entry for this branch.

The commands that reproduce CI's wasmtime legs ran a stock wasmtime: the WAI
Quantum READMEs (English and Chinese), the bit_identity test's header, the WAI
README's edge example, and the conformance READMEs (quantum, qasm3, formats,
answers, intents). Each now passes -W nan-canonicalization=y
-W relaxed-simd-deterministic=y, as CI does. The determinism-cost run scripts
under wai/research keep their commands: they record runs already made.

The quantum docs check could not see that drift. For a `norun=ci:` block it
stripped every leading VAR=value before matching the command against the
workflow, and its pattern, \S*, did not read a quoted value. It now reads a
quoted or bare value, and when the workflow sets VAR (as an env: key or in a
script) the documented value must be one the workflow gives it, so
CARGO_TARGET_WASM32_WASIP2_RUNNER=wasmtime is refused against a workflow that
sets it to the flagged runner.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-04 12:29:00 -05:00

51 lines
2.6 KiB
Markdown

# Answer conformance
Answers in the answer view layer ([quantum-answers.md](../../extensions/quantum-answers.md),
`wai_quantum::engine::answer`), each with what the layer must make of it.
| Path | What |
|---|---|
| `cases/*.wqa` | The answers: a program, a sample, a verdict and a seal; an intent named by a reference program; the equivalence ladder; an intent that fails; expectation values, amplitudes and a Bloch vector; an engine call named apart from its view; no root; and one case for each code of the layer (`J100` to `J112`) and for a program the reader refuses (`Q103`). `bell-crlf` is `bell` with CRLF line ends. `bell-stored` is `bell` with the receipt marker its seal gives under the key whose seed is 32 bytes of 3, and `bell-stored-changed` the same with one sample's shots changed. |
| `manifest.json` | Each case: its file, what it covers, and what it must give (the manifest's `expect` says what each field means). |
| `bundle.json` | The manifest's cases with every answer inline, for builds that read no files. |
A case is held to the codes of its errors (the diagnostics whose outcome is
`dropped` or `refused`, the ones a model is sent back) and of its warnings, in
the order of their lines; to its root; and to the order its views are drawn
in. A case with `run` has its views carried out on the engine and held to what
they show: a sample's total and its outcomes, a verdict's level and whether it
holds, an equivalence's decision, expectation values, a Bloch vector, the
names a seal covers and its receipt. A stored case's receipt is checked by
running the answer again: the engine is deterministic, so the same answer
gives the same sealed bytes on every build, and a changed one does not verify.
## Native
```sh
cd wai/wai-quantum
cargo test --release --features full --test answer_conformance
```
Two tests: every case against its manifest, and the bundle (and the stored
cases) held equal to the files. After changing a case or the manifest, write
them:
```sh
WAI_ANSWER_BUNDLE_WRITE=1 cargo test --release --features full --test answer_conformance the_bundle_is_the_corpus
```
## WASI (the edge)
```sh
CARGO_TARGET_WASM32_WASIP2_RUNNER='wasmtime run -W nan-canonicalization=y -W relaxed-simd-deterministic=y' \
cargo test --target wasm32-wasip2 --features full --test answer_conformance
```
## Browser
wai-web's wasm32 tests (`--features quantum_engine`, under
`wasm-bindgen-test-runner`) read every case of the bundle with
`engine_answer_parse` and verify the stored cases with `engine_answer_verify`.
CI: `wai-quantum-verdict.yml` (native and wasm32-wasip2) and
`wai-web-wasm.yml` (the browser build).