chore(types): make ModuleUpdate.py strict-clean and add it to the type-check gate#45
Merged
Merged
Conversation
…e-check gate Brings ModuleUpdate.py from 143 strict pyright errors to 0 and adds it to the gate's include list (.github/pyright-config.json). The bulk was cascade, not 143 independent problems: - _uv_run: inline the untyped kwargs dict as explicit keyword args (creationflags computed once, 0 off-Windows) and annotate -> CompletedProcess[str]. This alone cleared ~64 errors by restoring result.returncode/stdout/stderr types everywhere. - Add typings/mwgg_igdb.pyi modeling the GameIndex singleton + __variant__; clears the missing-stub cascade (get_all_games and downstream .get access). - RequirementsSet is now generic (set[_T]) with @OverRide + typed add/update; requirements_files (Path) and worlds_files (str) annotated accordingly. Genuine fixes (not suppressions): - update_world_from_package passed a str to APWorldContainer(path: Path|None); use the already-computed world_path. - Coerce the untrusted manifest['world_version'] (object) to str before tuplize_version. - Add explicit new_version-is-not-None narrowing at the Optional[Version] compare/access. Documented suppressions for genuine noise only: fcntl flock/LOCK_* (Unix-only branch flagged under pythonPlatform=Windows), the intentionally-reassigned public UPPERCASE variant globals (reportConstantRedefinition; renaming would break the public API and test_module_update), and _venv_has_worlds (unused in-module but consumed by tools/mwgg_upgrade.py + tools/mcp_mwgg_upgrader.py — NOT dead, so not deleted). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
What
Brings
ModuleUpdate.pyfrom 143 strict pyright errors to 0 and adds it to thetype-check gate's
includelist. The gate stays green — validated against the real.github/pyright-config.json(22 files, 0 errors, 0 warnings) via the samepyrightconsole script CI runs.
The 143 were heavily clustered, not independent:
_uv_run: inline the untypedkwargsdict as explicit keyword args +-> CompletedProcess[str]result.returncode/stdout/stderrtypes repo-wide)typings/mwgg_igdb.pyistub (GameIndex singleton +__variant__)RequirementsSet(set[_T])+@override+ typed file-set annotations,queue.Queue[...], list/parse_requirementsannotationsGenuine fixes (real, not suppressed)
APWorldContainer(world)was passing astrwhere the constructor wantsPath | None. Surfaced only after typing madeworld: strconcrete (it wasUnknownbefore, masking the mismatch). Use the already-computedworld_path.manifest["world_version"](object, from an apworld zip) tostrbeforetuplize_versionso a non-string version can't crash it.new_version is not Nonenarrowing at theOptional[Version]compare/access — safe at runtime but unprovable by pyright; de-fragilized.Suppressions — genuine noise only, documented inline
flock/LOCK_*: Unix-only branch flagged underpythonPlatform=Windows(typeshed hides them). Correctly guarded at runtime.reportConstantRedefinitionon the public UPPERCASE variant globals (MWGG_IGDB_VARIANT/BRANCH/GIT_URL,_EXPLICIT_VARIANT) — intentionally reassigned in_resolve_variant()/set_variant(); renaming would break the public API andtest_module_update._venv_has_worlds: flaggedreportUnusedFunction(unused within the module) but consumed bytools/mwgg_upgrade.pyandtools/mcp_mwgg_upgrader.py— so it was kept, not deleted.Notes / deviations from the original plan
RequirementsSetis made genericset[_T], notset[str]:requirements_filesholdsPathwhileworlds_filesholdsstr._venv_has_worldsis not dead (see above) — suppressed + documented instead of removed.Validation
pyright -p .github/pyright-config.json→ 22 files, 0 errors / 0 warnings (exit 0).test/general/test_module_update.py→ 23 passed.RequirementsSetbehavior verified.git diff --ignore-cr-at-eol --statmatches; new files are pure LF).