Skip to content

Upgrade ty to 0.0.63 and fix new MRO-based method-override diagnostics - #93

Merged
davegaeddert merged 1 commit into
masterfrom
claude/great-cannon-f483c8
Jul 28, 2026
Merged

Upgrade ty to 0.0.63 and fix new MRO-based method-override diagnostics#93
davegaeddert merged 1 commit into
masterfrom
claude/great-cannon-f483c8

Conversation

@davegaeddert

Copy link
Copy Markdown
Member

Summary

  • Bump ty from 0.0.61 to 0.0.63 (see 0.0.62 and 0.0.63 changelogs).
  • ty 0.0.62 added MRO-based checking for inherited method conflicts, which surfaced 51 new invalid-method-override diagnostics in plain-postgres and 6 in plain-email.
  • plain-postgres: fixed the actual signature mismatches in the shared base classes instead of suppressing per subclass:
    • RegisterLookupMixin.get_lookup/get_transform (query_utils.py) and BaseExpression.get_lookup/get_transform (expressions.py) had mismatched parameter names (lookup_name vs lookup/name) — renamed to match.
    • RegisterLookupMixin.get_transform's declared return type included Callable[..., Any] even though its own body could never return a bare callable — narrowed to type[Transform] | None, then further corrected (along with BaseExpression.get_transform, EncryptedFieldMixin.get_transform, and JSONField.get_transform) to Callable[..., Transform] | None, since JSONField.get_transform genuinely returns a KeyTransformFactory instance alongside Transform subclasses. This also let a pre-existing # ty: ignore[invalid-return-type] in expressions.py be removed, since the types now agree.
    • Lookup.resolve_expression was declared to return the concrete Lookup type instead of Self, which conflicted with BaseExpression.resolve_expression -> Self. Its body already returns a copy of self, so Self is the accurate annotation.
    • Fixing the root base classes cascaded the fix to every subclass in the MRO (math/text/datetime functions, Exact, GreaterThan, DataContains, etc.) — no new ignores were needed for plain-postgres.
    • Also renamed ForeignObjectRel.get_lookup's parameter for naming consistency with the rest of the package (flagged in review; this one isn't part of the affected MRO chain, so it wasn't required by ty, but keeps the convention consistent).
  • plain-email: added # ty: ignore[invalid-method-override] on the three SafeMIME* classes, consistent with the existing ignore already used on set_payload in the same file — MIMEMixin intentionally diverges from stdlib email.message.Message's as_bytes/as_string signature (linesep param instead of policy) to avoid mangling From lines, which can't be reconciled without changing behavior.

Test plan

  • ./scripts/type-check . (repo-wide ty check) passes with zero diagnostics
  • ./scripts/test plain-postgres — 754 passed, 1 skipped
  • ./scripts/test plain-email — 13 passed
  • uv run ruff check / ruff format --check on all changed files
  • Ran /simplify (reuse, simplification, efficiency, altitude review) — no issues found
  • Ran /code-review — one style-consistency nit (the reverse_related.py param name), applied

🤖 Generated with Claude Code

https://claude.ai/code/session_01VXaR5tbB8DjR3dLDzsDALA


Generated by Claude Code

ty 0.0.62 added MRO-based checking for inherited method conflicts, which
surfaced 51 invalid-method-override diagnostics in plain-postgres and 6 in
plain-email.

For plain-postgres, fix the actual signature mismatches in the shared base
classes (RegisterLookupMixin.get_lookup/get_transform, BaseExpression.
get_transform, Lookup.resolve_expression) rather than suppressing per
subclass: rename parameters to match, and correct get_transform's return
type to Callable[..., Transform] | None to reflect that it can genuinely
return a KeyTransformFactory instance alongside Transform subclasses. This
also lets an existing invalid-return-type ignore in expressions.py be
removed since the types now agree.

For plain-email, add ty: ignore[invalid-method-override] on the three
SafeMIME* classes, consistent with the existing ignore already used on
set_payload in the same file, since MIMEMixin intentionally diverges from
stdlib email.message.Message's as_bytes/as_string signature.
@davegaeddert
davegaeddert marked this pull request as ready for review July 28, 2026 13:07
@pullapprove5

pullapprove5 Bot commented Jul 28, 2026

Copy link
Copy Markdown
PASS: 1 review scope passed
Scope Progress
all 0/0

View in PullApprove

Next steps:

@davegaeddert
davegaeddert merged commit 9e75740 into master Jul 28, 2026
11 checks passed
@davegaeddert
davegaeddert deleted the claude/great-cannon-f483c8 branch July 28, 2026 13:07

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codex second opinion — not run: Claude did not approve (review state: none).

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