Commit e2968de
authored
Sync OpenAPI to May 2026 upstream and polish hand-written layer (#44)
* Polish hand-written layer: narrower except, design notes, drop pass-through
Internal cleanups; no behavior change visible from the public API.
- _transport.py: narrow JSON-decode `except Exception` to
`(ValueError, UnicodeDecodeError)` and parenthesise the
`message`/`error` truthy-fallback so operator precedence is obvious.
- ionq_client.py: document why `IonQClient` is a PascalCase factory
(so call sites read like construction) and why the async path
re-injects `Authorization` and reads private `_verify_ssl` /
`_follow_redirects` from the generated `AuthenticatedClient`.
- polling.py: drop the `job_id` pass-through to `_check_terminal`;
use `job.id` (identical here \u2014 we just fetched the job with that uuid).
- tests/test_polling.py: note that `_real_sleep = asyncio.sleep` is
captured at import so async tests can call the real sleep even after
monkeypatch shadows it.
- tests/integration/conftest.py: replace module-level `_job_ids` global
with a session-scoped `_tracked_jobs` fixture consumed by
`track_job` and `cleanup_jobs` via normal pytest DI.
* Regenerate client against May 15 2026 upstream spec
Refreshes openapi.json from https://api.ionq.co/v0.4/api-docs and
regenerates ionq_core/api/ + ionq_core/models/. Tracks the upstream
changes surfaced by the spec-drift workflow (issue #43); the bot's diff
in #43 was truncated at 60 KB and missed cost_model + the qubits
tightening on NativeCircuitInput/JsonMultiCircuitInput.
User-visible changes:
- New `QctrlQaoaJobCreationPayload` + `QctrlQaoaJobInput` models, plus
the inline schemas the generator synthesises (`*_external_settings`,
`*_settings`, `*_settings_error_mitigation`, `*_problem`, and the
literal-enum modules for `type` / `problem_type`). The `create_job`
body union now also accepts `QctrlQaoaJobCreationPayload`.
- New optional `cost_model: CostModel | Unset` field on `BaseJob`,
`GetCircuitJobResponse`, and `GetJobResponse`. `CostModel` is a
string literal enum: "quantum_compute_time" or "execution_time".
- `NativeCircuitInput.qubits` and `JsonMultiCircuitInput.qubits` go
from `float | Unset` to `int | Unset` to match upstream's tightening
to `format: int32, minimum: 1`. Callers that pass integer literals
(which is everyone) are unaffected.
Overlay simplification:
- Dropped the `QisCircuitInput.properties.qubits` type/format action
from openapi-overlay.yaml. Upstream adopted that fix in May 2026 (and
extended it to NativeCircuitInput and JsonMultiCircuitInput), so the
local patch is now a no-op. The two `required:` actions remain
load-bearing \u2014 upstream still treats `qubits` as optional on
QisCircuitInput, which fails the simulator preflight.
All gates pass: ruff check, ruff format --check, ty check, pytest
(242 passed, 100% branch coverage on hand-written code).
* Stop pre-commit from rewriting generated files
The previous regen commit failed `generated.yml` because pre-commit's
`trailing-whitespace` and `end-of-file-fixer` hooks rewrote the raw
output of `openapi-python-client` locally (stripping docstring trailing
spaces and collapsing double trailing newlines), but CI regenerates the
files fresh and gets back those same artifacts.
Two parts:
- Re-commit the raw regen output for the 11 affected files in
`ionq_core/api/` + `ionq_core/models/` so `git diff ionq_core/` is
empty on a fresh regen.
- Exclude generated paths (per `.gitattributes`) from the two
whitespace hooks in `.pre-commit-config.yaml` so a future regen PR
doesn't trip on the same thing.
* Drop the pre-commit-config exclude
The exclude was added in the previous commit to defend against a trap
that turns out not to exist in practice: the project's recommended
`pre-commit install` workflow has never been load-bearing here (no
historical regen PR has failed `staleness`, and the on-commit hook
strip would only fire for contributors who actually installed it), so
the structural guard is purely speculative. The regen-output
restoration in that commit was the load-bearing part; keep that, drop
this.1 parent 11edf32 commit e2968de
24 files changed
Lines changed: 842 additions & 34 deletions
File tree
- ionq_core
- api/default
- models
- tests
- integration
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
9 | 18 | | |
10 | 19 | | |
11 | 20 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
32 | 34 | | |
33 | | - | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
37 | 39 | | |
38 | 40 | | |
39 | 41 | | |
| |||
169 | 171 | | |
170 | 172 | | |
171 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
172 | 180 | | |
173 | 181 | | |
174 | 182 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments