Upgrade ruff to 0.16.7 and ty to 0.0.80 - #126
Merged
Merged
Conversation
Fix the two new ty redundant-condition diagnostics by addressing their root cause instead of suppressing them: widen known_lazy's type to match its documented None-value contract, and drop a truthiness check on a tuple that return_insert_columns() never returns as falsy. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ph4bQpiQJVJZx9cRkjBPAC
davegaeddert
marked this pull request as ready for review
September 14, 2026 15:08
Contributor
|
Next steps:
|
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.
Summary
ruff0.16.6 → 0.16.7 andty0.0.78 → 0.0.80, refreshinguv.locktylower bound inpyproject.tomlto>=0.0.80(ruff stayed within its existing>=0.16.2,<0.17constraint inplain-code/pyproject.toml, so no change was needed there)redundant-conditiondiagnostics ty 0.0.80 surfaced by addressing their root cause rather than suppressing them:plain-postgres/plain/postgres/preflight/models.py:known_lazyis documented to support mapping a key toNone("no error will be produced"), but its only current entry (field_error) made ty infer a non-Optionalvalue type, so it flagged the laterif error_fn else Nonecheck as always-truthy. Added an explicitdict[tuple[str, str], Callable[..., PreflightResult] | None]annotation to match the documented contract instead of silencing the check — this keeps the type checker validating a futureNoneentry correctly.plain-postgres/plain/postgres/sql/compiler.py:return_insert_columns()always returns a 2-tuple(str, tuple[Any, ...]), neverNone, so the outerif returning_cols:around it was genuinely dead (a non-empty tuple is always truthy) — the real "is it empty" check is the innerif r_sql:on the string. Removed the redundant outer check and reworded the now-inaccurate comment above it.Checked both changelogs for anything else actionable:
RUF077,RUF039/RUF055re.prefixmatchrecognition), bug fixes (format-spec quote handling,ISC003unsafe-fix gating,TID254multi-member import fix,D211/D203messaging), no new stable-default rules fired against this codebaseredundant-condition) diagnostics (the two fixed above),--force-excludefix, metaclass/classmethod/tuple-variance/narrowing correctness fixes, Python 3.15 support declared — nothing else applicable hereVerification
uv run ruff check ./uv run ruff format --check .— clean, no new findingsuv run ty check .— clean after the two fixes aboveuv run plain-code check . --skip-oxc— ruff, ty, and annotation checks all pass (oxc binary download is blocked in this sandbox by an unrelated network-egress restriction — same limitation noted in Fix: oxlint/oxfmt binaries are fetched from github.com, unlike ruff/ty which resolve via PyPI #125)./scripts/test(all packages) and./scripts/test plain-postgres --server— all pass, including the affectedplain-postgrespackageTest plan
uv run ruff check .uv run ruff format --check .uv run ty check .uv run plain-code check . --skip-oxc./scripts/test(full workspace)./scripts/test plain-postgres --server🤖 Generated with Claude Code
https://claude.ai/code/session_01Ph4bQpiQJVJZx9cRkjBPAC
Generated by Claude Code