Skip to content

Commit 9cff967

Browse files
committed
Warn on account default sync failure
1 parent 176e8b0 commit 9cff967

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

.github/workflows/manual-strategy-switch.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,8 @@ jobs:
377377
base_url = os.environ["STRATEGY_SWITCH_CONSOLE_URL"].rstrip("/")
378378
token = os.environ["STRATEGY_SWITCH_SYNC_TOKEN"]
379379
if not token:
380-
raise SystemExit("STRATEGY_SWITCH_SYNC_TOKEN is required when STRATEGY_SWITCH_CONSOLE_URL is set")
380+
print("::warning::STRATEGY_SWITCH_SYNC_TOKEN is missing; account default sync skipped")
381+
raise SystemExit(0)
381382
with open(os.environ["TARGET_FILE"], encoding="utf-8") as handle:
382383
target = json.load(handle)
383384
runtime_target = target["runtime_target"]
@@ -412,7 +413,10 @@ jobs:
412413
body = response.read().decode("utf-8")
413414
except urllib.error.HTTPError as exc:
414415
body = exc.read().decode("utf-8", errors="replace")
415-
print(body, file=sys.stderr)
416-
raise
416+
print(f"::warning::Strategy switch account default sync failed: HTTP {exc.code}: {body[:1000]}")
417+
raise SystemExit(0)
418+
except Exception as exc: # noqa: BLE001
419+
print(f"::warning::Strategy switch account default sync failed: {exc}")
420+
raise SystemExit(0)
417421
print(body)
418422
PY

tests/test_runtime_settings.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,15 @@ def test_empty_assignment_deletes_variable_instead_of_setting_empty_body(self):
128128
self.assertNotIn("--body", assignment.shell_command())
129129
self.assertEqual(runtime_settings.assignment_payload(assignment)["action"], "delete")
130130

131+
def test_manual_switch_account_default_sync_is_warning_only(self):
132+
workflow = (ROOT / ".github" / "workflows" / "manual-strategy-switch.yml").read_text(
133+
encoding="utf-8"
134+
)
135+
136+
self.assertIn("Strategy switch account default sync failed", workflow)
137+
self.assertIn("::warning::", workflow)
138+
self.assertIn("raise SystemExit(0)", workflow)
139+
131140
def test_plugin_mount_schema_version_must_be_non_empty_string(self):
132141
_, target = self.load_target("examples/targets/schwab/live.example.json")
133142
target["plugin_mounts"][0]["expected_schema_version"] = ""

0 commit comments

Comments
 (0)