diff --git a/scripts/build_cloud_run_env_sync_plan.py b/scripts/build_cloud_run_env_sync_plan.py index 691ecb8d..85265a98 100644 --- a/scripts/build_cloud_run_env_sync_plan.py +++ b/scripts/build_cloud_run_env_sync_plan.py @@ -67,6 +67,10 @@ def _should_add_local_src(candidate: Path) -> bool: "LONGBRIDGE_MARKET_TIMEZONE", "LONGBRIDGE_SYMBOL_SUFFIX", "LONGBRIDGE_TRADING_CURRENCY", + # This value is scoped by the GitHub deployment Environment. Do not + # silently remove a configured plugin mount merely because a + # per-service target omits a duplicate copy of it. + "LONGBRIDGE_STRATEGY_PLUGIN_MOUNTS_JSON", } ) REQUIRED_ENV = ( diff --git a/tests/test_build_cloud_run_env_sync_plan.py b/tests/test_build_cloud_run_env_sync_plan.py index 4d8e20e9..0e6e8d21 100644 --- a/tests/test_build_cloud_run_env_sync_plan.py +++ b/tests/test_build_cloud_run_env_sync_plan.py @@ -208,6 +208,10 @@ def test_build_cloud_run_env_sync_plan_supports_per_service_targets(): **os.environ, "CLOUD_RUN_SERVICE_TARGETS_JSON": json.dumps(payload), "LONGBRIDGE_FEATURE_SNAPSHOT_PATH": "gs://stale-paper/snapshot.csv", + "LONGBRIDGE_STRATEGY_PLUGIN_MOUNTS_JSON": ( + '{"strategy_plugins":[{"strategy":"tqqq_growth_income",' + '"plugin":"market_regime_control","enabled":true}]}' + ), } result = subprocess.run( @@ -228,6 +232,10 @@ def test_build_cloud_run_env_sync_plan_supports_per_service_targets(): assert hk_verify["env"]["STRATEGY_PROFILE"] == "tqqq_growth_income" assert hk_verify["env"]["LONGBRIDGE_MARKET"] == "HK" assert hk_verify["env"]["LONGBRIDGE_TRADING_CURRENCY"] == "HKD" + assert hk_verify["env"]["LONGBRIDGE_STRATEGY_PLUGIN_MOUNTS_JSON"] == ( + '{"strategy_plugins":[{"strategy":"tqqq_growth_income",' + '"plugin":"market_regime_control","enabled":true}]}' + ) assert hk_verify["scheduler"] == { "timezone": "Asia/Hong_Kong", "main_time": "10 16", @@ -251,6 +259,10 @@ def test_build_cloud_run_env_sync_plan_supports_per_service_targets(): live_mega["env"]["LONGBRIDGE_FEATURE_SNAPSHOT_MANIFEST_PATH"] == "gs://runtime/mega/snapshot.csv.manifest.json" ) + assert live_mega["env"]["LONGBRIDGE_STRATEGY_PLUGIN_MOUNTS_JSON"] == ( + '{"strategy_plugins":[{"strategy":"tqqq_growth_income",' + '"plugin":"market_regime_control","enabled":true}]}' + ) def test_current_service_uses_environment_runtime_enabled_state():