Skip to content

Upgrade ruff to 0.16.7 and ty to 0.0.80 - #126

Merged
davegaeddert merged 1 commit into
masterfrom
claude/funny-maxwell-rqfejl
Sep 14, 2026
Merged

davegaeddert merged 1 commit into
masterfrom
claude/funny-maxwell-rqfejl

Conversation

@davegaeddert

Copy link
Copy Markdown
Member

Summary

  • Bump ruff 0.16.6 → 0.16.7 and ty 0.0.78 → 0.0.80, refreshing uv.lock
  • Raise the ty lower bound in pyproject.toml to >=0.0.80 (ruff stayed within its existing >=0.16.2,<0.17 constraint in plain-code/pyproject.toml, so no change was needed there)
  • Fixed the two new redundant-condition diagnostics ty 0.0.80 surfaced by addressing their root cause rather than suppressing them:
    • plain-postgres/plain/postgres/preflight/models.py: known_lazy is documented to support mapping a key to None ("no error will be produced"), but its only current entry (field_error) made ty infer a non-Optional value type, so it flagged the later if error_fn else None check as always-truthy. Added an explicit dict[tuple[str, str], Callable[..., PreflightResult] | None] annotation to match the documented contract instead of silencing the check — this keeps the type checker validating a future None entry correctly.
    • plain-postgres/plain/postgres/sql/compiler.py: return_insert_columns() always returns a 2-tuple (str, tuple[Any, ...]), never None, so the outer if returning_cols: around it was genuinely dead (a non-empty tuple is always truthy) — the real "is it empty" check is the inner if 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:

  • ruff 0.16.7: preview rule tweaks (new RUF077, RUF039/RUF055 re.prefixmatch recognition), bug fixes (format-spec quote handling, ISC003 unsafe-fix gating, TID254 multi-member import fix, D211/D203 messaging), no new stable-default rules fired against this codebase
  • ty 0.0.79–0.0.80: new always-truthy/always-falsy (redundant-condition) diagnostics (the two fixed above), --force-exclude fix, metaclass/classmethod/tuple-variance/narrowing correctness fixes, Python 3.15 support declared — nothing else applicable here

Verification

  • uv run ruff check . / uv run ruff format --check . — clean, no new findings
  • uv run ty check . — clean after the two fixes above
  • uv 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 affected plain-postgres package

Test 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

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
davegaeddert marked this pull request as ready for review September 14, 2026 15:08
@pullapprove5

pullapprove5 Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor
PASS: 1 review scope passed
Scope Progress
code 1/1

View in PullApprove

Next steps:

@davegaeddert
davegaeddert merged commit d28b466 into master Sep 14, 2026
9 checks passed
@davegaeddert
davegaeddert deleted the claude/funny-maxwell-rqfejl branch September 14, 2026 15:08
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