Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(attention): a hand-recorded proposed decision is not auto-proposed (#4015)
yi11171412e937600
diff --git a/packages/core/src/repowise/core/analysis/attention/compose.py b/packages/core/src/repowise/core/analysis/attention/compose.pyindex 8cf9b71d3..d5604a337 100644--- a/packages/core/src/repowise/core/analysis/attention/compose.py+++ b/packages/core/src/repowise/core/analysis/attention/compose.py@@ -127,14 +127,19 @@ class SourceResult:@dataclass(frozen=True, slots=True)class DecisionAttentionInput:- """The two fields of a decision record the attention list shows.+ """The fields of a decision record the attention list shows.No staleness score: :func:`decision_source` never re-sorts a lane, so aproducer without one passes the stale lane in whatever order it trusts.++ ``source`` is the record's provenance (see ``SOURCE_RANK``): ``"cli"`` is a+ human-authored manual entry, everything else is a pipeline proposal. Only+ the proposed lane reads it — the wording of the description differs."""id: strtitle: str+ source: str = ""class AttentionArea(TypedDict):@@ -224,7 +229,11 @@ def decision_source("id": f"proposed-{d.id}","type": "proposed_decision","title": d.title,- "description": "Auto-proposed decision awaiting review",+ "description": (+ "Decision recorded by hand, awaiting review"+ if d.source == "cli"+ else "Auto-proposed decision awaiting review"+ ),"severity": "medium","target_id": d.id,}diff --git a/packages/server/src/repowise/server/services/attention.py b/packages/server/src/repowise/server/services/attention.pyindex bf1347aca..6b628e862 100644--- a/packages/server/src/repowise/server/services/attention.py+++ b/packages/server/src/repowise/server/services/attention.py@@ -386,7 +386,7 @@ def _decision_source(decision_health: dict) -> SourceResult:def lane(key: str) -> list[DecisionAttentionInput]:return [- DecisionAttentionInput(id=d.id, title=d.title)+ DecisionAttentionInput(id=d.id, title=d.title, source=getattr(d, "source", ""))for d in decision_health.get(key, []) or []]diff --git a/tests/unit/analysis/test_attention_compose.py b/tests/unit/analysis/test_attention_compose.pyindex 0caf29bde..faa46cb2e 100644--- a/tests/unit/analysis/test_attention_compose.py+++ b/tests/unit/analysis/test_attention_compose.py@@ -96,3 +96,23 @@ def test_every_item_type_is_ranked_and_rolled_up() -> None:)def test_file_score_maps_every_band(score: float, severity: str) -> None:assert severity_of_file_score(score) == severity+++def test_proposed_wording_names_a_hand_recorded_decision() -> None:+ """``source="cli"`` is a manual entry (``SOURCE_RANK``): it is not a proposal.++ The attention list's wording is what the Overview page, the dashboard and+ agent prompts repeat, so a human-recorded decision must not be described+ as auto-proposed (#3993).+ """+ result = decision_source(+ [],+ [+ DecisionAttentionInput(id="d-manual", title="Manual", source="cli"),+ DecisionAttentionInput(id="d-auto", title="Auto", source="inferred"),+ ],+ [],+ )+ descriptions = {item["target_id"]: item["description"] for item in result.items}+ assert descriptions["d-manual"] == "Decision recorded by hand, awaiting review"+ assert descriptions["d-auto"] == "Auto-proposed decision awaiting review"diff --git a/tests/unit/server/golden/overview_summary.json b/tests/unit/server/golden/overview_summary.jsonindex 9be2496fa..2a5cd5212 100644--- a/tests/unit/server/golden/overview_summary.json+++ b/tests/unit/server/golden/overview_summary.json@@ -140,7 +140,7 @@"id": "proposed-dec1","type": "proposed_decision","title": "Keep the engine single-threaded",- "description": "Auto-proposed decision awaiting review",+ "description": "Decision recorded by hand, awaiting review","severity": "medium","target_id": "dec1"},