From 51d9aab4a0184ae5e78808af573444cfbf5935ff Mon Sep 17 00:00:00 2001 From: Deeman Date: Sat, 28 Feb 2026 20:55:44 +0100 Subject: [PATCH] fix(supervisor): use version-sorted tag list for current_deployed_tag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git describe --exact-match returns the first tag alphabetically when multiple tags point to the same commit. This caused an infinite redeploy loop when Gitea CI created a sequential tag (v11) on the same commit as our date-based tag (v202602281745) — v11 < v202602281745 alphabetically but the deploy check uses version sort where v202602281745 > v11. Fix: use git tag --points-at HEAD --sort=-version:refname to pick the highest-version tag at HEAD, matching the sort order of latest_remote_tag(). Co-Authored-By: Claude Sonnet 4.6 --- src/padelnomics/supervisor.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/padelnomics/supervisor.py b/src/padelnomics/supervisor.py index 735cf73..8815c90 100644 --- a/src/padelnomics/supervisor.py +++ b/src/padelnomics/supervisor.py @@ -279,12 +279,18 @@ def web_code_changed() -> bool: def current_deployed_tag() -> str | None: - """Return the tag currently checked out, or None if not on a tag.""" + """Return the highest-version tag pointing at HEAD, or None. + + Uses the same sort order as latest_remote_tag() so that when multiple + tags point to the same commit (e.g. a date-based tag and a CI integer + tag), we always compare apples-to-apples. + """ result = subprocess.run( - ["git", "describe", "--tags", "--exact-match", "HEAD"], + ["git", "tag", "--list", "--sort=-version:refname", "--points-at", "HEAD", "v*"], capture_output=True, text=True, timeout=10, ) - return result.stdout.strip() or None + tags = result.stdout.strip().splitlines() + return tags[0] if tags else None def latest_remote_tag() -> str | None: