Part of #1133: clear 8 side-finding mypy errors#1210
Merged
Conversation
Part of #1133. Cleans 8 mypy errors surfaced by Codex as side-findings during review of #1208/#1209. No runtime behavior change. Net mypy src/: 384 -> 365 (-19). No error type increased: arg-type 108->107, attr-defined 86->82, union-attr 57->44, assignment 25->21, return-value 25->25. Files: production_limits_service, cli/test, web/settings+photo_loader handlers, provider_model_compatibility+cache (TYPE_CHECKING self-typed), pool_lifecycle (clients value type), bootstrap (collector union type). Co-Authored-By: Claude <noreply@anthropic.com>
…ool/photo/production guards (PR #1210 review)
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.
Part of #1133
What changed
Cleans 8 mypy errors surfaced by Codex as side-findings during review of #1208/#1209. Each fixed by its own pattern (assert / explicit guard / TYPE_CHECKING self-typing / type narrowing). No runtime behavior change.
production_limits_service.py:244— assert self._db (union-attr)cli/commands/test.py:1195— explicit RuntimeError guard for state.copy_db (union-attr, CLI path)web/settings/handlers.py:906— assert service after guard contract (union-attr)web/photo_loader/handlers.py:293— explicit None-guard redirect for target (union-attr)provider_model_compatibility.py:63+provider_model_cache.py:76— TYPE_CHECKING self: ProviderConfigService (attr-defined mixin pattern, same as Part of #1133: annotate collector mixin self types #1209)pool_lifecycle.py:185— narrowed clients dict value type for raw_client access (attr-defined)bootstrap.py:272— explicit Collector | SnapshotCollector union annotation (attr-defined, not a bug — SnapshotCollector.refresh exists)Mypy delta
mypy src/totalNo error type increased.
Validation
python -m mypy src/ruff check src/— cleanpython -c "import src.services.agent_provider_service; import src.telegram.pool_lifecycle; import src.web.bootstrap"— no ImportErrorNote: opened by orchestrator — worker session 21 crashed with
turn/start failed in TUIafter completing the edits but before committing; work was committed/pushed from its worktree.Part of #1133. Does NOT touch #1207 (arg-type Protocol, separate).