From 773d69057e4eb91630ec6f7db7e15921b05d09a1 Mon Sep 17 00:00:00 2001 From: kshitij <82637225+kshitijk4poor@users.noreply.github.com> Date: Mon, 3 Aug 2026 18:26:32 +0530 Subject: [PATCH] refactor(insights): drop consumer-less get_skill_breakdown alias (simplify-pass) The 2-line alias had zero production consumers (web_server calls get_usage_breakdown directly). Tests rewired onto the real API; the contracts they pin are unchanged. Stale test docstring fixed. --- agent/insights.py | 3 --- tests/agent/test_insights.py | 8 ++++---- tests/hermes_cli/test_web_server.py | 2 +- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/agent/insights.py b/agent/insights.py index efcc9c1fecd0a..34e78a6ff9d63 100644 --- a/agent/insights.py +++ b/agent/insights.py @@ -211,9 +211,6 @@ class InsightsEngine: "skills": self._compute_skill_breakdown(skill_usage), } - def get_skill_breakdown(self, days: int = 30, source: str = None) -> Dict[str, Any]: - return self.get_usage_breakdown(days=days, source=source)["skills"] - # ========================================================================= # Data gathering (SQL queries) # ========================================================================= diff --git a/tests/agent/test_insights.py b/tests/agent/test_insights.py index c9b5474b943ff..2d42ab62e1483 100644 --- a/tests/agent/test_insights.py +++ b/tests/agent/test_insights.py @@ -476,7 +476,7 @@ class TestInsightsPopulated: def test_get_skill_breakdown_matches_full_generate(self, populated_db): engine = InsightsEngine(populated_db) full = engine.generate(days=30) - focused = engine.get_skill_breakdown(days=30) + focused = engine.get_usage_breakdown(days=30)["skills"] assert focused == full["skills"] def test_get_usage_breakdown_matches_full_generate(self, populated_db): @@ -489,14 +489,14 @@ class TestInsightsPopulated: def test_get_skill_breakdown_respects_source_filter(self, populated_db): engine = InsightsEngine(populated_db) # Only s1 (cli) has skill_view "github-pr-workflow" - focused = engine.get_skill_breakdown(days=30, source="cli") + focused = engine.get_usage_breakdown(days=30, source="cli")["skills"] skill_names = [s["skill"] for s in focused["top_skills"]] assert "github-pr-workflow" in skill_names # github-code-review was in discord (s4), not cli assert "github-code-review" not in skill_names def test_get_skill_breakdown_empty_db(self, db): - focused = InsightsEngine(db).get_skill_breakdown(days=30) + focused = InsightsEngine(db).get_usage_breakdown(days=30)["skills"] assert focused == { "summary": { "total_skill_loads": 0, @@ -519,7 +519,7 @@ class TestInsightsPopulated: tool_calls=[{"function": {"name": "read_file", "arguments": '{"path":"/tmp/x"}'}}], ) db._conn.commit() - focused = InsightsEngine(db).get_skill_breakdown(days=30) + focused = InsightsEngine(db).get_usage_breakdown(days=30)["skills"] assert focused["summary"]["total_skill_actions"] == 0 assert focused["top_skills"] == [] diff --git a/tests/hermes_cli/test_web_server.py b/tests/hermes_cli/test_web_server.py index 99543f994b76e..f2ef19fc2816c 100644 --- a/tests/hermes_cli/test_web_server.py +++ b/tests/hermes_cli/test_web_server.py @@ -2223,7 +2223,7 @@ class TestNewEndpoints: assert top_skill["last_used_at"] is not None def test_analytics_usage_skips_full_insights_generate(self): - """get_usage_analytics must call get_skill_breakdown, not generate().""" + """get_usage_analytics must call get_usage_breakdown, not generate().""" from unittest.mock import patch from agent.insights import InsightsEngine from hermes_state import SessionDB