Skip to content

MAINT: Make XL-SafetyBench _row_value keyword-only - #4824

Open
Lenin Mookiah (leninworld) wants to merge 2 commits into
microsoft:mainfrom
leninworld:maint/4216-xl-safety-bench-row-value
Open

Lenin Mookiah (leninworld) wants to merge 2 commits into
microsoft:mainfrom
leninworld:maint/4216-xl-safety-bench-row-value

Conversation

@leninworld

Copy link
Copy Markdown

This PR addresses part of issue #4216.

Description

Make _row_value in pyrit.datasets.seed_datasets.remote.xl_safety_bench_dataset keyword-only, and clear it from the keyword-only baseline.

  • _row_value(row, *, key): row stays the one positional parameter, and the helper's 23 calls in the module (the jailbreak, jailbreak-objectives and cultural loaders) pass key= by name.
  • Remove its entry from build_scripts/keyword_only_baseline.txt.
  • Return values are unchanged. The helper is module-private and has no production callers outside this module.
  • New tests pin what the helper does: surrounding whitespace is stripped, and a missing column or a None cell (a short CSV row) gives "". One more test checks that passing key positionally raises TypeError.

Relates to #4216

_row_value in pyrit.datasets.seed_datasets.remote.xl_safety_bench_dataset
now takes key after *, and its 23 calls in the module pass it by name.
Remove its entry from the keyword-only baseline and add tests that pin
the helper's behaviour (stripped values, missing column and None cell
give an empty string) and its keyword-only key.

Relates to microsoft#4216
Copilot AI balanced review requested due to automatic review settings December 3, 2026 18:09

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 change making _row_value’s key argument keyword-only.

No open issues 🎉

What changed in this PR

Advances #4216 by making XL-SafetyBench’s private _row_value helper require key as a keyword argument, without changing return values.

Changes:

  • Updates all 23 loader calls to pass key=.
  • Removes the helper from the keyword-only baseline.
  • Adds tests for cell normalization and rejection of positional key arguments.
File Description
tests/​unit/​datasets/​test_xl_safety_bench_dataset.py Tests normalization and keyword-only enforcement.
pyrit/​datasets/​seed_datasets/​remote/​xl_safety_bench_dataset.py Updates the helper signature and all callers.
build_scripts/​keyword_only_baseline.txt Removes the migrated helper’s exemption.

Review effort: Balanced

@hannahwestra25 hannahwestra25 self-assigned this Dec 4, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@hannahwestra25 hannahwestra25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing! Merged the latest main into this branch; no source changes were needed.

This branch has not been deployed

No deployments
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