Skip to content

MAINT: Keyword-only helpers - #4210

Merged
Roman Lutz (romanlutz) merged 3 commits into
microsoft:mainfrom
romanlutz:romanlutz-private-helper-keyword-only-cleanup
Nov 11, 2026
Merged

Roman Lutz (romanlutz) merged 3 commits into
microsoft:mainfrom
romanlutz:romanlutz-private-helper-keyword-only-cleanup

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

Make two private helpers follow PyRIT's keyword-only convention without changing truncation or metadata-filter behavior. This is the small cleanup identified during #3960.

  • Require max_length= in _truncate_text and key= in _get_metadata_value, updating every caller.
  • Add focused regression coverage for parameter kinds, truncation boundaries, attribute precedence, and parameter-based filters.
  • Remove only these two helpers from the legacy baseline introduced in MAINT: Add static keyword-only parameter check with baseline #3960.

Public APIs are unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 17:19

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 private-helper keyword-only migration.

No open issues 🎉

What changed in this PR

This PR migrates two private helpers to PyRIT’s keyword-only convention, following up on #3960 without changing public APIs or helper behavior.

Changes:

  • Require max_length= and key= in the helpers and update their callers.
  • Add regression tests for keyword-only parameters, truncation boundaries, and metadata filtering.
  • Remove the two migrated helpers from the legacy baseline.
File Description
tests/​unit/​registry/​test_registry.py Tests keyword-only enforcement, attribute precedence, and parameter-based filters.
tests/​unit/​cli/​test_output.py Tests truncation boundaries and keyword-only enforcement.
pyrit/​registry/​registry.py Makes key keyword-only and updates filter callers.
pyrit/​cli/​_output.py Makes max_length keyword-only and updates output callers.
build_scripts/​keyword_only_baseline.txt Removes the two migrated helper entries.

Review effort: Balanced

@jbolor21 jbolor21 self-assigned this Nov 11, 2026
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Nov 11, 2026
Merged via the queue into microsoft:main with commit 2ffbc95 Nov 11, 2026
62 checks passed
@romanlutz
Roman Lutz (romanlutz) deleted the romanlutz-private-helper-keyword-only-cleanup branch November 11, 2026 20:03
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.

4 participants