-
Notifications
You must be signed in to change notification settings - Fork 16
Simplify the hand-written layer and fix client contract bugs #97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: scan-findings/1-security
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -10,15 +10,15 @@ Instructions for AI agents working in this repository. Humans should read [`CONT | |||||
|
|
||||||
| ```sh | ||||||
| uv sync # canonical; uv.lock is committed and CI runs UV_FROZEN=true | ||||||
| pre-commit install | ||||||
| uvx pre-commit install | ||||||
| ``` | ||||||
|
|
||||||
| `uv` is required. Don't use `pip` / `poetry` for dev workflows — they bypass the lockfile. | ||||||
|
|
||||||
| ## Run | ||||||
|
|
||||||
| ```sh | ||||||
| uv run pytest # unit tests; 100% branch coverage gate on hand-written code | ||||||
| uv run pytest | ||||||
| uv run ruff check | ||||||
| uv run ruff format --check # drop --check to apply | ||||||
| uv run ty check ionq_core/ | ||||||
|
|
@@ -51,21 +51,7 @@ When you hit a bug in generated code: | |||||
|
|
||||||
| ## Regenerating the client | ||||||
|
|
||||||
| Run exactly what's in [`CONTRIBUTING.md`](CONTRIBUTING.md) and mirrored in [`.github/workflows/generated.yml`](.github/workflows/generated.yml): | ||||||
|
|
||||||
| ```sh | ||||||
| uv sync --group regen | ||||||
| # If v0.4 isn't found, search for the latest API version. | ||||||
| curl -sf https://api.ionq.co/v0.4/api-docs -o openapi.json | ||||||
| uv run oas-patch overlay openapi.json openapi-overlay.yaml -o /tmp/patched-spec.json | ||||||
| uv run openapi-python-client generate \ | ||||||
| --path /tmp/patched-spec.json --meta none \ | ||||||
| --config openapi-python-client-config.yaml \ | ||||||
| --custom-template-path custom-templates \ | ||||||
| --output-path ionq_core --overwrite | ||||||
| ``` | ||||||
|
|
||||||
| Commit regenerated files in the same PR as the spec/template/overlay change that produced them. | ||||||
| Run the block in [`CONTRIBUTING.md`](CONTRIBUTING.md#regenerating-the-client) verbatim; CI runs the same invocation via [`generated.yml`](.github/workflows/generated.yml) on every PR. The spec source is `https://api.ionq.co/v0.4/api-docs` (if that version 404s, search for the current one). Commit regenerated files in the same PR as the spec/template/overlay change that produced them. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. imho we can assume that if that URL changed we'd need to scan the wording of
Suggested change
|
||||||
|
|
||||||
| ## Calling generated endpoints | ||||||
|
|
||||||
|
|
@@ -104,7 +90,7 @@ Auth is `apiKey`, **not** `Bearer`. `IonQClient` sets `prefix="apiKey"`; the wir | |||||
|
|
||||||
| ## Drift sentinels — single edits that fan out | ||||||
|
|
||||||
| Several values are pinned in multiple files (Python floor, generator/overlay version pins, API base URL, the generated-path set, numeric defaults that appear in both code and docstrings). [`tests/test_docs_consistency.py`](tests/test_docs_consistency.py) is the canonical list of these alignments — when it fails, read the failing assertion to find the peers and update every one in the same PR. Treat that test file as the source of truth; it grows as new pinned values are added. | ||||||
| Several values are pinned in multiple files (Python floor, API base URL, the generated-path set, numeric defaults that appear in both code and docstrings). [`tests/test_docs_consistency.py`](tests/test_docs_consistency.py) is the canonical list of these alignments — when it fails, read the failing assertion to find the peers and update every one in the same PR. Treat that test file as the source of truth; it grows as new pinned values are added. | ||||||
|
|
||||||
| ## CI | ||||||
|
|
||||||
|
|
@@ -122,7 +108,7 @@ When authoring a new workflow, use the local [`.github/actions/setup-uv`](.githu | |||||
| - Branch off `main`. CODEOWNERS is `@ionq/developer-tools`. | ||||||
| - PR titles become release-notes lines (`gh release create --generate-notes`). Imperative mood, user-facing, no leading ticket number. | ||||||
| - User-visible changes go under `## [Unreleased]` in `CHANGELOG.md`, in [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. | ||||||
| - Release: bump `pyproject.toml` `[project] version`, promote `[Unreleased]` → `[X.Y.Z]` in `CHANGELOG.md`, tag `vX.Y.Z`. `release.yml` rejects mismatched tag/version pairs and refuses to republish an existing PyPI version. | ||||||
| - Release: bump `pyproject.toml` `[project] version`, promote `[Unreleased]` → `[X.Y.Z]` in `CHANGELOG.md`, tag `vX.Y.Z`. | ||||||
|
|
||||||
| ## Things to avoid (and what to do instead) | ||||||
|
|
||||||
|
|
@@ -131,7 +117,6 @@ When authoring a new workflow, use the local [`.github/actions/setup-uv`](.githu | |||||
| - **Adding a dependency with `pip install`** → `uv add <pkg>` (or edit `pyproject.toml` and `uv lock`). Confirm the dependency's license before adding: MIT, Apache-2.0, BSD-2-Clause, and BSD-3-Clause are pre-approved. | ||||||
| - **`Bearer` token examples / `requests` / `aiohttp`** in docs or tests → the library is `httpx`-only and the auth prefix is `apiKey`. | ||||||
| - **Dropping the SPDX header or `# @generated` marker** on regenerated files → if a post-hook regression made this happen, fix `openapi-python-client-config.yaml` rather than re-adding by hand. | ||||||
| - **Lowering the Python floor in one file** → run the local checks in the "Run" section; `tests/test_docs_consistency.py` will list every peer that needs updating in the same commit. | ||||||
| - **Adding NumPy or any new runtime dependency** to `gates.py` → keep it pure-Python. | ||||||
|
|
||||||
| ## Where to look first | ||||||
|
|
||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is
tests/test_docs_consistency.pybeing mentioned here? it feels like running tests intestsis separate from the spec drift checking CI action here.