Skip to content

MAINT Simplify Foundry technique mapping - #2336

Open
Roman Lutz (romanlutz) wants to merge 2 commits into
microsoft:mainfrom
romanlutz:romanlutz-declarative-foundry-techniques
Open

MAINT Simplify Foundry technique mapping#2336
Roman Lutz (romanlutz) wants to merge 2 commits into
microsoft:mainfrom
romanlutz:romanlutz-declarative-foundry-techniques

Conversation

@romanlutz

Copy link
Copy Markdown
Contributor

Description

RedTeamAgent._get_attack_from_technique encoded the Foundry attack and converter catalog in a long conditional chain, making supported mappings and constructor exceptions difficult to audit. This replaces those branches with immutable, Foundry-local attack and converter specifications while retaining direct attack construction rather than adopting the mutable global registry.

The refactor preserves all existing behavior: baseline and four attack mappings, all 21 converter mappings, converter order, fresh instances, Caesar/suffix/Tense/Jailbreak defaults, exact unsupported-converter errors, unknown-attack fallback, and PAIR/TAP scoring semantics. The mapping portion of _get_attack_from_technique is reduced from 70 lines to 22.

Tests and Documentation

Added exhaustive parameterized coverage for every attack and converter mapping, enum completeness, special constructor arguments, fresh Jailbreak templates, converter ordering, unsupported values, baseline fallback, and PAIR/TAP scorer behavior.

Validated with:

  • tests/unit/scenario/foundry/test_red_team_agent.py (56 passed)
  • focused mapping tests (34 passed)
  • tests/partner_integration/azure_ai_evaluation/test_foundry_scenario_contract.py (7 passed)
  • Ruff format and lint checks
  • targeted ty checks

Documentation is unchanged because the public Foundry API and behavior are unchanged. JupyText was not applicable.

Copilot AI added 2 commits August 5, 2026 10:43
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 41c8a28e-3109-4b71-b97a-3d8ec8834136
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 41c8a28e-3109-4b71-b97a-3d8ec8834136
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.

2 participants