Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(release): detect post releases

cyh787271f5715a
diff --git a/tests/test_upgrade_flow.py b/tests/test_upgrade_flow.py
index a2255e482..6c3b48d88 100644
--- a/tests/test_upgrade_flow.py
+++ b/tests/test_upgrade_flow.py
@@ -193,9 +193,31 @@ def test_get_latest_version_info_allows_newer_dotted_dev_for_prerelease_current(
assert info == {"current": "2.2.9.dev1", "latest": "2.2.9.dev2", "has_update": True, "error": None}
+def test_get_latest_version_info_detects_post_release_for_stable_current(monkeypatch, tmp_path):
+ metadata_path = tmp_path / "metadata.json"
+ metadata_path.write_text(
+ """
+ {
+ "info": {"version": "2.2.8.post1"},
+ "releases": {
+ "2.2.8": [{}],
+ "2.2.8.post1": [{}]
+ }
+ }
+ """,
+ encoding="utf-8",
+ )
+ monkeypatch.setenv("VIBE_UPDATE_METADATA_URL", metadata_path.as_uri())
+
+ info = get_latest_version_info("2.2.8")
+
+ assert info == {"current": "2.2.8", "latest": "2.2.8.post1", "has_update": True, "error": None}
+
+
def test_has_newer_version_handles_prerelease_without_packaging():
assert has_newer_version("2.2.8rc2", "2.2.8rc1") is True
assert has_newer_version("2.2.8", "2.2.8rc2") is True
+ assert has_newer_version("2.2.8.post1", "2.2.8") is True
assert has_newer_version("2.2.8rc1", "2.2.8") is False
assert has_newer_version("2.2.9.dev2", "2.2.9.dev1") is True
diff --git a/vibe/upgrade.py b/vibe/upgrade.py
index ef7182636..fbab6d619 100644
--- a/vibe/upgrade.py
+++ b/vibe/upgrade.py
@@ -20,7 +20,8 @@ CURRENT_VIBE_EXECUTABLE_ENV = "VIBE_CURRENT_EXECUTABLE"
UV_FALLBACK_BIN_DIRS = (".local/bin", ".cargo/bin")
_VERSION_RE = re.compile(
r"^\s*v?(?P<release>\d+(?:\.\d+)*)"
- r"(?:(?:[.-])?(?P<stage>a|b|rc|dev)(?P<stage_num>\d+))?\s*$"
+ r"(?:(?:[.-])?(?P<stage>a|b|rc|dev)(?P<stage_num>\d+))?"
+ r"(?:(?:[.-])?post(?P<post_num>\d+))?\s*$"
)
_STAGE_ORDER = {"dev": 0, "a": 1, "b": 2, "rc": 3, "final": 4}
@@ -179,7 +180,7 @@ def _normalize_release_parts(parts: tuple[int, ...]) -> tuple[int, ...]:
return tuple(normalized)
-def _parse_version(value: str) -> tuple[tuple[int, ...], int, int] | None:
+def _parse_version(value: str) -> tuple[tuple[int, ...], int, int, int, int] | None:
match = _VERSION_RE.match(value)
if not match:
return None
@@ -187,7 +188,9 @@ def _parse_version(value: str) -> tuple[tuple[int, ...], int, int] | None:
release = tuple(int(part) for part in match.group("release").split("."))
stage = match.group("stage") or "final"
stage_num = int(match.group("stage_num") or "0")
- return (_normalize_release_parts(release), _STAGE_ORDER[stage], stage_num)
+ post_num = int(match.group("post_num") or "0")
+ has_post = 1 if match.group("post_num") else 0
+ return (_normalize_release_parts(release), _STAGE_ORDER[stage], stage_num, has_post, post_num)
def _is_prerelease_version(value: str) -> bool: