Skip to content

chore(09-08-2026): update schemas - #113

Merged
hewliyang merged 4 commits into
hly/chore/spec-driftfrom
hly/chore/spec-sync
Sep 8, 2026
Merged

hewliyang merged 4 commits into
hly/chore/spec-driftfrom
hly/chore/spec-sync

Conversation

@hewliyang

@hewliyang hewliyang commented Sep 8, 2026 •

Copy link
Copy Markdown
Member

Stacked on #111 (which is stacked on #110). Merge those first; this PR retargets automatically.

Summary

Brings src/reducto/ in line with the live spec at https://reducto.ai/openapi.json. After this change, scripts/spec_drift.py reports no drift across 19 endpoints (was 57 items). The spec-drift CI check from #111 goes green.

Request types

Area Added
parse enhance.advanced_chart_agent, TableAgentic.mode, spreadsheet.max_cell_count, settings.embed_pdf_metadata_dpi, settings.extract_document_properties, settings.hybrid_vpc, settings.tenant_throttling
extract settings.force_url_result, settings.page_range, citations.parent_block, top-level queue_priority (async config + run_job)
split settings.allow_page_overlap, auto_partition, deep_split, force_url_result
classify category_groups, force_url_result, model, priority; removed persist_results (dropped from the spec)
all queue_priority enum now includes standard
upload file also accepts a plain string

Response types

  • response_type discriminator on every response model.
  • Usage: ParseUsage.usage_breakdown, page_billing_breakdown, non_empty_cell_count; ExtractUsage.usage_breakdown; new classify usage model.
  • ParseResponse.document_properties, block-level merged_tables.
  • V3Extract.confidence / confidence_reason; ExtractResponse.response_confidence; result/citations may be a URLResult.
  • SplitResponse and ClassifyResponse gain URLResult results, duration, job_id; ClassifyResponse.extra_metadata.
  • Job responses: error: ErrorDetail (with the full ErrorCode enum), ChartResponse in the result union, type gains Chart.

New shared types: URLResult, ErrorDetail, ErrorCode, ChartResponse, DocumentProperties.

New endpoints

  • client.job.delete(job_id, include_persisted=...) → DELETE /job/{job_id}
  • client.delete_upload(file_id) → DELETE /upload/{file_id}

Breaking change

client.classify.run(persist_results=...) no longer exists. The API removed the field.

E2E tests

tests/e2e/test_spec_sync_e2e.py runs 19 tests against the live API (about 30s): every new request param is sent, every new response field is checked, and both DELETE endpoints are exercised, including the 410 after job deletion and the 404 after upload deletion.

Verification

  • REDUCTO_API_KEY=... uv run pytest tests/e2e/test_spec_sync_e2e.py -o addopts=: 19 passed

  • ./scripts/lint: clean (ruff, pyright strict, mypy)

  • ./scripts/test: 455 passed (Pydantic v2), 452 passed (Pydantic v1)

  • uv run python scripts/spec_drift.py: Checked 19 sdk endpoints. No drift found.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

@hewliyang hewliyang changed the title feat: sync SDK types and endpoints with the live OpenAPI spec chore: update schemas Sep 8, 2026
@hewliyang
hewliyang force-pushed the hly/chore/spec-sync branch 2 times, most recently from ff95600 to 7b562f9 Compare September 8, 2026 20:31
Request side:
- parse: enhance.advanced_chart_agent, table agentic mode, spreadsheet.max_cell_count,
  settings.{embed_pdf_metadata_dpi, extract_document_properties, hybrid_vpc, tenant_throttling}
- extract: settings.{force_url_result, page_range}, citations.parent_block, queue_priority
- split: allow_page_overlap, auto_partition, deep_split, force_url_result
- classify: category_groups, force_url_result, model, priority; drop persist_results
- queue_priority enum gains 'standard'
- upload: file may also be a plain string

Response side:
- response_type discriminator on every response model
- usage breakdowns (parse/split/edit/extract/classify), page_billing_breakdown,
  non_empty_cell_count, document_properties, merged_tables
- V3Extract confidence fields; ExtractResponse response_confidence and URL results
- SplitResponse/ClassifyResponse URL results, duration, job_id
- job responses carry error (ErrorDetail/ErrorCode) and ChartResponse results; type gains 'Chart'

Endpoints:
- client.job.delete(job_id, include_persisted=...) -> JobDeleteResponse
- client.delete_upload(file_id) -> ClientDeleteUploadResponse

scripts/spec_drift.py now reports no drift against https://reducto.ai/openapi.json.
@hewliyang hewliyang changed the title chore: update schemas chore(09/08/2026): update schemas Sep 8, 2026
@hewliyang hewliyang changed the title chore(09/08/2026): update schemas chore(09-08-2026): update schemas Sep 8, 2026
The API returns ExtractResponse (response_type 'extract') from POST /extract
for accounts not on V3 extract, though the spec lists only V3ExtractResponse.
With response_type modelled as Optional[Literal], that payload failed the
V3Extract literal and pydantic fell through to AsyncExtractResponse.

- response_type is now a required Literal on every response model; the spec
  gives it a server default so it is always present
- ExtractRunResponse, ParseRunResponse and the job result unions carry
  PropertyInfo(discriminator='response_type'); ExtractRunResponse includes
  ExtractResponse
- spec_drift.py: a response field with a spec default may be required in
  the sdk; spec/drift-allowlist.json records intentional deviations with a
  reason and the script flags stale entries
- e2e tests accept either sync extract response class
…parallel

- one e2e file, grouped by endpoint; shared responses are module-scoped
  fixtures (pytest 9 rejects class-scoped fixtures on instance methods)
- e2e workflow runs pytest-xdist with --dist loadscope: ~27s -> ~11s
@hewliyang
hewliyang merged commit 97609ac into main Sep 8, 2026
8 checks passed
@hewliyang hewliyang mentioned this pull request Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants