From c0f22fcd973bfebc2e12c98da042441bf2b459f9 Mon Sep 17 00:00:00 2001 From: Jer Miller Date: Sat, 25 Jul 2026 20:35:18 -0600 Subject: [PATCH] refactor(convey): rename resolve_facet_icon_svg to resolve_icon_svg Rename the shared icon resolver now that activities use the same icon/emoji precedence as facets. This is a clean break with no alias: existing callers in shell data, settings facet payloads, and icon tests move to resolve_icon_svg. --- solstone/apps/settings/routes.py | 4 ++-- solstone/convey/icons.py | 4 ++-- solstone/convey/shell_data.py | 6 ++---- tests/test_icons.py | 14 +++++++------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/solstone/apps/settings/routes.py b/solstone/apps/settings/routes.py index fd7336c4c..cbb42a386 100644 --- a/solstone/apps/settings/routes.py +++ b/solstone/apps/settings/routes.py @@ -26,7 +26,7 @@ from solstone.apps.settings import install_copy, transcribe_resource from solstone.apps.utils import log_app_action from solstone.convey import chat_stream, state from solstone.convey import copy as convey_copy -from solstone.convey.icons import resolve_facet_icon_svg +from solstone.convey.icons import resolve_icon_svg from solstone.convey.reasons import ( ACTIVITY_INVALID, ACTIVITY_NOT_FOUND, @@ -131,7 +131,7 @@ def _public_facet_record(name: str, data: dict[str, object]) -> dict[str, object "color": str(data.get("color") or ""), "emoji": str(data.get("emoji") or ""), "icon": str(data.get("icon") or ""), - "icon_svg": resolve_facet_icon_svg( + "icon_svg": resolve_icon_svg( data.get("icon"), str(data.get("emoji") or "") ), "muted": bool(data.get("muted", False)), diff --git a/solstone/convey/icons.py b/solstone/convey/icons.py index 3bd97f7a4..bced2e4c6 100644 --- a/solstone/convey/icons.py +++ b/solstone/convey/icons.py @@ -104,8 +104,8 @@ def lucide_svg_for_emoji(emoji: str) -> str | None: return lucide_svg(icon_name) -def resolve_facet_icon_svg(icon: str | None, emoji: str) -> str | None: - """Resolve a facet icon override, falling back to the emoji mapping.""" +def resolve_icon_svg(icon: str | None, emoji: str) -> str | None: + """Resolve a Lucide icon override, falling back to the emoji mapping.""" if icon: svg = lucide_svg(icon) if svg is not None: diff --git a/solstone/convey/shell_data.py b/solstone/convey/shell_data.py index 9fce5554c..549008745 100644 --- a/solstone/convey/shell_data.py +++ b/solstone/convey/shell_data.py @@ -22,7 +22,7 @@ from solstone.convey.config import ( reporting_enabled, set_selected_facet, ) -from solstone.convey.icons import APP_LUCIDE_MAP, lucide_svg, resolve_facet_icon_svg +from solstone.convey.icons import APP_LUCIDE_MAP, lucide_svg, resolve_icon_svg from solstone.convey.provider_readiness import is_blocking_reason, present_for_reason from solstone.think.talent_runs import AgentFailure, read_unresolved_agent_failures @@ -57,9 +57,7 @@ def _get_facets_data() -> list[dict]: "color": data.get("color", ""), "emoji": data.get("emoji", ""), "icon": data.get("icon", ""), - "icon_svg": resolve_facet_icon_svg( - data.get("icon"), data.get("emoji", "") - ), + "icon_svg": resolve_icon_svg(data.get("icon"), data.get("emoji", "")), } ) diff --git a/tests/test_icons.py b/tests/test_icons.py index a6bd0d7d7..b0141c8a3 100644 --- a/tests/test_icons.py +++ b/tests/test_icons.py @@ -17,7 +17,7 @@ from solstone.convey.icons import ( is_lucide_icon, lucide_svg, lucide_svg_for_emoji, - resolve_facet_icon_svg, + resolve_icon_svg, search_lucide_icons, ) @@ -54,14 +54,14 @@ def test_lucide_svg_for_emoji_hit_and_miss() -> None: assert lucide_svg_for_emoji("🪮") is None -def test_resolve_facet_icon_svg_precedence_and_fallback() -> None: - assert resolve_facet_icon_svg("brain", "📚") == lucide_svg("brain") - assert resolve_facet_icon_svg(None, "📚") == lucide_svg("library") - assert resolve_facet_icon_svg("", "📚") == lucide_svg("library") - assert resolve_facet_icon_svg("definitely-not-an-icon", "📚") == lucide_svg( +def test_resolve_icon_svg_precedence_and_fallback() -> None: + assert resolve_icon_svg("brain", "📚") == lucide_svg("brain") + assert resolve_icon_svg(None, "📚") == lucide_svg("library") + assert resolve_icon_svg("", "📚") == lucide_svg("library") + assert resolve_icon_svg("definitely-not-an-icon", "📚") == lucide_svg( "library" ) - assert resolve_facet_icon_svg("coins", "🪮") == lucide_svg("coins") + assert resolve_icon_svg("coins", "🪮") == lucide_svg("coins") def test_search_lucide_icons_lock_matches_name_or_tag() -> None: -- 2.51.2