Repository navigation
MAINT: make puzzled dispatch exhaustive (P311-03) - #3504
Roman Lutz (romanlutz) merged 9 commits into
Conversation
Richard Lundeen (richlundeen)
left a comment
There was a problem hiding this comment.
I recommend closing this PR. The current dispatch already handles all three PuzzleType values, so this does not fix a current behavior bug. The new helper, generic Callable, and subprocess test that constructs source code and invokes ty add more maintenance than this change warrants. I would keep the simple dispatch and update it when a real enum extension needs it.
Reviewed with GitHub Copilot.
Keep the explicit Crossword branch and Python 3.11 assert_never guard in convert_async. Remove the helper, generic Callable, and source-generating subprocess test; rely on normal type checking and existing runtime tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Richard Lundeen (@richlundeen) The helper, generic The purpose is preventive type checking rather than fixing today's output: if 🤖 AI-authored reply via Agency Finish PR. |
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Description
Part of #3166 (P311-03 puzzle-builder dispatch).
Use Python 3.11's
typing.assert_neverto make the existing closedPuzzleTypedispatch exhaustive. Keep the dispatch directly inconvert_async, explicitly handleCROSSWORD, and reject unhandled enum extensions during normal type checking.The simplified patch removes the extracted helper, generic
Callable, and source-generating subprocess test. Relative to main, only the import and explicit exhaustive branches remain. Constructor validation, crossword-to-anagram fallback, RNG behavior, Unicode handling, clues, and rendered output are preserved. No public API changes.Tests and Documentation
Retain the existing runtime tests and rely on normal CI type checking for exhaustiveness. No additional test machinery or documentation changes are needed for this internal dispatch guard.
Validation of commit
5524faada11de4d187891120bdc3a9a32151e63d:uv run --no-sync pytest tests\unit\converter\test_puzzled_converter.py tests\unit\converter\test_puzzled_puzzle_builders.py tests\unit\converter\test_puzzled_keyword_masker.py -q: passed, 289 tests.uv run --no-sync ty check --python-version 3.11 pyrit\converter\puzzled\puzzled_converter.py tests\unit\converter\test_puzzled_converter.py: passed.uv run --no-sync ruff check pyrit\converter\puzzled\puzzled_converter.py tests\unit\converter\test_puzzled_converter.py: passed.uv run --no-sync ruff format --check pyrit\converter\puzzled\puzzled_converter.py tests\unit\converter\test_puzzled_converter.py: passed.git diff --check: passed.JupyText was not run because no documentation examples changed.
Disclosure
Slai Agent Runtime assisted with analysis, reproduction, implementation, and test execution. The account owner authorized this contribution and is responsible for the submission.
GitHub Copilot assisted with the follow-up simplification and validation at the maintainer's request.