Skip to content

MAINT: Make CLI source filtering data keyword-only - #4340

Merged
Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
mcjim1689:maint/4216-cli-sources-keyword-only
Nov 18, 2026
Merged

Roman Lutz (romanlutz) merged 4 commits into
microsoft:mainfrom
mcjim1689:maint/4216-cli-sources-keyword-only

Conversation

@mcjim1689

Copy link
Copy Markdown
Contributor

Description

Make data keyword-only in pyrit.cli._sources._only_known, update both hydration callers, and remove its keyword-only baseline entry. The first model_cls argument remains positional or keyword; field filtering and hydration behavior stay unchanged.

  • Cover the required keyword-only signature, positional rejection, empty and unknown payloads, and preservation of declared values without input mutation for both domain models.
  • This private helper has two direct, code-owned callers and no callback or inheritance contract.

Relates to #4216. Maintainer assignment.

Developed with assistance from OpenAI Codex; the patch and compatibility were reviewed locally and the focused and broader suites were run.

Relates to microsoft#4216

Developed with assistance from OpenAI Codex.
Copilot AI balanced review requested due to automatic review settings November 16, 2026 15:29
@mcjim1689

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

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 remain for the change making _only_known’s data parameter keyword-only.

No open issues 🎉

What changed in this PR

This PR advances the keyword-only migration tracked in #4216 by making data keyword-only in the private CLI helper _only_known. The model_cls parameter remains positional-or-keyword, and filtering and hydration behavior remain unchanged.

Changes:

  • Updates both hydration callers to pass data explicitly.
  • Removes the helper’s keyword-only baseline entry.
  • Adds tests for the signature, positional rejection, field filtering, value preservation, and input non-mutation.
File Description
tests/​unit/​cli/​test_sources.py Adds signature and filtering tests for both domain models.
pyrit/​cli/​_sources.py Makes data keyword-only and updates both callers.
build_scripts/​keyword_only_baseline.txt Removes the migrated helper’s baseline entry.

Review effort: Balanced

…s-keyword-only

# Conflicts:
#	build_scripts/keyword_only_baseline.txt
The keyword-only convention is already enforced repo-wide by
build_scripts/check_keyword_only_params.py in CI, so the inspect-based
signature test and the positional-rejection test (which pins CPython's
TypeError wording) add no coverage. Keep the 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 483fc76 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