Skip to content

chore(ty): enable invalid-argument-type/invalid-assignment for shipped code, drop inert mypy ignores (#507) - #561

Merged
antosubash merged 19 commits into
mainfrom
chore/ty-ignore-507
Oct 20, 2026
Merged

antosubash merged 19 commits into
mainfrom
chore/ty-ignore-507

Conversation

@antosubash

Copy link
Copy Markdown
Owner

Closes #507

Summary

  • Removed all 153 # type: ignore[<mypy-code>] comments. Under ty 0.0.89 they suppressed nothing (ty matches the bracket against its own rule names) and ty never reported them as unused. Removing them changed no ty output.
  • invalid-argument-type and invalid-assignment are now on for shipped code. Tests, conftest files and scripts/bench_*.py stay exempt through [[tool.ty.overrides]], because they pass fakes on purpose. Enabling the rules surfaced 264 diagnostics outside tests. Each one was fixed, tightened, or given a line-level # ty: ignore[<rule>] (148 in total) where it is a known third-party false positive: SQLAlchemy Model.col == x read as bool, selectinload(User.roles), SQLModel model_config = ConfigDict(...), fastapi-users generics, and Starlette exception-handler signatures.
  • settings.registration.register_module_settings is now generic over the settings class. services_factory receives the concrete type, so module lambdas need no casts.
  • Documentation: the rule policy is updated in CLAUDE.md, docs/database/models.md and the shipped simple-module-conventions skill. Inert ignores were also removed from the module README snippets.

Behaviour changes (all in CHANGELOG)

  • Tenant resolver boundary (issue item 3): a UUID tenant id becomes its string form. Any other non-str tenant id or source raises TypeError instead of flowing into tenant filters (_tenant.py). Tests are in test_tenant_resolver_types.py.
  • UsersSettings.cookie_samesite is now Literal["lax","strict","none"] and matched case-insensitively, so "Strict" still works. Other values are rejected. A setting typed as a Literal of strings now renders as a choice list in the settings UI instead of a JSON box.
  • get_file_storage_service raises a clear RuntimeError when the backend is not initialised, instead of building a service around None.
  • Smaller fixes: non-string group metadata on a settings field is shown as no group, and Vary is no longer set to None when there is nothing to merge.
  • Alembic include_object type: make_include_object's type now includes check_constraint, matching current Alembic.

Test fix

  • test_lenient_log_never_echoes_the_stored_value failed when an earlier test in the same worker left logging at DEBUG: caplog had captured the setup INSERT. The test now clears caplog before hydration.

Not changed

  • Scaffold templates: apps generated by smpy new still ignore both rules globally. This change applies only to this repo's own code.

Verification

  • Local CI: make lint (ruff, ty, Biome, tsc, file-size, hardcoded and untranslated strings, metadata) passes. make test-py gives 4903 passed and 22 skipped, and make test-js passes.
  • Review:
    • The /ship code-review loop needed two passes. Pass 1 fixed the settings UI rendering for Literal fields and a style nit; pass 2 was clean.
    • An independent Codex review found nothing.
    • Browser QA was skipped because the change has no UI.

https://claude.ai/code/session_01M9neheZZEe3sVpDi2S3zT4

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Deploying simple-module-python with  Cloudflare Pages  Cloudflare Pages

Latest commit: 65654b7
Status: ✅  Deploy successful!
Preview URL: https://20415800.simple-module-python.pages.dev
Branch Preview URL: https://chore-ty-ignore-507.simple-module-python.pages.dev

View logs

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-10-19T20:23:54.407512Z 65654b7 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@antosubash
antosubash merged commit bfc5f6a into main Oct 20, 2026
14 checks passed
@antosubash
antosubash deleted the chore/ty-ignore-507 branch October 20, 2026 09:49
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.

~143 mypy-style # type: ignore[code] comments do nothing under ty; global ty rule disables are broader than documented

1 participant