diff --git a/repeater/web/update_endpoints.py b/repeater/web/update_endpoints.py index 9cc031a..08c433f 100644 --- a/repeater/web/update_endpoints.py +++ b/repeater/web/update_endpoints.py @@ -693,6 +693,10 @@ def _fetch_latest_version(channel: str) -> str: raise RuntimeError( f"Could not compare {base_tag}...{channel} on GitHub: {exc}" ) from exc + # On an exact tag (ahead_by == 0), setuptools-scm reports the tag + # itself, not next-patch.dev0. + if ahead_by <= 0: + return base_tag return _next_dev_version(base_tag, ahead_by) # Static version channel — read the pinned version from pyproject.toml on diff --git a/tests/test_update_endpoints_unit.py b/tests/test_update_endpoints_unit.py index e803331..26cc02a 100644 --- a/tests/test_update_endpoints_unit.py +++ b/tests/test_update_endpoints_unit.py @@ -337,6 +337,11 @@ def test_fetch_latest_version_dynamic_and_static(monkeypatch): dyn = ue._fetch_latest_version("dev") assert dyn == "1.0.6.dev3" + # Exact tag (ahead_by == 0) must resolve to the tag, not next.dev0. + monkeypatch.setattr(ue, "_fetch_url", lambda _url, timeout=10: '{"ahead_by": 0}') + on_tag = ue._fetch_latest_version("main") + assert on_tag == "1.0.5" + # Static branch path parses version from pyproject content. monkeypatch.setattr(ue, "_branch_is_dynamic", lambda _ch: False) monkeypatch.setattr(