Skip to content

The agent that grows with you

fix(release): accept CalVer majors in the canary tag shape

ethernet55d317eca7dc
diff --git a/hermes_cli/update_channel.py b/hermes_cli/update_channel.py
index b614e650282..0dbe13a0596 100644
--- a/hermes_cli/update_channel.py
+++ b/hermes_cli/update_channel.py
@@ -53,7 +53,7 @@ CHANNEL_CANARY = "canary"
# scripts/write_install_stamp.py (validates the feed key) import it rather
# than re-typing the rule. Canaries are current-stable patch+1, so any
# patch is accepted here.
-_CANARY_TAG_RE = re.compile(r"^v(?:0|[1-9]\d{0,2})\.\d+\.\d+-canary\.20\d{6}(?:\d{6})?$")
+_CANARY_TAG_RE = re.compile(r"^v(?:0|[1-9]\d*)\.\d+\.\d+-canary\.20\d{6}(?:\d{6})?$")
def is_canary_tag(tag: Any) -> bool:
diff --git a/scripts/termux/deb_version.py b/scripts/termux/deb_version.py
index 6e2c02f4ebc..47f8d729fe0 100644
--- a/scripts/termux/deb_version.py
+++ b/scripts/termux/deb_version.py
@@ -9,8 +9,8 @@ Mapping:
v1.2.3-canary.2026083112 -> 1.2.3~canary.2026083112-1
The ``~`` ranks the nightly below the corresponding stable in dpkg's version
-ordering. The major version is capped at 3 digits (CalVer-style cap): a tag
-with a 4+ digit major is rejected as malformed.
+ordering. No digit cap on any component: the repo's CalVer line (v2026.9.x)
+is a valid major.
``--channel`` derives the release channel from the SAME tag regex: a tag with
a nightly timestamp is ``nightly``, everything else is ``stable``. This is the
@@ -28,7 +28,7 @@ import sys
# channel_for_tag in scripts/releases/r2.py. Cross-referenced by
# tests/test_termux_deb_version.py::test_canary_tag_shape_matches_canonical.
_TAG_RE = re.compile(
- r"^v(?P<major>0|[1-9]\d{0,2})\.(?P<minor>\d+)\.(?P<patch>\d+)"
+ r"^v(?P<major>0|[1-9]\d*)\.(?P<minor>\d+)\.(?P<patch>\d+)"
r"(?:-canary\.(?P<ts>20\d{6}(?:\d{6})?))?$"
)
diff --git a/tests/test_termux_deb_version.py b/tests/test_termux_deb_version.py
index 6a602946fa1..0f861c1bf32 100644
--- a/tests/test_termux_deb_version.py
+++ b/tests/test_termux_deb_version.py
@@ -36,15 +36,34 @@ def test_apt_readers_accept_bom_and_keep_archive_bytes(tmp_path, bom):
("v1.234.567", "1.234.567-1", "stable"),
("v0.20.6-canary.20260831", "0.20.6~canary.20260831-1", "canary"),
("v0.20.6-canary.20260831120000", "0.20.6~canary.20260831120000-1", "canary"),
+ # The repo's CalVer line: a 4-digit major must pass BOTH the stable and
+ # the canary shape (handoff/validate_identity rejected v2026.9.15-canary
+ # while the same-minor stable passed — the major cap was canary-only).
+ ("v2026.9.14", "2026.9.14-1", "stable"),
+ ("v2026.9.15-canary.20260916120000", "2026.9.15~canary.20260916120000-1", "canary"),
])
def test_tag_mapping(tag, version, channel):
assert deb_version_for_tag(tag) == version
assert channel_for_tag(tag) == channel
+def test_canary_shape_matches_the_stable_shape_on_every_component():
+ # scripts/releases/semver.py::is_valid_version gates release handoffs;
+ # a canary cut over the newest stable must never be rejected when the
+ # stable tag itself is accepted.
+ from hermes_cli.update_channel import _CANARY_TAG_RE
+ from scripts.releases.semver import is_valid_version
+
+ assert _CANARY_TAG_RE.fullmatch("v2026.9.15-canary.20260916120000")
+ assert is_valid_version("2026.9.15-canary.20260916120000")
+ # And the malformed-tag negatives stay malformed.
+ assert not is_valid_version("2026.9.15-canary.2026091612")
+ assert not is_valid_version("2026.9.15-canary.20260916120000123")
+
+
@pytest.mark.parametrize("tag", [
"", "1.2.3", "v1.2", "v1.2.3.4", "v1.2.3-", "v1.2.3-canary", "v1.2.3-canary.abc",
- "v1.2.3-beta.1", "v1.2.x", "v-1.2.3", "v1234.1.2", "v99999.0.0",
+ "v1.2.3-beta.1", "v1.2.x", "v-1.2.3",
"v1.2.3-canary.202608311", "v1.2.3-canary.12345678", "v1.2.3-canary.202608311200001",
])
def test_malformed_tags_rejected_by_both_mappings(tag):