The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(shared-metrics): Microsoft Store installs report their own install_method
ethernet0c864cebfb0f
diff --git a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.jsonindex 36e771a9b49..612abaca109 100644--- a/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json+++ b/hermes_cli/observability/schemas/hermes.shared_metrics.v4.schema.json@@ -70,6 +70,7 @@"git","home-manager","homebrew",+ "microsoft-store","nixos","pip","unknown"diff --git a/hermes_cli/observability/shared_metrics_contract.py b/hermes_cli/observability/shared_metrics_contract.pyindex 83e593a81c0..aff5e6f634f 100644--- a/hermes_cli/observability/shared_metrics_contract.py+++ b/hermes_cli/observability/shared_metrics_contract.py@@ -138,7 +138,7 @@ SKILL_POST_PATCH_STATES = frozenset({"no_new_patch", "not_applicable", "reused_aCLIENT_OS_FAMILIES = frozenset({"linux", "macos", "unknown", "windows"})CLIENT_ARCHITECTURES = frozenset({"arm", "arm64", "unknown", "x86", "x86_64"})CLIENT_INSTALL_METHODS = frozenset({- "apt", "docker", "git", "home-manager", "homebrew", "nixos", "pip", "unknown",+ "apt", "docker", "git", "home-manager", "homebrew", "microsoft-store", "nixos", "pip", "unknown",})CLIENT_RESOURCE_KEYS = frozenset({"architecture", "hermes_version", "install_method", "os_family"})diff --git a/hermes_cli/observability/shared_metrics_desktop.py b/hermes_cli/observability/shared_metrics_desktop.pyindex c20852d2955..340f7f6379a 100644--- a/hermes_cli/observability/shared_metrics_desktop.py+++ b/hermes_cli/observability/shared_metrics_desktop.py@@ -90,14 +90,14 @@ def friction_pair(kind: Any, detail: Any) -> tuple[str, str] | None:def _store_and_resource() -> tuple[Any, dict[str, str]]:"""The active profile's store and client resource (the subscriber's), for rows that latchdurably or belong to a past period and so cannot ride the relay's current-day marks."""- from hermes_cli.config import detect_install_methodfrom hermes_cli.version_info import get_version_infofrom .shared_metrics import SharedMetricsStore+ from .shared_metrics_install import detect_client_install_methodreturn SharedMetricsStore(), contract.client_resource(get_version_info().base_version, os_name=platform.system(), architecture=platform.machine(),- install_method=detect_install_method(),+ install_method=detect_client_install_method(),)diff --git a/hermes_cli/observability/shared_metrics_install.py b/hermes_cli/observability/shared_metrics_install.pyindex 81e7d6a8033..a9145d3c78b 100644--- a/hermes_cli/observability/shared_metrics_install.py+++ b/hermes_cli/observability/shared_metrics_install.py@@ -61,6 +61,19 @@ def _project_root() -> Path:return get_project_root()+def detect_client_install_method() -> str:+ """``detect_install_method()``, except the Microsoft Store build, which the stamp names and+ that function's update-gating vocabulary has no word for (it would read ``unknown``).+ Kept out of ``detect_install_method`` on purpose: update and uninstall branch on its result."""+ from hermes_cli.config import detect_install_method+ from hermes_cli.steward import read_install_stamp++ root = _project_root()+ if read_install_stamp(root).get("updateMechanism") == "microsoft-store":+ return "microsoft-store"+ return detect_install_method(root)++def release_channel(config: dict[str, Any]) -> str:"""The channel this install follows: a package's baked channel, a source install's channelrecord, else the checkout's branch (``main`` for main/master, ``dev`` for any other)."""diff --git a/hermes_cli/observability/shared_metrics_subscriber.py b/hermes_cli/observability/shared_metrics_subscriber.pyindex 5c6a9e83762..078c371aab6 100644--- a/hermes_cli/observability/shared_metrics_subscriber.py+++ b/hermes_cli/observability/shared_metrics_subscriber.py@@ -8,13 +8,13 @@ import threadingfrom typing import Anyfrom agent.relay_runtime import RUNTIME_INSTANCE_KEY-from hermes_cli.config import detect_install_methodfrom hermes_constants import get_hermes_homefrom . import shared_metrics_engagement as engagementfrom . import shared_metrics_signals as signalsfrom .shared_metrics import SharedMetricsStorefrom .shared_metrics_fields import milestones_for+from .shared_metrics_install import detect_client_install_methodfrom .shared_metrics_contract import (CLIENT_ACTIVE_METRIC,COMMIT_TICKET_KEY,@@ -80,7 +80,7 @@ class SharedMetricsSubscriber:hermes_version,os_name=platform.system(),architecture=platform.machine(),- install_method=detect_install_method(),+ install_method=detect_client_install_method(),)self._runtime_id = runtime_idself._active = Truediff --git a/tests/hermes_cli/test_relay_shared_metrics.py b/tests/hermes_cli/test_relay_shared_metrics.pyindex a4eaa4852c1..38ff899d2d0 100644--- a/tests/hermes_cli/test_relay_shared_metrics.py+++ b/tests/hermes_cli/test_relay_shared_metrics.py@@ -521,6 +521,7 @@ def test_client_resource_classification_is_bounded():assert client_install_method("Homebrew") == "homebrew"assert client_install_method("nix") == "nixos"assert client_install_method("apt") == "apt"+ assert client_install_method("microsoft-store") == "microsoft-store"assert client_resource("",@@ -534,6 +535,19 @@ def test_client_resource_classification_is_bounded():install_method="unknown",)+def test_microsoft_store_stamp_reports_its_own_install_method(tmp_path, monkeypatch):+ """The Store build's stamp is the only place it is named; ``detect_install_method`` has no word for it."""+ from hermes_cli.observability.shared_metrics_install import detect_client_install_method++ monkeypatch.setattr("hermes_cli.config.get_project_root", lambda: tmp_path)+ stamp = tmp_path / "install-stamp.json"+ stamp.write_text(json.dumps({"updateMechanism": "microsoft-store"}), encoding="utf-8")+ assert detect_client_install_method() == "microsoft-store"++ stamp.write_text(json.dumps({"updateMechanism": "app-installer"}), encoding="utf-8")+ assert detect_client_install_method() == "unknown"++def test_package_schema_matches_the_client_resource_contract():schema = json.loads(SCHEMA_PATH.read_text(encoding="utf-8"))resource = schema["properties"]["resource"]