fix(update): hourly check interval + wait for fresh fetch before pre-scan prompt

This commit is contained in:
Alex Schapiro
2026-07-28 05:09:58 +00:00
parent ac0014fe65
commit 9821ada7c5
3 changed files with 34 additions and 7 deletions
+21
View File
@@ -132,6 +132,27 @@ def test_write_cache_preserves_existing_fields() -> None:
assert cache == {"latest_version": "1.2.3", "checked_at": 123.0, "skipped_version": "9.9.9"}
def test_prompt_join_waits_for_fresh_fetch(monkeypatch: pytest.MonkeyPatch) -> None:
update_check._CACHE_PATH.write_text(
json.dumps({"latest_version": "1.0.0", "checked_at": time.time() - 2 * 60 * 60})
)
monkeypatch.setattr(update_check, "get_version", lambda: "1.0.0")
def slow_fetch() -> str:
time.sleep(0.5)
return "9.9.9"
monkeypatch.setattr(update_check, "_fetch_latest_version", slow_fetch)
update_check.start_background_check()
assert update_check.get_available_update(join_timeout=0.0) is None
assert (
update_check.get_available_update(
join_timeout=update_check.PROMPT_JOIN_TIMEOUT_SECONDS,
)
== "9.9.9"
)
def test_get_upgrade_command_all_methods() -> None:
assert update_check.get_upgrade_command("binary") == "strix --update"
assert update_check.get_upgrade_command("pipx") == "pipx upgrade strix-agent"