fix(sdk-generator): emit ruff-clean Python for SSE streams (UP028/UP007/E712) - #51
Merged
Merged
Conversation
…07/E712) The Python auto-regen failed `ruff check` on three patterns ruff can't auto-fix (unsafe / no fix), so they survived the regen's `ruff --fix`: - UP028: the sync stream() used `for event in stream_sse_sync(...): yield event` -> emit `yield from ...`. - UP007: the SSE event union was `Union[A, B, ...]` -> emit `A | B | ...`. - E712: the channel contract test asserted `== True`/`== False` -> emit `is True`/`is False`. (Optional[X] field annotations are intentionally left for ruff's pyupgrade to rewrite, per the existing design — unchanged here.) Verified: regenerating the Python SDK + contract tests and running the regen's ruff sequence now passes clean. Generator suite 300. Co-Authored-By: Claude Opus 4.8 (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.
What changed
The archastro-python auto-regenerate PR fails
ruff checkon three generated patterns that ruff can't auto-fix (unsafe fixes / no fix), so they survive the regen'sruff --fixand break CI:stream()for event in stream_sse_sync(...): yield eventyield from stream_sse_sync(...)Union[A, B, …]A | B | …== True/== Falseis True/is FalseOptional[X]field annotations are intentionally left for ruff's pyupgrade to rewrite (the existing design — see the test comment) and are unchanged.Scope / risk
Generator-only (Python + Python-contract-test emitters). No runtime behavior change —
yield fromis equivalent to the delegating loop; the union/annotation changes are type-equivalent;is Trueis the lint-clean form of the same assertion.Testing
Union[).ruff check --fix+ruff format+ruff check) against archastro-python's config → All checks passed.Follow-up
Needs a generator republish for the archastro-python auto-regen (PR #30) to pick it up; re-running the regenerate workflow after that produces ruff-clean output.