spec-sync: track V2 spec drift#122
Conversation
There was a problem hiding this comment.
Pull request overview
Synchronizes the V2 OpenAPI snapshot and regenerated reference models with upstream contract drift.
Changes:
- Adds Ground APIs and standardized error responses.
- Updates extraction metadata, async delivery, and job contracts.
- Regenerates Pydantic reference models.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
specs/v2-aide.json |
Updates the V2 API specification snapshot. |
specs/_generated/v2_models.py |
Regenerates reference models from the updated specification. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| }, | ||
| "/v2/parse": { | ||
| "/v2/ground": { |
| "default": null, | ||
| "description": "Extraction options (``strict``). Omit for defaults." | ||
| }, | ||
| "output_save_url": { |
| "description": "Request metadata (job_id, model_version, duration_ms, doc_id, billing)." | ||
| }, | ||
| "output_ref": { | ||
| "schema_violation_error": { |
| "title": "Duration Ms", | ||
| "type": "integer" | ||
| }, | ||
| "input_markdown_chars": { |
| }, | ||
| "metadata": { | ||
| "$ref": "#/components/schemas/V2GroundMetadata", | ||
| "description": "Request metadata (job_id, duration_ms, credit_usage)." |
| }, | ||
| "metadata": { | ||
| "$ref": "#/components/schemas/V2GroundMetadata", | ||
| "description": "Request metadata (job_id, duration_ms, credit_usage)." |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (2)
specs/v2-aide.json:1971
- This description still advertises
credit_usage, butV2GroundMetadatanow containsopenapi_specandbillinginstead. Keep the inline result schema consistent so generated documentation does not expose a nonexistent metadata field.
"description": "Request metadata (job_id, duration_ms, credit_usage)."
specs/v2-aide.json:2354
- The ground-job result repeats the stale
credit_usagedescription even though the referencedV2GroundMetadataschema exposesopenapi_specandbilling. Correct this copy as well so the polling contract matches the synchronous contract.
"description": "Request metadata (job_id, duration_ms, credit_usage)."
| if is_given(output_save_url) and output_save_url is not None: | ||
| body["output_save_url"] = output_save_url |
| cast_to=V2GroundResult, | ||
| ) | ||
| except APIStatusError as exc: | ||
| raise_if_sync_timeout(exc) |
| class AsyncGroundResource(V2ResourceMixin, AsyncAPIResource): | ||
| async def run( |
| # Deprecated: renamed to `schema_violation_error` upstream; retained for | ||
| # backward compatibility and populated only by older gateway responses. |
| (`V2ExtractMetadata`): `job_id`, `model_version`, `duration_ms`, `doc_id`, | ||
| `credit_usage`, `range_units`, `openapi_spec`, and `billing` (`V2ExtractBilling` | ||
| with `input_markdown_chars` / `output_extraction_chars`). | ||
| `output_ref` (deprecated; renamed to `schema_violation_error` upstream), |
pyright reportUnnecessaryIsInstance: after the BaseModel branch returns, `value` is narrowed to `Mapping[str, object]`, so `isinstance(value, Mapping)` is always true. Return `dict(value)` directly; malformed runtime input still raises from `dict()`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 16 out of 16 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (4)
src/landingai_ade/types/v2/extract_response.py:54
output_refwas not renamed toschema_violation_error: the former represented out-of-band output, while the latter reports a partial extraction caused by unsupported schema fields. Describing this as a rename gives callers the wrong migration guidance; document it as a removed legacy field instead.
# Deprecated: renamed to `schema_violation_error` upstream; retained for
# backward compatibility and populated only by older gateway responses.
docs/v2-testing.md:57
- This repeats the incorrect claim that
output_refwas renamed.output_refrepresented out-of-band output;schema_violation_erroris an unrelated partial-extraction diagnostic. Please describeoutput_refas a removed legacy field instead.
`output_ref` (deprecated; renamed to `schema_violation_error` upstream),
src/landingai_ade/resources/v2/ground.py:103
- The new async ground surface is untested: the added tests exercise only
LandingAIADE, while comparable parse/extract resources have mockedAsyncLandingAIADEcoverage intests/api_resources/v2/test_async_smoke.py. Add async tests for the sync-style call and ground-job create/get/list/wait paths so await/routing/polling regressions are covered.
class AsyncGroundResource(V2ResourceMixin, AsyncAPIResource):
src/landingai_ade/resources/v2/ground.py:33
- The synced
/v2/ground/jobsrequest schema only definesextraction_metadataandstructure(specs/v2-aide.json:2144-2174), and its completed-job schema has nooutput_url. Exposingoutput_save_urlcan therefore result in an ignored field or 422 instead of the promised out-of-band delivery. Remove this option from the helper/public ground-job APIs and docs, or first add it to the upstream contract and implementation.
output_save_url: object = omit,
| @@ -95,8 +98,9 @@ from landingai_ade.types.v2 import ( | |||
|
|
|||
| - <code><a href="./src/landingai_ade/types/v2/job.py">Job</a></code> -- unified job shape: `job_id`, `status` (<code><a href="./src/landingai_ade/types/v2/job.py">JobStatus</a></code>: `pending` / `processing` / `completed` / `failed` / `cancelled`), `created_at`, `completed_at`, `progress`, `result` (a `V2ParseResponse` for parse jobs, a `V2ExtractResult` for extract jobs, or `None` until completion), `error` (<code><a href="./src/landingai_ade/types/v2/job.py">JobError</a></code>), `raw` (the full original envelope as a `dict`), and the `.is_terminal` property. | |||
| markdown_url: Optional[str] | Omit = omit, | ||
| model: Optional[str] | Omit = omit, | ||
| strict: Optional[bool] | Omit = omit, | ||
| output_save_url: Optional[str] | Omit = omit, |
Automated V2 spec-sync PR (
client.v2).Gates (surface-lock, V2 contract tests, lint/test/typecheck) must pass. When present, the AI commit is a draft a human finishes (the V2 ergonomic layer — unified Job, dual-host, schema coercion — is not in the spec). Human review required before merge.