Skip to content

MAINT: Deleting Legacy Scenario Scaffolding#2123

Merged
rlundeen2 merged 2 commits into
microsoft:mainfrom
rlundeen2:rlundeen2-phase-d-delete-dead-scenario-machinery
Jul 3, 2026
Merged

MAINT: Deleting Legacy Scenario Scaffolding#2123
rlundeen2 merged 2 commits into
microsoft:mainfrom
rlundeen2:rlundeen2-phase-d-delete-dead-scenario-machinery

Conversation

@rlundeen2

Copy link
Copy Markdown
Contributor

Problem

The Scenario base class baked in one construction shape — know strategy_class + a single objective_scorer + default_dataset_config at __init__, then cross-product techniques × datasets in a default _get_atomic_attacks_async. But every non-trivial scenario (Encoding, RedTeamAgent, AdversarialBenchmark, AdaptiveScenario, ...) fully overrode that method, leaving _get_attack_technique_factories, _build_display_group, _prepare_strategies, and the implicit baseline injection as dead weight each override had to understand and work around.

Change

Phase D of the scenario simplification: make _build_atomic_attacks_async(self, *, context) the single abstract extension point and delete the legacy scaffolding.

  • Remove the _get_atomic_attacks_async bridge — baseline is now emitted centrally in initialize_async.
  • Delete the _get_attack_technique_factories, _build_display_group, and _prepare_strategies base hooks.
  • Remove the include_default_baseline / constructor-time baseline deprecation shims (slated for 0.16.0).
  • Add extra_factories to the matrix builder helpers so scenarios with local factories (Leakage) stay on the one-line construction path.

Net ~−559 lines. Full tests/unit/scenario/ suite passing (792), including new tests that lock in the abstract-method contract.

Plan / context: https://gist.github.com/rlundeen2/d2fa5f91eb411ba9b1d0bbf98412f700

Make _build_atomic_attacks_async(context) the sole abstract extension point
on Scenario and delete the dead base machinery every scenario had to override
around: the _get_atomic_attacks_async bridge, _get_attack_technique_factories,
_build_display_group, _prepare_strategies, and the 0.16.0 baseline-injection
deprecation shims. Add extra_factories to the matrix builder helpers so local
factories (Leakage) stay on the one-line construction path.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@romanlutz romanlutz 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.

👍🏻

…ete-dead-scenario-machinery

# Conflicts:
#	pyrit/scenario/scenarios/garak/web_injection.py
@rlundeen2 rlundeen2 force-pushed the rlundeen2-phase-d-delete-dead-scenario-machinery branch from b8d02c7 to 4f19140 Compare July 3, 2026 05:30
@rlundeen2 rlundeen2 enabled auto-merge July 3, 2026 05:31
@rlundeen2 rlundeen2 disabled auto-merge July 3, 2026 05:38
@rlundeen2 rlundeen2 added this pull request to the merge queue Jul 3, 2026
Merged via the queue into microsoft:main with commit 1670bbd Jul 3, 2026
53 checks passed
@rlundeen2 rlundeen2 deleted the rlundeen2-phase-d-delete-dead-scenario-machinery branch July 3, 2026 06:10
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