MAINT: Deleting Legacy Scenario Scaffolding#2123
Merged
rlundeen2 merged 2 commits intoJul 3, 2026
Merged
Conversation
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>
…ete-dead-scenario-machinery # Conflicts: # pyrit/scenario/scenarios/garak/web_injection.py
b8d02c7 to
4f19140
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
Scenariobase class baked in one construction shape — knowstrategy_class+ a singleobjective_scorer+default_dataset_configat__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._get_atomic_attacks_asyncbridge — baseline is now emitted centrally ininitialize_async._get_attack_technique_factories,_build_display_group, and_prepare_strategiesbase hooks.include_default_baseline/ constructor-time baseline deprecation shims (slated for 0.16.0).extra_factoriesto 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