Skip to content

The agent that grows with you

fix(icons): the renderer carries its own canary rule; hermes_cli is absent in its venv

ethernet5e63231e2d31
diff --git a/scripts/generate_icons.py b/scripts/generate_icons.py
index 089dacaafde..a560dea9604 100644
--- a/scripts/generate_icons.py
+++ b/scripts/generate_icons.py
@@ -106,6 +106,11 @@ except ImportError:
" node scripts/generate-icons.mjs"
)
+# Copy of hermes_cli.update_channel._CANARY_TAG_RE: this renderer runs in an
+# isolated icon-build venv (Nix, Docker, PM) where the application package is
+# absent. tests/scripts/test_icon_flavors.py pins it to the canonical one.
+_CANARY_TAG_RE = re.compile(r"^v(?:0|[1-9]\d*)\.\d+\.\d+-canary\.20\d{6}(?:\d{6})?$")
+
# The nous dark background (#0d1117) — fixed dark tile/background everywhere.
DARK_HEX = "#0d1117"
DARK_RGB = (13, 17, 23)
@@ -506,9 +511,7 @@ def build_art(source: Path) -> tuple[IconArt, IconArt]:
if not re.fullmatch(r"[a-f0-9]{40}", commit):
raise ValueError("HERMES_BUILD_COMMIT requires an exact full 40-character SHA")
return art, IconArt(source, colors=("#e34850", "#4a1117"), commit=commit)
- from hermes_cli.update_channel import is_canary_tag
-
- if is_canary_tag(tag):
+ if _CANARY_TAG_RE.match(tag.strip()):
return art, IconArt(source, colors=("#f5cc32", "#443808"))
return art, art
diff --git a/tests/scripts/test_icon_flavors.py b/tests/scripts/test_icon_flavors.py
index 14045781d71..70dc48de1f6 100644
--- a/tests/scripts/test_icon_flavors.py
+++ b/tests/scripts/test_icon_flavors.py
@@ -130,6 +130,23 @@ def assert_unbranded_outputs(stable, flavored):
assert path.read_bytes() == (flavored / path.relative_to(stable)).read_bytes(), path
+def test_renderer_canary_rule_is_the_canonical_one(monkeypatch):
+ """The renderer runs without the application package installed, so it carries
+ its own copy of the canary rule; both rules must agree on every tag shape."""
+ import importlib.util
+ import types
+ from hermes_cli.update_channel import is_canary_tag
+
+ monkeypatch.setitem(sys.modules, "resvg_py", types.ModuleType("resvg_py"))
+ spec = importlib.util.spec_from_file_location("generate_icons", ROOT / "scripts/generate_icons.py")
+ assert spec is not None and spec.loader is not None
+ module = importlib.util.module_from_spec(spec)
+ spec.loader.exec_module(module)
+ for tag in ("v1.2.3-canary.20260911", "v1.2.3-canary.20260911010203", "v2026.9.15-canary.20260916120000",
+ "v1.2.3", "v1.2.3-canary.2026091101", "v1.2.3-canary.20260911010203123", "01.2.3-canary.20260911", ""):
+ assert bool(module._CANARY_TAG_RE.match(tag)) == is_canary_tag(tag), tag
+
+
def test_canary_changes_only_desktop_background_preserving_art_and_native_geometry(generate):
stable = generate("v1.2.3")
canary = generate("v1.2.3-canary.20260911010203")