Skip to content

MAINT: make puzzled dispatch exhaustive (P311-03) - #3504

Closed
Slai.life (huong8373tt-beep) wants to merge 4 commits into
microsoft:mainfrom
huong8373tt-beep:fix/p311-03-puzzle-dispatch
Closed

Slai.life (huong8373tt-beep) wants to merge 4 commits into
microsoft:mainfrom
huong8373tt-beep:fix/p311-03-puzzle-dispatch

Conversation

@huong8373tt-beep

@huong8373tt-beep Slai.life (huong8373tt-beep) commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • make the closed PuzzleType dispatch explicit for word-search, anagram, and crossword builders
  • add assert_never so a future enum member is rejected by type checking instead of falling through to the crossword builder
  • add an actual-source enum-extension regression probe while preserving constructor validation, crossword fallback, seeded RNG behavior, Unicode handling, clues, and rendered output

Part of #3166 (P311-03 puzzle-builder dispatch).

Validation

  • uv run pytest tests/unit/converter/test_puzzled_converter.py -q --basetemp .pytest-tmp-final (145 passed)
  • uv run ty check pyrit/converter/puzzled/puzzled_converter.py tests/unit/converter/test_puzzled_converter.py
  • uv run ruff format --check pyrit/converter/puzzled/puzzled_converter.py tests/unit/converter/test_puzzled_converter.py
  • uv run ruff check pyrit/converter/puzzled/puzzled_converter.py tests/unit/converter/test_puzzled_converter.py
  • git diff --check

Disclosure

Slai Agent Runtime assisted with analysis, reproduction, implementation, and test execution. The account owner authorized this contribution and is responsible for the submission.

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.

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.

auto-merge was automatically disabled October 25, 2026 08:28

Pull request was closed

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.

3 participants