|
1 | 1 | from __future__ import annotations |
2 | 2 |
|
| 3 | +import json |
| 4 | + |
3 | 5 | import pytest |
4 | 6 |
|
5 | 7 | from runtime_config_support import ( |
@@ -174,6 +176,32 @@ def test_runtime_target_enabled_loads_from_env(monkeypatch): |
174 | 176 | assert settings.runtime_target_enabled is False |
175 | 177 |
|
176 | 178 |
|
| 179 | +def test_live_continuity_paused_state_disables_standard_execution(monkeypatch): |
| 180 | + runtime_target = { |
| 181 | + "platform_id": "firstrade", |
| 182 | + "strategy_profile": "ibit_smart_dca", |
| 183 | + "dry_run_only": False, |
| 184 | + "execution_mode": "live", |
| 185 | + "live_continuity": { |
| 186 | + "state": "PAUSED", |
| 187 | + "baseline_kind": "legacy_authorized", |
| 188 | + "baseline_id": "ibit-firstrade-lkg-20260830", |
| 189 | + "baseline_target_sha256": "a" * 64, |
| 190 | + "captured_at": "2026-08-30", |
| 191 | + }, |
| 192 | + } |
| 193 | + from quant_platform_kit.common.live_continuity import runtime_target_fingerprint |
| 194 | + |
| 195 | + runtime_target["live_continuity"]["baseline_target_sha256"] = runtime_target_fingerprint(runtime_target) |
| 196 | + monkeypatch.setenv("RUNTIME_TARGET_JSON", json.dumps(runtime_target)) |
| 197 | + monkeypatch.setenv("FIRSTRADE_DRY_RUN_ONLY", "false") |
| 198 | + monkeypatch.setenv("RUNTIME_TARGET_ENABLED", "true") |
| 199 | + |
| 200 | + settings = load_platform_runtime_settings(project_id_resolver=lambda: "project-1") |
| 201 | + |
| 202 | + assert settings.runtime_target_enabled is False |
| 203 | + |
| 204 | + |
177 | 205 | def test_invalid_runtime_target_enabled_is_rejected(monkeypatch): |
178 | 206 | monkeypatch.setenv("RUNTIME_TARGET_JSON", _target_json()) |
179 | 207 | monkeypatch.setenv("RUNTIME_TARGET_ENABLED", "maybe") |
|
0 commit comments