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.

fix(decisions): say how many decisions were kept from how many candidates (#3088)

Raghav Chamadiya4295444f72aa
diff --git a/packages/core/src/repowise/core/pipeline/phases/analysis.py b/packages/core/src/repowise/core/pipeline/phases/analysis.py
index b16a10861..bf070ddb6 100644
--- a/packages/core/src/repowise/core/pipeline/phases/analysis.py
+++ b/packages/core/src/repowise/core/pipeline/phases/analysis.py
@@ -41,6 +41,7 @@ _DECISION_SOURCE_LABELS: tuple[tuple[str, str], ...] = (
("comment", "from comments"),
("session", "from agent sessions"),
("session_discovery", "from session discovery"),
+ ("conventions", "from code conventions"),
)
@@ -480,11 +481,17 @@ async def _run_decision_extraction(
if bs.get(source)
]
summary = ", ".join(found) if found else ""
- progress.on_message(
- "info",
- f"→ {report.total_found} architectural decisions found"
- + (f": {summary}" if summary else ""),
+ # The per-source counts are taken before the evidence gate and the
+ # total after it, so "5 found: 13 from git history, 3 from
+ # comments" did not add up. Say which number is which.
+ candidates = sum(bs.values())
+ headline = (
+ f"→ {report.total_found} architectural decisions kept from "
+ f"{candidates} candidates"
+ if candidates > report.total_found
+ else f"→ {report.total_found} architectural decisions found"
)
+ progress.on_message("info", headline + (f": {summary}" if summary else ""))
# And the sources that produced nothing. Hiding these was what made
# a source failing outright indistinguishable from a source with
# honestly nothing to find: every failure inside the extractor is
diff --git a/tests/unit/pipeline/test_decision_source_reporting.py b/tests/unit/pipeline/test_decision_source_reporting.py
index 5ee0917fb..632dca1dc 100644
--- a/tests/unit/pipeline/test_decision_source_reporting.py
+++ b/tests/unit/pipeline/test_decision_source_reporting.py
@@ -245,3 +245,37 @@ async def test_discovery_candidates_are_reported_even_when_nothing_promotes(
for level, text in progress.messages:
if level == "info" and ("Nothing found" in text or "Not run" in text):
assert "session discovery" not in text
+
+
+class _GatedExtractor(_StubExtractor):
+ """16 candidates across two sources, 5 survive the evidence gate."""
+
+ async def extract_all(self, on_step=None, enabled_sources=None):
+ return SimpleNamespace(
+ total_found=5,
+ decisions=[SimpleNamespace(source="git_archaeology")] * 5,
+ by_source={"git_archaeology": 13, "comment": 3},
+ failures={},
+ )
+
+
+async def test_the_headline_separates_kept_decisions_from_candidates(_patched, monkeypatch):
+ import repowise.core.analysis.decision_extractor as de
+
+ monkeypatch.setattr(de, "DecisionExtractor", _GatedExtractor)
+ progress = _RecordingProgress()
+
+ await _run_decision_extraction(
+ _patched,
+ llm_client=SimpleNamespace(),
+ graph_builder=SimpleNamespace(graph=lambda: None),
+ git_meta_map={},
+ parsed_files=[],
+ progress=progress,
+ )
+
+ assert (
+ "info",
+ "→ 5 architectural decisions kept from 16 candidates: "
+ "13 from git history, 3 from comments",
+ ) in progress.messages