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.
This commit is contained in:
kshitij 2026-08-03 18:26:32 +05:30
parent e3ce092f8d
commit 773d69057e
3 changed files with 5 additions and 8 deletions

View File

@ -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)
# =========================================================================

View File

@ -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"] == []

View File

@ -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