Skip to content

MAINT: Make puzzled converter and puzzle builder helpers keyword-only - #4349

Merged
Roman Lutz (romanlutz) merged 3 commits into
microsoft:mainfrom
madhusudanpatnaik:maint/keyword-only-puzzled-converter
Nov 18, 2026
Merged

Roman Lutz (romanlutz) merged 3 commits into
microsoft:mainfrom
madhusudanpatnaik:maint/keyword-only-puzzled-converter

Conversation

@madhusudanpatnaik

@madhusudanpatnaik Madhu Sudan Sathujoda (madhusudanpatnaik) commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

MAINT: Make puzzled converter and puzzle builder helpers keyword-only

Description

Migrate six helpers across the puzzled converter package to keyword-only parameters to reduce the keyword-only baseline:

  • Require keyword-only pos_lookup and essential_words in pyrit/converter/puzzled/keyword_masker.py:_rank_candidates.
  • Require keyword-only rng in pyrit/converter/puzzled/puzzle_builders.py:build_anagram and build_word_search.
  • Require keyword-only word and rng in pyrit/converter/puzzled/puzzle_builders.py:_try_place.
  • Require keyword-only semantics in pyrit/converter/puzzled/puzzled_converter.py:PuzzledConverter._clue_line.
  • Require keyword-only words in pyrit/converter/puzzled/puzzled_converter.py:PuzzledConverter._parse_semantic_clues.
  • Update internal call sites and unit test invocations across puzzled_converter.py, puzzle_builders.py, keyword_masker.py, and test suites.
  • Add behavior unit tests for _clue_line, _parse_semantic_clues, and _rank_candidates.
  • Remove all six pyrit.converter.puzzled entries from build_scripts/keyword_only_baseline.txt.

No signatures gained defaults and no behavior changed: all parameters stay required (or keep their original optionality), matching the purely mechanical convention of earlier campaign PRs.

Relates to #4216

Migrate six helpers across the puzzled converter package to keyword-only parameters to reduce the keyword-only baseline:
- Require keyword-only pos_lookup and optional essential_words in pyrit.converter.puzzled.keyword_masker._rank_candidates.
- Require keyword-only rng in pyrit.converter.puzzled.puzzle_builders.build_anagram and build_word_search (defaulting to None for internal random.Random).
- Require keyword-only word and rng in pyrit.converter.puzzled.puzzle_builders._try_place.
- Require keyword-only optional semantics in pyrit.converter.puzzled.puzzled_converter.PuzzledConverter._clue_line (defaulting to None).
- Require keyword-only words in pyrit.converter.puzzled.puzzled_converter.PuzzledConverter._parse_semantic_clues.
- Update internal call sites and unit test invocations.
- Add signature, positional rejection, and behavior tests for all migrated helpers.
- Remove all six entries for pyrit.converter.puzzled from build_scripts/keyword_only_baseline.txt.

Relates to microsoft#4216
Copilot AI balanced review requested due to automatic review settings November 16, 2026 21:08

Copilot AI left a comment

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.

🟢 Approval recommended

No active review issues were identified for the keyword-only helper migration.

No open issues 🎉

What changed in this PR

Migrates six puzzled-converter helpers to keyword-only parameters, advancing the baseline reduction tracked in #4216.

Changes:

  • Updates helper signatures and internal callers, adding optional defaults for randomness, essential words, and semantic clues.
  • Adds signature, positional-rejection, and behavior tests.
  • Removes the six migrated helpers from the keyword-only baseline.
File Description
tests/​unit/​converter/​test_puzzled_puzzle_builders.py Updates calls and tests keyword-only parameters and default randomness.
tests/​unit/​converter/​test_puzzled_keyword_masker.py Tests ranking signatures and optional essential words.
tests/​unit/​converter/​test_puzzled_converter.py Tests clue-helper signatures and parsing behavior.
pyrit/​converter/​puzzled/​puzzled_converter.py Migrates clue helpers and updates converter call sites.
pyrit/​converter/​puzzled/​puzzle_builders.py Migrates builder and placement helpers; adds optional randomness sources.
pyrit/​converter/​puzzled/​keyword_masker.py Migrates ranking parameters and updates its caller.
build_scripts/​keyword_only_baseline.txt Removes all six migrated helper entries.

Review effort: Balanced

@romanlutz

Copy link
Copy Markdown
Contributor

Thanks for the contribution! This PR covers modules from #4216 that were not claimed first. Per that issue's rules, please claim one module at a time on the issue and wait for maintainer confirmation before opening a PR, so we can coordinate and avoid duplicated effort. Leaving this open for review; the modules it touches are now recorded on #4216.

@romanlutz

Copy link
Copy Markdown
Contributor

Madhu Sudan Sathujoda (@madhusudanpatnaik) you need to accept the CLA as explained above by the bot. I'll give you until 11/20 otherwise I'll close these PRs.

@madhusudanpatnaik

Copy link
Copy Markdown
Contributor Author

The Microsoft CLA has now been accepted. Thank you for the guidance—going forward I will claim one module at a time on #4216 before opening any PR.

Reverts the `= None` defaults and fallback branches added alongside the
keyword-only conversion: rng stays injected for reproducibility, and the
sole callers always pass semantics and essential_words. Also removes the
inspect-based signature assertions, which duplicate
build_scripts/check_keyword_only_params.py, while keeping the new
behavior tests.

Co-Authored-By: Claude Fable 5 <[email protected]>
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 18, 2026
Merged via the queue into microsoft:main with commit 96e7bf1 Nov 18, 2026
65 checks passed
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