Repository navigation
ci: add spec drift check script and workflow - #111
Merged
Merged
Conversation
- Add scripts/spec_drift.py. It anchors SDK request/response types to endpoints discovered from the resource modules, normalizes both the OpenAPI spec and the SDK types into one shape model, and compares properties, types, enum values, and required-ness structurally. - Replace the sdksync-based spec-drift workflow with one that runs the script on pull requests and writes the report to the job summary. - Document the script in CONTRIBUTING.md.
The spec has one URL and no version history, so the pin records the info.version the SDK was last synced against. spec_drift.py reports a differing live version as 'version' drift and --update-pin writes the new version once no structural drift remains. CI ignores the version kind (it bumps on every backend deploy) and prints the gap as a notice.
Replaces the version pin. spec/openapi.json is a committed copy of the public spec; the PR check runs against it, so it is reproducible and an upstream change cannot fail an unrelated PR. A scheduled spec-snapshot workflow refreshes the file and opens a PR when the live spec changed.
hewliyang
force-pushed
the
hly/chore/spec-drift
branch
from
September 8, 2026 20:34
dc67424 to
0bcd768
Compare
kirthi20
approved these changes
Sep 8, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #110.
Summary
Adds
scripts/spec_drift.py, a structural comparison between the SDK types and https://reducto.ai/openapi.json, and a workflow that runs it on pull requests.How it works
Schema names in the spec do not match SDK type names, so nothing is matched by name.
src/reducto/resources/*.pyand_client.pywithastand finds eachself._post("/path", body=maybe_transform(..., ParamsType), cast_to=ResponseType, query=...). New spec endpoints with no SDK method are reported too.$ref,anyOf/oneOf/allOf,const,format: binary. SDK: runtime introspection of TypedDicts and pydantic models, honoringRequired[],PropertyInfo(alias=...),Literal,Optional,Iterable,SequenceNotStr,FileTypes.Noise controls: response
requireddrift is skipped when the spec field is nullable (SDK models those asOptional = None); each (spec schema, SDK class) pair is compared once, in spec path order;/uploadmerges body and query since one params type feeds both.Spec snapshot
spec/openapi.jsonis a committed copy of the public spec. The PR check runs against it, so it is reproducible, needs no network, and an upstream API change cannot turn an unrelated PR red.Workflows
.github/workflows/spec-drift.ymlreplacessdksyncfromreductoai/sdk-utils. It runs the script against the snapshot on PR open, reopen, and push. The full report goes to the job summary. The job fails when drift is found.uv run python scripts/spec_drift.py --update-snapshot, sync the SDK, commit both together.Usage
Current result against the snapshot (v1.12.12-114)
57 drift items: endpoint=2, enum=4, extra=1, missing=50. Highlights: missingDELETE /job/{job_id}andDELETE /upload/{file_id}; parse settingsembed_pdf_metadata_dpi,extract_document_properties,hybrid_vpc,tenant_throttling,TableAgentic.mode; extractqueue_priority,citations.parent_block; splitdeep_split,auto_partition; classifycategory_groups,model;queue_priorityenum lacksstandard;response_typediscriminator missing on every response model.Because of this, the check will be red on this PR until #113 (the SDK sync) lands on top. If you prefer a soft check in the meantime, change the run step to
--warn-only.Verification
./scripts/lintand./scripts/testpassNeed help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.