name: wai-quantum error correction and mitigation # Error correction and mitigation (wai/wai-quantum): the colour codes and # their decoder (quantum_color), distance certificates (quantum_distance), # the circuit and error-model texts and their conformance vectors # (quantum_qec_text, quantum-conformance/qec-text/), correlated matching # (quantum_match), sliding-window decoding (quantum_window), the frame # simulator's Pauli-target observables and tags, its reference run and its # measurement records (quantum_frame), the cultivation circuits and their # checks (quantum_cultivate), mitigation # in a job (engine::mitigate), twirling and decoupling as compile passes # (engine::compile) and the error-correction call every host makes # (engine::qec). # # Every decoder is held to the exhaustive ground truth: every error below # half the distance corrected to a trivial residual (at circuit level, every # edge set below half the graph's distance). A release build runs the larger # distances (colour codes to d = 9, bivariate-bicycle certificates to 144 # qubits); the crate's suites run the rest in debug elsewhere # (wai-energy-receipts.yml). concurrency: group: ${{ github.workflow }}-${{ github.event_name == 'push' && github.sha || github.ref }} cancel-in-progress: true on: push: branches: [main] paths: - 'wai/wai-quantum/**' - 'wai/quantum-conformance/qec-text/**' - 'rust-toolchain.toml' - '.github/workflows/wai-quantum-qec.yml' pull_request: paths: - 'wai/wai-quantum/**' - 'wai/quantum-conformance/qec-text/**' - 'rust-toolchain.toml' - '.github/workflows/wai-quantum-qec.yml' jobs: relevant: name: does this change touch it runs-on: gate outputs: run: ${{ steps.gate.outputs.run }} steps: - uses: actions/checkout@v5 with: fetch-depth: 0 - id: gate run: | set -euo pipefail r=$(python3 scripts/pr-touches-paths.py .github/workflows/wai-quantum-qec.yml \ "${{ github.event.pull_request.base.sha }}" \ "${{ github.event.pull_request.head.sha }}") echo "this change touches error correction or mitigation: $r" echo "run=$r" >> "$GITHUB_OUTPUT" native: name: codes, decoders, texts and mitigation ยท linux, release needs: relevant if: needs.relevant.outputs.run == 'true' runs-on: linux timeout-minutes: 60 steps: - uses: actions/checkout@v5 - name: Install Rust 1.99.1 shell: bash run: | export PATH="$HOME/.cargo/bin:$PATH" command -v rustup >/dev/null 2>&1 || \ curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile minimal --default-toolchain 1.99.1 rustup toolchain install 1.99.1 --profile minimal rustup default 1.99.1 echo "$HOME/.cargo/bin" >> "$GITHUB_PATH" # A module filter is satisfied by any one test of the module, so each # new test is required by name to have run and passed. - name: Codes, decoders, texts, mitigation and the error-correction call shell: bash working-directory: wai/wai-quantum run: | set -euo pipefail cargo test --locked --release --features full --lib -- \ quantum_color:: quantum_distance:: quantum_qec_text:: quantum_window:: quantum_match:: quantum_frame:: \ quantum_cultivate:: \ engine::mitigate:: engine::qec:: \ engine::compile::tests::twirling_and_decoupling_keep_the_program \ engine::compile::tests::every_frame_is_carried_through_its_gate \ quantum_noisy::tests::steps_reproduce_the_evolution 2>&1 | tee "$RUNNER_TEMP/qec.log" grep -qE '^test result: ok\. [1-9][0-9]+ passed; 0 failed' "$RUNNER_TEMP/qec.log" || { echo "::error::the error-correction tests did not pass"; exit 1; } for t in quantum_color::tests::every_error_below_half_the_distance_is_corrected \ quantum_color::tests::matching_alone_misses_some_correctable_errors \ quantum_color::tests::the_triangular_codes_are_colour_codes \ quantum_color::tests::decoding_is_deterministic_and_distance_helps \ quantum_color::tests::the_empty_syndrome_needs_no_correction \ quantum_distance::tests::the_search_agrees_with_brute_force \ quantum_distance::tests::the_codes_have_their_distances \ quantum_distance::tests::bivariate_bicycle_codes_have_their_distances \ quantum_distance::tests::the_lightest_explanation_is_never_heavier_than_the_error \ quantum_distance::tests::the_symmetric_search_agrees_with_brute_force_on_a_bivariate_bicycle_code \ quantum_distance::tests::a_tampered_certificate_or_symmetry_is_refused \ quantum_qec_text::tests::every_target_kind_and_a_tag_round_trip \ quantum_qec_text::tests::any_layout_reads_to_its_rewritten_form \ quantum_qec_text::tests::what_does_not_read_is_refused_with_its_line \ quantum_qec_text::tests::a_model_unrolls_with_its_offsets_tags_and_parts \ quantum_qec_text::tests::blocks_nested_past_the_limit_are_refused_on_their_line \ quantum_qec_text::tests::an_empty_block_repeated_without_end_is_refused_not_run \ quantum_qec_text::tests::an_index_past_what_a_text_holds_is_refused_on_its_line \ quantum_window::tests::narrow_windows_correct_every_edge_set_below_half_the_distance \ quantum_window::tests::a_window_over_everything_is_the_batch_decoder \ quantum_window::tests::narrow_windows_track_the_batch_decoder \ quantum_window::tests::a_window_too_short_for_the_model_is_refused \ quantum_match::tests::matching_corrects_every_edge_set_below_half_the_distance \ quantum_match::tests::decomposed_faults_are_counted \ quantum_match::tests::the_matched_edges_explain_the_shot \ quantum_match::tests::correlated_matching_is_not_worse_on_the_same_shots \ quantum_frame::tests::a_pauli_target_is_flipped_by_what_anticommutes_with_it \ quantum_frame::tests::pauli_targets_agree_between_sampler_and_model \ quantum_frame::tests::tags_reach_the_model_and_its_text \ quantum_frame::tests::the_text_round_trips \ quantum_frame::tests::blocks_that_write_nothing_end_and_unrun_ones_are_checked_once \ quantum_frame::tests::a_pauli_channel_s_rates_have_its_law \ quantum_frame::tests::a_pauli_channel_samples_its_law \ quantum_frame::tests::the_cycling_gates_cycle_the_axes \ quantum_frame::tests::a_correlated_error_flips_its_targets_together \ quantum_frame::tests::a_pauli_channel_with_independent_rates_above_one_half_is_taken \ quantum_frame::tests::the_carrier_s_index_is_refused_in_text \ quantum_frame::tests::a_correlated_error_with_no_index_left_for_its_carrier_is_refused \ quantum_frame::tests::the_cycling_gates_take_no_arguments \ quantum_frame::tests::the_qec_page_and_conformance_set_name_these_forms \ quantum_frame::tests::the_reference_colour_code_has_the_reference_s_model \ quantum_frame::tests::a_rate_too_small_to_subtract_selects_nothing \ quantum_frame::tests::the_shortcut_past_a_batch_changes_no_bit \ quantum_frame::reference::tests::the_reference_run_is_the_state_vector_s \ quantum_frame::reference::tests::the_reference_run_is_the_forward_tableau_s \ quantum_frame::reference::tests::sampled_records_follow_the_circuit_s_law \ quantum_frame::reference::tests::noise_and_inversion_reach_the_record \ quantum_frame::reference::tests::the_records_parities_are_the_detection_events \ quantum_frame::reference::tests::a_wide_circuit_s_reference_is_found \ quantum_cultivate::tests::the_codes_are_the_colour_codes \ quantum_cultivate::tests::the_clifford_form_s_detectors_are_determined_and_quiet \ quantum_cultivate::tests::the_fewest_unseen_faults_are_counted \ quantum_cultivate::tests::the_search_finds_the_lightest_unseen_logical \ quantum_cultivate::tests::the_qasm_holds_every_step \ quantum_cultivate::tests::without_a_fault_the_state_is_the_encoded_t_state \ quantum_cultivate::tests::a_check_refuses_or_repairs_a_wrong_state \ quantum_cultivate::tests::no_single_fault_fools_the_circuit \ quantum_cultivate::tests::no_two_faults_fool_the_circuit \ engine::mitigate::tests::pauli_channels_round_trip_through_rates_and_fidelities \ engine::mitigate::tests::the_twirled_circuit_is_the_job_where_the_noise_is_pauli \ engine::mitigate::tests::the_exact_inverse_undoes_the_noise \ engine::mitigate::tests::each_method_reduces_the_bias_and_states_its_error \ engine::mitigate::tests::the_trace_with_a_pauli_is_the_expectation \ engine::mitigate::tests::readout_inversion_recovers_the_distribution \ engine::mitigate::tests::a_job_carries_its_mitigation_and_its_refusals_name_their_code \ engine::mitigate::tests::refusals_say_why \ engine::qec::tests::every_family_reads_and_certifies_its_distance \ engine::qec::tests::a_time_holds_the_shots_sampled_and_decoded \ engine::qec::tests::a_time_is_measured_apart_from_setup_and_holds_every_threshold \ engine::qec::tests::a_circuit_s_pilot_runs_for_its_floor_within_its_shots \ engine::qec::tests::each_decoder_corrects_every_single_error \ engine::qec::tests::circuit_level_decoding_reads_every_model_form \ engine::qec::tests::a_threshold_is_measured_and_distance_helps_below_it \ engine::qec::tests::an_answer_is_sealed_and_a_changed_one_does_not_verify \ engine::compile::tests::twirling_and_decoupling_keep_the_program \ engine::compile::tests::every_frame_is_carried_through_its_gate \ quantum_noisy::tests::steps_reproduce_the_evolution; do grep -q "^test $t \.\.\. ok$" "$RUNNER_TEMP/qec.log" || { echo "::error::$t did not run and pass"; exit 1; } done - name: The circuit and model texts against their conformance vectors shell: bash working-directory: wai/wai-quantum run: | set -euo pipefail cargo test --locked --release --features full --test qec_text_conformance 2>&1 | tee "$RUNNER_TEMP/text.log" grep -q '^test the_conformance_set_holds \.\.\. ok$' "$RUNNER_TEMP/text.log" || { echo "::error::the conformance vectors did not run and hold"; exit 1; } # Without warnings: a feature gate that leaves code unreachable or a # value unused in one feature set shows here. - name: Each feature set the hosts build still builds, without warnings shell: bash working-directory: wai/wai-quantum env: RUSTFLAGS: -D warnings run: | set -euo pipefail cargo check --locked --no-default-features --features quantum_engine --lib cargo check --locked --no-default-features --features quantum_qec --lib cargo check --locked --no-default-features --features quantum_engine,quantum_receipt,quantum_qec,quantum_noise --lib