@@ -728,6 +728,78 @@ def test_strategy_plugin_manual_review_strategy_signal_still_alerts_plugin_bot(s
728728 self .assertEqual (len (alerts ), 1 )
729729 self .assertIn ("Manual review only" , alerts [0 ].body )
730730
731+ def test_delegated_manual_review_strategy_signal_stays_with_notification_target (self ):
732+ signal = validate_strategy_plugin_signal_payload (
733+ {
734+ ** _signal_payload (plugin = PLUGIN_MARKET_REGIME_CONTROL ),
735+ "canonical_route" : "opportunity_watch" ,
736+ "suggested_action" : "notify_manual_review" ,
737+ "would_trade_if_enabled" : False ,
738+ "execution_controls" : {
739+ ** _signal_payload ()["execution_controls" ],
740+ "strategy_runtime_metadata_allowed" : True ,
741+ "position_control_allowed" : True ,
742+ "consumption_evidence_status" : "automation_approved" ,
743+ "manual_review_notification_delegated" : True ,
744+ "manual_review_notification_target" : GENERAL_MARKET_REGIME_NOTIFICATION_TARGET ,
745+ "manual_review_notification_delegate" : (
746+ f"notification_target:{ GENERAL_MARKET_REGIME_NOTIFICATION_TARGET } "
747+ ),
748+ },
749+ }
750+ )
751+
752+ self .assertFalse (should_alert_strategy_plugin_signal (signal ))
753+ self .assertEqual (build_strategy_plugin_alert_messages ([signal ]), ())
754+
755+ def test_notification_target_alert_uses_localized_target_name (self ):
756+ signal = validate_strategy_plugin_signal_payload (
757+ {
758+ ** _signal_payload (plugin = PLUGIN_MARKET_REGIME_CONTROL ),
759+ "target_type" : "notification_target" ,
760+ "strategy" : "" ,
761+ "notification_target" : GENERAL_MARKET_REGIME_NOTIFICATION_TARGET ,
762+ "canonical_route" : "watch" ,
763+ "suggested_action" : "notify_manual_review" ,
764+ "would_trade_if_enabled" : False ,
765+ "execution_controls" : {
766+ ** _signal_payload ()["execution_controls" ],
767+ "strategy_runtime_metadata_allowed" : False ,
768+ "position_control_allowed" : False ,
769+ "consumption_evidence_status" : "notification_only" ,
770+ "capital_impact" : "notification_only" ,
771+ },
772+ }
773+ )
774+ translations = {
775+ "strategy_plugin_alert_subject" : "告警:{plugin}:{route}" ,
776+ "strategy_plugin_alert_title" : "插件告警" ,
777+ "strategy_plugin_alert_target" : "{target_name}={target}" ,
778+ "strategy_plugin_alert_target_name_notification_target" : "通知目标" ,
779+ "strategy_plugin_alert_plugin" : "插件={plugin}" ,
780+ "strategy_plugin_alert_status" : "状态={route}" ,
781+ "strategy_plugin_alert_action" : "建议={action}" ,
782+ "strategy_plugin_alert_mode" : "模式={mode}" ,
783+ "strategy_plugin_alert_as_of" : "时间={as_of}" ,
784+ "strategy_plugin_alert_scope_note" : "范围={scope_note}" ,
785+ "strategy_plugin_alert_scope" : "只通知人工复核" ,
786+ "strategy_plugin_name_market_regime_control" : "市场状态控制通知" ,
787+ "strategy_plugin_mode_shadow" : "影子观察" ,
788+ "strategy_plugin_route_watch" : "观察" ,
789+ "strategy_plugin_action_notify_manual_review" : "通知人工复核" ,
790+ }
791+
792+ alerts = build_strategy_plugin_alert_messages (
793+ [signal ],
794+ translator = lambda key , ** kwargs : translations .get (key , key ).format (** kwargs )
795+ if kwargs
796+ else translations .get (key , key ),
797+ )
798+
799+ self .assertEqual (len (alerts ), 1 )
800+ self .assertIn ("通知目标=market_regime_notification" , alerts [0 ].body )
801+ self .assertNotIn ("Notification target" , alerts [0 ].body )
802+
731803 def test_strategy_plugin_true_crisis_builds_generic_alert_message (self ):
732804 signal = validate_strategy_plugin_signal_payload (
733805 {
0 commit comments