wai-quantum 0.7.0: Python, bring your own quantum, editors, one OpenQASM 3 reader, compilation, the debugger, device targets, estimates, the verdict, and the version contract #521
Loading…
Reference in a new issue
No description provided.
Delete branch "wai/quantum-ecosystem"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
WAI Quantum 0.7.0 (CLI 0.2.0, qpu 0.3.0, job service 0.2.0): the ecosystem release. This PR carries the wave-1 work (#515–#520, rebased onto main after #514) and everything since, as one fast-forward line, so it needs one CI run.
What is in it
wai-quantum lsp,fmtanddap, an OpenQASM 3 tree-sitter grammar, and an editor extension with a debugger.basis(clifford_t|standard).test.run --target, and three MCP tools on each server.repair_qasm, held to the flagged lines.VERSIONING.md: a year between majors, six months of support for the previous major, deprecations announced one minor ahead.DEPRECATIONS.md.output … = value;, and the grammar check requires the intent set's broken-on-purpose programs to fail.Tests
smoke.shwith CI's relative path;quantum_engine::22; edge component 10;The previous head's only red check was a timing test in eoc-meter under host load. eoc-meter is untouched by this PR, and its log shows the flake. This push runs everything again.
After merge, with the owner's go-ahead: publish wai-quantum 0.7.0, then wai-quantum-qpu 0.3.0, then wai-quantum-cli 0.2.0, and raise the semver baselines; deploy the job service 0.2.0 and the site's Studio; and update the MCP registry entries from the two
server.jsonfiles.🤖 Generated with Claude Code
The reader is rebuilt in stages, each with the source position of what it handles: tokens (qasm::lex), the program as written (qasm::ast, qasm::parse) and the program run on reading (qasm::elab). qasm::diag is the table of codes: each with its outcome (refused, lowered, carried, preserved, warned) and a one-line meaning, served as data (codes(), codes_json()) and as docs/qasm-diagnostics.md, which a test holds to the table. A diagnostic's text keeps the message people read and ends with its code ("line 3: unknown gate foo [Q103]"); qasm::read gives the program, each op's line and the warnings, and a refusal as a Diagnostic with line, column and length. engine::job::lint carries code, column and length, and warnings under `diagnostics`. The language the reader now takes, each construct lowered exactly or refused with a code: def subroutines, inlined (classical arguments by value, qubits by reference, return values, a returned measurement written into the caller's bit, bits a subroutine or block declares for itself); inv @, pow(k) @ and fractional pow where an exact principal root exists, and ctrl/negctrl on any gate, user gates included; float, angle[n] (held to n bits, with the rounding reported), complex, uint, bool, bit arrays, arrays, casts and the built-in functions, folded with the crate's own deterministic functions; while (unrolled when its condition is known, or run at most @wai.max_iterations N times on measured bits), switch, break, continue, return and end; conditions on measured bits with comparisons, &&, || and !, compiled to forward jumps; output declarations; delay, box, stretch, barrier and gate durations carried as timing; defcal, cal and defcalgrammar kept verbatim; let aliases, slices, index sets, negative indices and physical qubits; gphase. The program carries what it declares beyond its gates in Program::extra, and each controlled gate's native form for the bit-exact circuit (Program::dyadic_native, qasm::exact_circuit). A new feature, quantum_lang, holds the reader without the lowerings, so the toolchain can read through it. Tests changed where a refusal changed: `inv @` and a control on rz are read now; a loop variable may share a gate parameter's name (names are scoped); `^` between integers under OPENQASM 3 is exclusive or (refused only where no version is stated); a loop may be a loop's body; an unterminated loop body names the missing `;`. Co-Authored-By: Claude Opus 5.5 <[email protected]>quantum_toolchain::from_qasm, the OpenQASM import of the edge component and the processor clients, was a second reader that took one register, one statement a line, no gate definitions and exact rational angles. It now reads through qasm::read, as every other surface does, and then applies the bit-exact circuit's own restriction, refusing with the reader's codes: a non-dyadic angle (Q500), more than 255 qubits (Q501), a program whose measurements do not all come at the end (Q502). A controlled gate the modifiers write stays one gate under all its controls (Program::extra's native forms), so to_qasm's output still reads back gate for gate and the round-trip tests hold by hash. Tests changed where a refusal changed: two registers, a gate definition and two statements on one line are read now; a control on rz is a controlled rz, exact; a qubit named twice is the reader's Q109 ("named twice in one gate") where this reader said "invalid circuit". A bare radian number is now held to the reader's dyadic tolerance (1e-14 of a turn), where this reader accepted one within 1e-9 of a dyadic angle and rounded it. Co-Authored-By: Claude Opus 5.5 <[email protected]>- POST /v1/estimate: the engine's estimate of a program, or of a logical-counts or routine document, each estimate sealed with the service's key in the resource-estimate receipt family and the answer in a job's form. It counts against the client and runs with the design checks (two at a time); a program of more than 200000 gates or 256 distinct rotation angles, or a budget leaving a rotation less than 1e-12, is refused (422) with the local command. - POST /v1/verify on an estimate checks its seal and every receipt and re-runs the request, within the same bounds: {valid, signed, receipts, reproduced}. - MCP: estimate_resources, with the engine's description and schema; and verify_quantum_receipt re-runs an estimate. OpenAPI: /v1/estimate and EstimateRequest. The tool list's test is pinned. - smoke.sh: an estimate, its verification and a changed one refused, a counts document, and one too fine sent to the command line. Two checks written before the one reader's diagnostics resource and its while refusal now read them as the reader gives them (the codes, not prose). Every check held against a local instance on the macOS build host. - The agent docs regenerated from the live tool lists (llms.txt, llms-full.txt, service-mcp.json, the skill's tools). Co-Authored-By: Claude Opus 5.5 <[email protected]>- schemas/ beside the crate's manifest: the job request, the job result, the job as a host returns it, the receipt (its second form; the first still verifies), the plan, the answers of the engine's tools, and the versions a host reports, each wai.quantum.<document>/<major> kept as <document>.v<major>.json. - engine::schema: the names, stamp() (engine {name, version} and schema in every result run::run and provider::result give), versions(), and a checker for the subset of JSON Schema the files use, which also refuses a member a schema does not name so a test fails when the code drifts. - The receipt's form is unchanged: what it seals is the result's RFC 8785 text, which now holds two more members. Two job bodies sealed by the engine as it was before (testdata/*-legacy.json) still verify, their digests pinned. Co-Authored-By: Claude Opus 5.5 <[email protected]>wai-quantum: Python, bring your own quantum, editors, one OpenQASM 3 reader, and certified compilationto wai-quantum 0.7.0: Python, bring your own quantum, editors, one OpenQASM 3 reader, compilation, the debugger, device targets, estimates, the verdict, and the version contract