From 50ffbd7e05b08318ce8634f1e54f32f1fdfffdd9 Mon Sep 17 00:00:00 2001 From: Varun Joginpalli Date: Tue, 7 Jul 2026 01:59:06 +0000 Subject: [PATCH] MAINT: Standardize garak Doctor default strategy to DEFAULT Flip the Doctor scenario's default_strategy from ALL to DEFAULT for consistency with the other standardized scenarios (matching WebInjection). Both Policy Puppetry techniques are already tagged "default", so DEFAULT and ALL resolve to the same techniques -- this is a behavior-preserving change and the VERSION is intentionally unchanged (the resume eval-hash derives from the resolved techniques, not the default-strategy label). --- pyrit/scenario/scenarios/garak/doctor.py | 6 ++++-- tests/unit/scenario/garak/test_doctor.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/pyrit/scenario/scenarios/garak/doctor.py b/pyrit/scenario/scenarios/garak/doctor.py index a0cbb7c01b..629dd17ea0 100644 --- a/pyrit/scenario/scenarios/garak/doctor.py +++ b/pyrit/scenario/scenarios/garak/doctor.py @@ -38,7 +38,9 @@ class DoctorStrategy(ScenarioStrategy): ALL = ("all", {"all"}) DEFAULT = ("default", {"default"}) - # Concrete strategies (values match the technique factory names) + # Concrete strategies (values match the technique factory names). Both are tagged + # "default", so DEFAULT and ALL coincide today; ALL exists so a future non-default + # technique would diverge from DEFAULT without another default-strategy change. PolicyPuppetry = ("policy_puppetry", {"default"}) PolicyPuppetryLeet = ("policy_puppetry_leet", {"default"}) @@ -134,7 +136,7 @@ def __init__( super().__init__( version=self.VERSION, strategy_class=DoctorStrategy, - default_strategy=DoctorStrategy.ALL, + default_strategy=DoctorStrategy.DEFAULT, default_dataset_config=DatasetAttackConfiguration(dataset_names=["garak_doctor"]), objective_scorer=objective_scorer, scenario_result_id=scenario_result_id, diff --git a/tests/unit/scenario/garak/test_doctor.py b/tests/unit/scenario/garak/test_doctor.py index 7449366ae9..ebaad7601c 100644 --- a/tests/unit/scenario/garak/test_doctor.py +++ b/tests/unit/scenario/garak/test_doctor.py @@ -83,6 +83,10 @@ def test_default_dataset_config_uses_garak_doctor(self, mock_objective_scorer): config = Doctor(objective_scorer=mock_objective_scorer)._default_dataset_config assert config.dataset_names == ["garak_doctor"] + def test_default_strategy_is_default(self, mock_objective_scorer): + scenario = Doctor(objective_scorer=mock_objective_scorer) + assert scenario._default_strategy == DoctorStrategy.DEFAULT + @pytest.mark.usefixtures("patch_central_database") class TestDoctorTechniqueFactories: @@ -135,12 +139,26 @@ def test_policy_puppetry_leet_wires_both_converters(self, mock_objective_target, class TestDoctorStrategyExpansion: """Tests for Doctor strategy expansion and atomic attack generation.""" + async def test_default_expands_to_concrete_strategies( + self, mock_objective_target, mock_objective_scorer, doctor_dataset_config + ): + """No explicit strategies -> DEFAULT -> both Policy Puppetry techniques.""" + scenario = Doctor(objective_scorer=mock_objective_scorer) + await scenario.initialize_async( + objective_target=mock_objective_target, + dataset_config=doctor_dataset_config, + ) + + strategy_values = {s.value for s in scenario._scenario_strategies} + assert strategy_values == {"policy_puppetry", "policy_puppetry_leet"} + async def test_all_expands_to_concrete_strategies( self, mock_objective_target, mock_objective_scorer, doctor_dataset_config ): scenario = Doctor(objective_scorer=mock_objective_scorer) await scenario.initialize_async( objective_target=mock_objective_target, + scenario_strategies=[DoctorStrategy.ALL], dataset_config=doctor_dataset_config, )