Fix integration Bell circuit fixture so simulator preflight accepts it#33
Merged
Fix integration Bell circuit fixture so simulator preflight accepts it#33
Conversation
The QIS circuit input was missing `qubits`, which preflight requires to construct the cypress circuit; without it the parser hits an unguarded IndexError that surfaces to the customer as a generic UnexpectedCompilationError. Switching the cnot to plural targets/controls matches the documented form in the rest of the fixture. Verified by submitting Bell circuits with this exact payload to the simulator and observing successful completion.
The upstream spec marks QisCircuitInput.qubits as optional and floating-point, but the simulator preflight rejects payloads without it and qubit counts are non-negative integers. Add an openapi-overlay.yaml that the existing codegen workflow already knows how to apply, making qubits required and integer-typed at the SDK level so this class of mistake fails at construction rather than after a 120s wait. Regenerate ionq_core/models/qis_circuit_input.py and update the README example and unit-test stub to match the tightened contract.
guenp
previously requested changes
Apr 30, 2026
Verified end-to-end against the simulator that singular target/control round-trips identically to the plural form once `qubits` is set, so prefer the more concise singular form in the docs and tests.
Collaborator
Author
|
The spec.openapis.org/overlay/v1.0.0 says the array "MUST contain at least one value.", so this openapi-overlay.yaml file will come and go. |
guenp
approved these changes
May 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two related fixes for the same root cause: the upstream OpenAPI spec marks
QisCircuitInput.qubitsas optional and floating-point, but the simulator preflight (qp-circuit-service) requires it and qubit counts are integers. Withoutqubits, the preflight hits an unguardedIndexErrorthat surfaces to the client as a genericUnexpectedCompilationErroronly after the test polls for120s, masking the root cause aslast status: submitted.Fixture fix (
tests/integration/test_simulator_job.py)Adds
qubits: 2to theBELL_CIRCUITfixture and switches to the singulartarget/controlform (verified end-to-end against the simulator that it round-trips identically to the plural form).OpenAPI overlay (
openapi-overlay.yaml)Codifies the same
qubitsrequirement at the SDK level so this class of mistake fails at construction rather than after a 120s wait. Updates the README example and unit-test stub to match.What
openapi-overlay.yamlisA patch file in the OpenAPI Overlay 1.0 format. It declares JSONPath-targeted edits to apply to
openapi.jsonbefore client generation - here it removes the upstreamrequiredarray onQisCircuitInput, replaces it with[circuit, gateset, qubits], and retypesqubitsasinteger/int32.How it works
The codegen pipeline (documented in
CONTRIBUTING.mdand enforced by.github/workflows/generated.yml) conditionally applies the overlay if the file is present:The
Generated code checkworkflow runs the same invocation on every PR and fails ifionq_core/drifts from the patched spec. Spec drift against upstream is checked weekly byspec-drift.yml.Why it's here (vs. fixing upstream)
The upstream spec is the source of truth for API-surface changes, but the overlay is the right home for SDK-level corrections that:
qubitsbeing required).qubitsbeing integer-valued, not float).Each overlay action carries a reason in the file's
info.descriptionso future maintainers know why it exists and can drop it once upstream catches up.Test plan
completed(vs.UnexpectedCompilationErrorwith the previous fixture).ionq_core/with the overlay applied;qubitsis now a requiredintonQisCircuitInput(constructing without it is aTypeErrorat the SDK boundary).uv run pytest); theGenerated code checkworkflow on this PR confirms generator output matches the committed files.test_submit_and_poll,TestCompletedJobEndpoints::*, andtest_async_*to pass.Important
Most code in
ionq_core/is auto-generated and overwritten on regeneration.See CONTRIBUTING.md for which files are safe to edit.