fix: Fix estimate, usage, and job-response parsing against the live v0.4 API - #93
Merged
Conversation
antalszava
marked this pull request as ready for review
August 19, 2026 22:22
hodgestar-ionq
left a comment
Contributor
There was a problem hiding this comment.
Left some questions and comments. Thank you for all the fixes.
Co-authored-by: Simon Cross <simon.cross@ionq.co>
Contributor
Author
|
@hodgestar-ionq thank you for the questions! I've left answers to each. |
antalszava
force-pushed
the
fix_estimate_and_org_usage_schema
branch
2 times, most recently
from
August 31, 2026 11:45
0944ecf to
4950af2
Compare
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.
Fixes three runtime failures against the live v0.4 API —
estimate_job_cost,get_usages, andget_jobparsing — by patching stale/incorrect schemas inopenapi-overlay.yamland regenerating the client. Also unblocks committing generated output (pre-commit was rewriting it) and fixes a pytest deprecation in the integration tests.Hand-written changes
Library
ionq_core/polling.py— the spec'sGetJobResponsecomponent became ananyOfunion, so the generator no longer emits a model class for it; replaced the dead import with aTYPE_CHECKING-only union alias over the four job types.Spec overlay (
openapi-overlay.yaml)GetJobEstimateResponsereplaced with the shape the API actually serves (estimate_context/rate_card/estimated_total_cost/estimated_unit) — was raisingKeyError: 'input_values'.organization_idno longerformat: uuid— real org ids are reverse-DNS strings; was raisingbadly formed hexadecimal UUID string.Usage.fromwideneddate→date-time— the API returns RFC 3339 date-times; was raisingInvalid isoformat string.ErrorMitigationOutput.debiasingwidened toanyOfboolean/object — the API servesfalsewhen debiasing is off; was surfacing as a misleadingUnexpected value 'ionq.circuit.v1'from theGetJobResponseunion parser.Tooling
.pre-commit-config.yaml— excluded generated files fromtrailing-whitespace/end-of-file-fixer; they were rewriting generator output at commit time and breaking thegenerated.ymlbyte-exact staleness check.CHANGELOG.md— "Fixed" entries for the estimate, org-id, andUsage.frombugs.Integration tests
conftest.py— new session-scopedbase_urlfixture (readsIONQ_API_URL, falls back to the default).test_async.py/test_backends.py— fixtures threadbase_urlthrough instead of hardcoding it.test_usage.py— neworg_idfixture (readsIONQ_ORG_ID, skips when unset); used instead of the literal"self".test_simulator_job.py—completed_job_idmoved from a class-scoped instance-method fixture to a module-level session fixture, fixingPytestRemovedIn10Warning: Class-scoped fixture defined as instance method is deprecated.test_sessions.py— accepts"created"as a valid initial session status.Generated changes
Everything under
ionq_core/api/andionq_core/models/(105 files: ~50 new models from the May-2026 upstream spec sync — theSingleCircuitJob/MultiCircuitJob/QaoaJob/QuantumFunctionJobfamilies, result formats, artifact descriptors, the newmove_jobandschemasendpoints — plus modifications from the overlay fixes above). Mechanicalopenapi-python-clientoutput; thegenerated.ymlstaleness check reproduces it byte-for-byte, so it doesn't need line-by-line review.openapi.jsonis the vendored upstream spec (1-line change).Testing
test_sessionsfailures (sessions not enabled for project, an account limitation).Note on AI usage