diff --git a/.github/workflows/manual-strategy-switch.yml b/.github/workflows/manual-strategy-switch.yml index 63e9de8..0ae728a 100644 --- a/.github/workflows/manual-strategy-switch.yml +++ b/.github/workflows/manual-strategy-switch.yml @@ -377,7 +377,8 @@ jobs: base_url = os.environ["STRATEGY_SWITCH_CONSOLE_URL"].rstrip("/") token = os.environ["STRATEGY_SWITCH_SYNC_TOKEN"] if not token: - raise SystemExit("STRATEGY_SWITCH_SYNC_TOKEN is required when STRATEGY_SWITCH_CONSOLE_URL is set") + print("::warning::STRATEGY_SWITCH_SYNC_TOKEN is missing; account default sync skipped") + raise SystemExit(0) with open(os.environ["TARGET_FILE"], encoding="utf-8") as handle: target = json.load(handle) runtime_target = target["runtime_target"] @@ -412,7 +413,10 @@ jobs: body = response.read().decode("utf-8") except urllib.error.HTTPError as exc: body = exc.read().decode("utf-8", errors="replace") - print(body, file=sys.stderr) - raise + print(f"::warning::Strategy switch account default sync failed: HTTP {exc.code}: {body[:1000]}") + raise SystemExit(0) + except Exception as exc: # noqa: BLE001 + print(f"::warning::Strategy switch account default sync failed: {exc}") + raise SystemExit(0) print(body) PY diff --git a/tests/test_runtime_settings.py b/tests/test_runtime_settings.py index 684e952..8a42d44 100644 --- a/tests/test_runtime_settings.py +++ b/tests/test_runtime_settings.py @@ -128,6 +128,15 @@ def test_empty_assignment_deletes_variable_instead_of_setting_empty_body(self): self.assertNotIn("--body", assignment.shell_command()) self.assertEqual(runtime_settings.assignment_payload(assignment)["action"], "delete") + def test_manual_switch_account_default_sync_is_warning_only(self): + workflow = (ROOT / ".github" / "workflows" / "manual-strategy-switch.yml").read_text( + encoding="utf-8" + ) + + self.assertIn("Strategy switch account default sync failed", workflow) + self.assertIn("::warning::", workflow) + self.assertIn("raise SystemExit(0)", workflow) + def test_plugin_mount_schema_version_must_be_non_empty_string(self): _, target = self.load_target("examples/targets/schwab/live.example.json") target["plugin_mounts"][0]["expected_schema_version"] = ""