Skip to content

feat(v2): align client.v2 with updated ADE spec (service_tier, billing)#106

Merged
yzld2002 merged 2 commits into
mainfrom
v2-service-tier-billing
Jul 9, 2026
Merged

feat(v2): align client.v2 with updated ADE spec (service_tier, billing)#106
yzld2002 merged 2 commits into
mainfrom
v2-service-tier-billing

Conversation

@yzld2002

@yzld2002 yzld2002 commented Jul 9, 2026

Copy link
Copy Markdown
Member

Summary

Aligns the (unreleased) client.v2 surface with the updated V2 AIDE Gateway OpenAPI spec. Three semantic differences were identified between the staging spec saved in #96 and the current dev spec; this PR applies all three.

Changes

1. priorityservice_tier (breaking rename, but safe)
The async job-create field is renamed on parse_jobs.create and extract_jobs.create (same enum standard/priority). Done as a hard rename with no deprecation alias: client.v2 was added in #105 after the v1.12.0 tag, so priority was never in a release.

2. billing added to extract response metadata
New V2ExtractBilling { service_tier, total_credits } model, added as billing on V2ExtractMetadata (mirrors the existing V2ParseBilling). Parse metadata already modeled billing.

3. 206 / 404 on GET /v2/parse/jobs/{job_id}
No code change — the base client already treats 206 as success (envelope normalizes normally) and raises NotFoundError on 404. Added regression tests to lock the behavior.

Docs updated for the rename: api.md, examples/v2_parse.py, docs/v2-testing.md.

Out of scope

The spec also has /v2/workflow endpoints, but the SDK has no workflow resource (it never did — not one of the three diffs). Left as a follow-up.

Test plan

  • TDD: updated/added tests first (red), then implemented (green)
  • New tests: service_tier reaches the wire body (parse + extract), extract billing parses, parse get handles 206, parse get raises NotFoundError on 404
  • ✅ Full suite: 580 passed, 240 skipped
  • mypy clean on changed files; ruff clean on touched trees

🤖 Generated with Claude Code

Applies the three semantic changes from the updated V2 (AIDE Gateway)
OpenAPI spec to the unreleased client.v2 surface:

- Rename the async job-create field `priority` -> `service_tier` on
  `parse_jobs.create` and `extract_jobs.create` (same enum
  standard/priority). Hard rename: client.v2 shipped after the v1.12.0
  tag, so `priority` was never released.
- Add `billing` ({service_tier, total_credits}) to the extract response
  metadata via a new `V2ExtractBilling` model, mirroring the existing
  `V2ParseBilling`.
- Document the `206`/`404` responses on `GET /v2/parse/jobs/{job_id}`.
  No code change: the base client already treats 206 as success and
  raises `NotFoundError` on 404; added regression tests to lock this.

Docs (api.md, examples, v2-testing) updated for the rename.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Copilot AI review requested due to automatic review settings July 9, 2026 02:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aligns the (unreleased) client.v2 SDK surface with updated V2 ADE gateway OpenAPI semantics by renaming the async job-create “priority” field to service_tier, modeling extract response billing metadata, and adding regression tests for parse job GET status handling.

Changes:

  • Renamed async job-create parameter/body key from priorityservice_tier for V2 parse and extract jobs.
  • Added V2ExtractBilling and exposed it via V2ExtractMetadata.billing (and exported it from landingai_ade.types.v2).
  • Added regression tests for parse job GET handling of HTTP 206 (success) and 404 (NotFoundError), plus wire-body assertions for service_tier.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/api_resources/v2/test_parse.py Updates tests for service_tier rename and adds regression coverage for 206/404 on parse job GET.
tests/api_resources/v2/test_extract.py Updates extract job create test for service_tier and adds coverage for parsing new extract metadata.billing.
src/landingai_ade/types/v2/extract_response.py Introduces V2ExtractBilling and adds billing to V2ExtractMetadata.
src/landingai_ade/types/v2/__init__.py Re-exports V2ExtractBilling from the public types.v2 package.
src/landingai_ade/resources/v2/parse.py Renames parse job-create parameter/body field to service_tier.
src/landingai_ade/resources/v2/extract.py Renames extract job-create parameter/body field to service_tier.
examples/v2_parse.py Updates example usage to service_tier.
api.md Updates API docs for service_tier rename and documents extract billing type nesting.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@yzld2002 yzld2002 added the breaking-change-approved Surface-lock override: a reviewed, intentional public-surface change label Jul 9, 2026
@yzld2002 yzld2002 merged commit 608860a into main Jul 9, 2026
5 checks passed
@yzld2002 yzld2002 deleted the v2-service-tier-billing branch July 9, 2026 05:23
yzld2002 added a commit that referenced this pull request Jul 13, 2026
…111)

A tech-writer review against aide surfaced SDK parameters that were
dropped from the API:

- Remove `markdown_ref` from `client.v2.extract` / `extract_jobs.create`
  (dropped in aide#951); extract now requires exactly one of `markdown`
  or `markdown_url`. Delete the README section documenting it.
- Remove `idempotency_key` from the same methods (dropped in aide#944).
- Fix the README jobs example to use `service_tier="priority"` — the
  code was already renamed from `priority` (aide#899) in #106, but the
  example still passed a nonexistent kwarg that raised TypeError.
- Reword `files.upload` docstrings/api.md to stop referencing the
  removed `markdown_ref` (`/v1/files` itself is still in the spec).

`password` on v2 parse is intentionally kept: it remains in the tracked
spec (specs/v2-aide.json) as a placeholder until PDF decryption ships
(aide#272, aide#390).

No released-surface break: client.v2 shipped after v1.12.0 (griffe
surface-lock clean). Full suite: 587 passed; ruff/mypy clean.

Co-authored-by: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change-approved Surface-lock override: a reviewed, intentional public-surface change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants