CI/CD quality gates for quantum circuits. Statistically validate probabilistic output, across simulators and real QPUs, defined entirely as code.
| Assertion | Result | Detail |
|---|---|---|
| chi_square p ≥ 0.01 | PASS | χ²=0.41 dof=1 p=0.52 |
| distribution_tvd ≤ 0.03 | PASS | distance 0.0043 |
| hellinger_fidelity ≥ 0.99 | PASS | fidelity 1.0000 |
| allowed_states ⊆ {00,11} | PASS | leakage 0.0000 |
| state_probability 00 | PASS | 0.4957 ∈ [0.45, 0.55] |
apiVersion: shotgate.dev/v1alpha1 kind: QuantumWorkflow metadata: name: bell-state defaults: backend: { provider: local-aer, shots: 8192 } jobs: - name: bell-pair circuit: { format: qasm2, path: bell.qasm } assertions: - type: chi_square # χ² goodness-of-fit expected: { "00": 0.5, "11": 0.5 } significance: 0.01 - type: allowed_states # |01⟩,|10⟩ forbidden states: ["00", "11"] max_leakage: 0.0
Circuits, shots, and statistical assertions live in a QuantumWorkflow file, versioned next to your code.
podman pull and go: pinned dependencies, no host Python, identical locally and in CI.
Verdicts map to exit codes; a failed assertion fails the build. JUnit XML output drops into any CI dashboard.
Quantum output is probabilistic; exact-match testing is meaningless. Each oracle bounds a distribution property instead.
Total variation distance between observed and expected counts, bounded above. Interpretable and shot-count agnostic.
Classical fidelity between the observed and expected distributions, bounded below.
Pearson goodness-of-fit against the expected distribution; gate on a p-value vs. your significance level.
Probability mass observed outside the allowed support set; catches states that should never appear.
Marginal probability of one outcome, held inside a window. The simplest hardware-friendly gate.
v0.2 gates passed on a real QPU: Bell, GHZ, and Grover on ibm_fez at 4096 shots, 2026-06-11. The measured baseline lives in hardware-validation.
jobs: validate-circuits: runs-on: ubuntu-latest container: ghcr.io/coldqubit/shotgate:latest steps: - uses: actions/checkout@v4 - run: shotgate run workflow.yaml --junit report.xml
All assertions passed. The pipeline proceeds.
A statistical gate failed. The build stops here.
Bad configuration or runtime error, fix the workflow, not the circuit.