88
99from quant_strategy_plugins .crisis_response_research import ROUTE_TRUE_CRISIS
1010from quant_strategy_plugins .strategy_plugin_runner import (
11+ GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY ,
1112 PLUGIN_COMPATIBLE_STRATEGIES ,
1213 PLUGIN_CRISIS_RESPONSE_SHADOW ,
1314 PLUGIN_DEPRECATED_SUCCESSORS ,
@@ -266,16 +267,16 @@ def test_strategy_plugin_runner_runs_unified_market_regime_control_for_tqqq(tmp_
266267 assert payload ["execution_controls" ]["live_allocation_mutation_allowed" ] is False
267268
268269
269- def test_strategy_plugin_runner_runs_unified_market_regime_control_for_soxl (tmp_path ) -> None :
270+ def test_strategy_plugin_runner_runs_general_market_regime_notification (tmp_path ) -> None :
270271 prices_path = tmp_path / "market_regime_prices.csv"
271- output_dir = tmp_path / SOXL_STRATEGY_NAME / "plugins" / PLUGIN_MARKET_REGIME_CONTROL
272+ output_dir = tmp_path / GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY / "plugins" / PLUGIN_MARKET_REGIME_CONTROL
272273 _soxl_quiet_prices ().to_csv (prices_path , index = False )
273274 config = {
274275 "output_dir" : str (tmp_path / "runner" ),
275276 "default_mode" : "shadow" ,
276277 "strategy_plugins" : [
277278 {
278- "strategy" : SOXL_STRATEGY_NAME ,
279+ "strategy" : GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY ,
279280 "plugin" : PLUGIN_MARKET_REGIME_CONTROL ,
280281 "enabled" : True ,
281282 "inputs" : {
@@ -295,20 +296,42 @@ def test_strategy_plugin_runner_runs_unified_market_regime_control_for_soxl(tmp_
295296 summary = run_configured_plugins (config )
296297
297298 result = summary ["strategy_plugins" ][0 ]
298- assert result ["strategy" ] == SOXL_STRATEGY_NAME
299+ assert result ["strategy" ] == GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY
299300 assert result ["plugin" ] == PLUGIN_MARKET_REGIME_CONTROL
300301 assert result ["status" ] == "ok"
301302 payload = json .loads ((output_dir / "latest_signal.json" ).read_text (encoding = "utf-8" ))
302- assert payload ["strategy" ] == SOXL_STRATEGY_NAME
303+ assert payload ["strategy" ] == GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY
303304 assert payload ["plugin" ] == PLUGIN_MARKET_REGIME_CONTROL
304305 assert payload ["schema_version" ] in PLUGIN_SCHEMA_VERSIONS [PLUGIN_MARKET_REGIME_CONTROL ]
305306 assert payload ["canonical_route" ] == "no_action"
307+ assert payload ["execution_controls" ]["capital_impact" ] == "notification_only"
308+ assert payload ["execution_controls" ]["strategy_runtime_metadata_allowed" ] is False
309+
310+
311+ def test_strategy_plugin_runner_rejects_soxl_market_regime_control_mount (tmp_path ) -> None :
312+ prices_path = tmp_path / "market_regime_prices.csv"
313+ _soxl_quiet_prices ().to_csv (prices_path , index = False )
314+ config = {
315+ "output_dir" : str (tmp_path / "runner" ),
316+ "default_mode" : "shadow" ,
317+ "strategy_plugins" : [
318+ {
319+ "strategy" : SOXL_STRATEGY_NAME ,
320+ "plugin" : PLUGIN_MARKET_REGIME_CONTROL ,
321+ "enabled" : True ,
322+ "inputs" : {"prices" : str (prices_path ), "benchmark_symbol" : "SOXX" , "attack_symbol" : "SOXL" },
323+ }
324+ ],
325+ }
326+
327+ with pytest .raises (ValueError , match = "strategy-limited" ):
328+ run_configured_plugins (config )
306329
307330
308331def test_strategy_plugin_runner_contract_registry_prefers_unified_plugin () -> None :
309332 assert set (PLUGIN_COMPATIBLE_STRATEGIES [PLUGIN_MARKET_REGIME_CONTROL ]) == {
333+ GENERAL_MARKET_REGIME_NOTIFICATION_STRATEGY ,
310334 STRATEGY_NAME ,
311- SOXL_STRATEGY_NAME ,
312335 "global_etf_rotation" ,
313336 "russell_1000_multi_factor_defensive" ,
314337 "tech_communication_pullback_enhancement" ,
@@ -433,9 +456,8 @@ def test_strategy_plugin_runner_uses_default_mode_when_entry_mode_is_omitted(tmp
433456 assert payload ["execution_controls" ]["notification_profile" ] == "shadow_only"
434457
435458
436- def test_strategy_plugin_runner_mounts_crisis_shadow_to_soxl_strategy (tmp_path ) -> None :
459+ def test_strategy_plugin_runner_rejects_crisis_shadow_soxl_strategy_mount (tmp_path ) -> None :
437460 prices_path = tmp_path / "soxl_prices.csv"
438- output_dir = tmp_path / SOXL_STRATEGY_NAME / "plugins" / PLUGIN_CRISIS_RESPONSE_SHADOW
439461 _soxl_quiet_prices ().to_csv (prices_path , index = False )
440462 config = {
441463 "output_dir" : str (tmp_path / "runner" ),
@@ -455,21 +477,12 @@ def test_strategy_plugin_runner_mounts_crisis_shadow_to_soxl_strategy(tmp_path)
455477 "credit_pairs" : [],
456478 "rate_symbols" : [],
457479 },
458- "outputs" : {"output_dir" : str (output_dir )},
459480 }
460481 ],
461482 }
462483
463- summary = run_configured_plugins (config )
464-
465- result = summary ["strategy_plugins" ][0 ]
466- assert result ["strategy" ] == SOXL_STRATEGY_NAME
467- assert result ["plugin" ] == PLUGIN_CRISIS_RESPONSE_SHADOW
468- assert result ["effective_mode" ] == "shadow"
469- payload = json .loads ((output_dir / "latest_signal.json" ).read_text (encoding = "utf-8" ))
470- assert payload ["strategy" ] == SOXL_STRATEGY_NAME
471- assert payload ["evidence" ]["metrics" ]["benchmark_symbol" ] == "SOXX"
472- assert payload ["execution_controls" ]["broker_order_allowed" ] is False
484+ with pytest .raises (ValueError , match = "strategy-limited" ):
485+ run_configured_plugins (config )
473486
474487
475488def test_strategy_plugin_runner_filters_by_strategy (tmp_path ) -> None :
0 commit comments