From fec5fce34de192eef19311da5a2a68e5a831d1fc Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Thu, 25 Jun 2026 06:17:07 +0800 Subject: [PATCH] Clarify plugin impact notification copy --- notifications/telegram.py | 24 ++++++++++++------------ tests/test_rebalance_service.py | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/notifications/telegram.py b/notifications/telegram.py index 211d444..0d0f1a7 100644 --- a/notifications/telegram.py +++ b/notifications/telegram.py @@ -197,12 +197,12 @@ def format_small_account_whole_share_bootstrap_notes( "strategy_plugin_line": "🧩 插件:{plugin} | 启用:{enabled} | 状态:{route} | 提醒:{action}", "strategy_plugin_enabled_true": "是", "strategy_plugin_enabled_false": "否", - "strategy_plugin_consumption_auto": "🧩 插件消费:已按策略规则参与本轮仓位计算", - "strategy_plugin_consumption_auto_defend": "🧩 插件消费:已按策略规则参与本轮仓位计算;风险仓位按防守规则处理", - "strategy_plugin_consumption_auto_delever": "🧩 插件消费:已按策略规则参与本轮仓位计算;杠杆仓位按降档规则缩放", - "strategy_plugin_consumption_loaded_not_applied": "🧩 插件消费:已加载但未改写仓位;当前策略未启用该状态的自动消费", - "strategy_plugin_consumption_review_only": "🧩 插件消费:仅通知复核,未参与自动仓位计算", - "strategy_plugin_consumption_unavailable": "🧩 插件消费:未消费插件信号", + "strategy_plugin_consumption_auto": "🧩 插件本次影响:已按策略规则参与本轮仓位计算", + "strategy_plugin_consumption_auto_defend": "🧩 插件本次影响:已触发防守规则并参与本轮仓位计算", + "strategy_plugin_consumption_auto_delever": "🧩 插件本次影响:已触发降杠杆规则并参与本轮仓位计算", + "strategy_plugin_consumption_loaded_not_applied": "🧩 插件本次影响:已加载;该状态未启用自动仓位改写", + "strategy_plugin_consumption_review_only": "🧩 插件本次影响:仅通知复核;当前状态未触发自动仓位改写", + "strategy_plugin_consumption_unavailable": "🧩 插件本次影响:未加载可用插件信号", "strategy_plugin_alert_subject": "🚨 策略插件告警:{plugin} | {route}", "strategy_plugin_alert_title": "🚨 【策略插件告警】", "strategy_plugin_alert_context": "运行环境:{context}", @@ -358,12 +358,12 @@ def format_small_account_whole_share_bootstrap_notes( "strategy_plugin_line": "🧩 Plugin: {plugin} | enabled: {enabled} | status: {route} | notice: {action}", "strategy_plugin_enabled_true": "yes", "strategy_plugin_enabled_false": "no", - "strategy_plugin_consumption_auto": "🧩 Plugin consumption: included in this cycle's position calculation under strategy rules", - "strategy_plugin_consumption_auto_defend": "🧩 Plugin consumption: included in this cycle's position calculation; risk exposure follows defensive rules", - "strategy_plugin_consumption_auto_delever": "🧩 Plugin consumption: included in this cycle's position calculation; leveraged exposure follows de-risking rules", - "strategy_plugin_consumption_loaded_not_applied": "🧩 Plugin consumption: loaded but did not rewrite positions; this strategy does not enable automatic consumption for this state", - "strategy_plugin_consumption_review_only": "🧩 Plugin consumption: review-only notice, not used for automatic position calculation", - "strategy_plugin_consumption_unavailable": "🧩 Plugin consumption: no plugin signal consumed", + "strategy_plugin_consumption_auto": "🧩 Plugin impact this run: included in this cycle's position calculation under strategy rules", + "strategy_plugin_consumption_auto_defend": "🧩 Plugin impact this run: triggered defensive rules and joined this cycle's position calculation", + "strategy_plugin_consumption_auto_delever": "🧩 Plugin impact this run: triggered de-levering rules and joined this cycle's position calculation", + "strategy_plugin_consumption_loaded_not_applied": "🧩 Plugin impact this run: loaded; this state did not enable automatic position rewrites", + "strategy_plugin_consumption_review_only": "🧩 Plugin impact this run: review-only notice; current state did not trigger automatic position rewrites", + "strategy_plugin_consumption_unavailable": "🧩 Plugin impact this run: no usable plugin signal loaded", "strategy_plugin_alert_subject": "🚨 Strategy plugin alert: {plugin} | {route}", "strategy_plugin_alert_title": "🚨 【Strategy Plugin Alert】", "strategy_plugin_alert_context": "Context: {context}", diff --git a/tests/test_rebalance_service.py b/tests/test_rebalance_service.py index 7a62935..dda112c 100644 --- a/tests/test_rebalance_service.py +++ b/tests/test_rebalance_service.py @@ -453,7 +453,7 @@ def test_run_strategy_cycle_strategy_plugin_load_error_is_non_blocking(monkeypat assert result["strategy_plugin_error"].startswith("JSONDecodeError:") assert result["strategy_plugin_error_lines"] == ( "⚠️ Plugin signal failed to load: invalid plugin mount JSON; this run falls back to built-in strategy rules", - "🧩 Plugin consumption: no plugin signal consumed", + "🧩 Plugin impact this run: no usable plugin signal loaded", ) assert result["strategy_plugin_alert_email_sent_count"] == 0 assert result["strategy_plugin_alert_sms_sent_count"] == 0