Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

1.1 KB
Raw Blame
"""Regression: chat summaries must cover every registered chat tool."""

from __future__ import annotations

from repowise.server.chat_summaries import _build_tool_summary
from repowise.server.chat_tools import get_tool_catalog


def test_get_change_risk_summary_is_not_generic_completed():
    summary = _build_tool_summary(
        "get_change_risk",
        {
            "ref": "HEAD",
            "score": 7.2,
            "review_priority": "high",
            "classification": "Above-typical diff size",
            "risk_percentile": 82.0,
        },
    )
    assert summary == "Diff size for HEAD: Above-typical diff size (p82.0)"


def test_every_chat_registry_tool_has_a_non_generic_summary_shape():
    """Smoke: registered tools either specialize or return Completed only as fallback."""
    catalog = get_tool_catalog(None)
    assert "get_change_risk" in {tool.entry.name for tool in catalog}
    # get_change_risk must not fall through to the generic Completed string.
    assert (
        _build_tool_summary("get_change_risk", {"ref": "main..HEAD", "review_priority": "Typical"})
        != "Completed"
    )