fix: make orientation optional in async generate() - #174
Merged
Merged
Conversation
check_generate_create_sync.py only compared param names between generate() and create(), so when the SDK generator changed a param's type/default in create(), generate() kept the stale definition. The codemod now also flags drifted definitions and --fix copies them from create(). Client changes are the codemod's --fix output. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Problem
Async
text_to_video.generate()andai_image_generator.generate()requiredorientation. It's deprecated in favor ofaspect_ratio, and the syncgenerate()and bothcreate()methods already treat it as optional.Root cause
codemod/check_generate_create_sync.pycompared only param names betweengenerate()andcreate(). When the SDK generator madeorientationoptional increate()(#113, #114), the syncgenerate()got updated but the async one didn't. Since the name was still there, the check passed.The same gap left other
generate()params stale after later generator updates:For example,
generate(model="wan-3.0")orgenerate(model="krea-2")failed mypy even thoughcreate()accepts them.Fix
create()(whitespace and trailing commas are normalized).--fixreplaces the definition with the one fromcreate()and keeps its position.python codemod/check_generate_create_sync.py --fix. Nothing was hand-edited, and a second--fixrun produces no diff.--fix".aspect_ratio="16:9"instead oforientation.Verification
python codemod/check_generate_create_sync.py: no issuespytest: 167 passedmypy magic_hour: no issuesgenerate()withoutorientation: passes here, and fails onmainwithMissing named argument "orientation"(2 errors)🤖 Generated with Claude Code