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(editor-files): bug-fix counts name their 6-month window beside 90-day churn (#4364)
Raghav Chamadiyaabcbdfbd6398
diff --git a/docs/architecture/editor-files.md b/docs/architecture/editor-files.mdindex 2955b1e41..a3b0c6043 100644--- a/docs/architecture/editor-files.md+++ b/docs/architecture/editor-files.md@@ -127,7 +127,7 @@ only the queries the chosen sections render. Both templates include the shared| `architecture` | on | First 4 sentences from the `repo_overview` wiki page | 4 sentences || `key_modules` | on | `module_page` pages by PageRank desc | Top 10 || `entry_points` | on | The curated `kg_project_meta` list, else `is_entry_point` nodes ranked on execution-start evidence | Top 6 |-| `hotspots` | on | `git_metadata` bug magnets and hotspots, fix history first, with the last fix date | Top 5 |+| `hotspots` | on | `git_metadata` bug magnets and hotspots, fix history first: the 6-month fix count with the last fix date | Top 5 || `health` | on | Health score, band and worst file | 1 line || `code_health` | off | Every health signal (replaces `health`) | 1 line || `fix_first` | off | The Fix-first queue | Top 3 |diff --git a/docs/reference/MCP_RESPONSE_FIELDS.md b/docs/reference/MCP_RESPONSE_FIELDS.mdindex a2fee847c..2cc45a070 100644--- a/docs/reference/MCP_RESPONSE_FIELDS.md+++ b/docs/reference/MCP_RESPONSE_FIELDS.md@@ -183,7 +183,7 @@ Per target, under `targets`:| title, summary, symbols | Docs summary and symbols with signatures and lines || `symbols_truncated`, `symbols_total` | Compact card: `{shown, total, hint}` and the full count || `hotspot` | Churn flag |-| `fix_history` | Files with counted bug fixes: count, age, `bug_magnet`. A cue to call `get_risk` |+| `fix_history` | Files with counted bug fixes: `fix_count` over `window` (6 months), age, `bug_magnet`. A cue to call `get_risk` || `episodes` | Count of dated records; `get_why` serves them || decisions | Titles; with `include=["decisions"]` the lanes `decisions`, `candidates` (max 3), `history` (max 2) || `file_preview` | File with no symbols: `lines`, `chars`, and `heading_count` + 3 `headings` (markdown, reST) or 3 lines as `head` |@@ -350,7 +350,7 @@ Per file:| Field | Meaning ||-------|---------|-| `defect_profile` | Files with counted fixes: `fix_count` (6 months), `last_fix_days_ago` (to the indexed commit), `bug_magnet`, `top_symbols` |+| `defect_profile` | Files with counted fixes: `fix_count` over `window` (6 months), `last_fix_days_ago` (to the indexed commit), `bug_magnet`, `top_symbols` || `hotspot_score` | 0 to 1 churn percentile || `health_score` | 0 to 10 || `dependents_count` | Direct structural dependents; a floor |diff --git a/packages/cli/src/repowise/cli/commands/context_cmd.py b/packages/cli/src/repowise/cli/commands/context_cmd.pyindex f6665326b..4dbe9eec1 100644--- a/packages/cli/src/repowise/cli/commands/context_cmd.py+++ b/packages/cli/src/repowise/cli/commands/context_cmd.py@@ -243,6 +243,18 @@ def context_command(_ta.print_index_note(payload, fmt)+def _fix_signal(fix: dict) -> str:+ """The card's fix-history signal with its window, or "" when it has none."""+ if not fix.get("fix_count"):+ return ""+ magnet = " (bug magnet)" if fix.get("bug_magnet") else ""+ window = f" in {fix['window']}" if fix.get("window") else ""+ return (+ f"{fix['fix_count']} bug fixes{window}, "+ f"last {fix.get('last_fix_days_ago', '?')}d ago{magnet}"+ )++def _render(projected: dict) -> None:from rich.markup import escapefrom rich.table import Table@@ -286,12 +298,9 @@ def _render(projected: dict) -> None:signals = []if card.get("hotspot"):signals.append("hotspot")- fix = card.get("fix_history") or {}- if fix.get("fix_count"):- magnet = " (bug magnet)" if fix.get("bug_magnet") else ""- signals.append(- f"{fix['fix_count']} bug fixes, last {fix.get('last_fix_days_ago', '?')}d ago{magnet}"- )+ fix_signal = _fix_signal(card.get("fix_history") or {})+ if fix_signal:+ signals.append(fix_signal)if card.get("stale"):signals.append("docs stale")if card.get("episodes"):diff --git a/packages/cli/src/repowise/cli/commands/risk_cmd/card.py b/packages/cli/src/repowise/cli/commands/risk_cmd/card.pyindex 964051bc7..890ad94a6 100644--- a/packages/cli/src/repowise/cli/commands/risk_cmd/card.py+++ b/packages/cli/src/repowise/cli/commands/risk_cmd/card.py@@ -147,8 +147,9 @@ def _print_defects(defect: dict | None) -> None:if not defect:returnmagnet = " [magenta](bug magnet)[/magenta]" if defect.get("bug_magnet") else ""+ window = f" in {defect['window']}" if defect.get("window") else ""console.print(- f" [yellow]{defect.get('fix_count', 0)} bug fix(es)[/yellow], last "+ f" [yellow]{defect.get('fix_count', 0)} bug fix(es)[/yellow]{window}, last "f"{defect.get('last_fix_days_ago', '?')} day(s) ago{magnet}")# ``top_symbols`` is a ``{name: fix_count}`` dict; iterating it bare drops the counts.diff --git a/packages/cli/src/repowise/cli/commands/risk_cmd/target.py b/packages/cli/src/repowise/cli/commands/risk_cmd/target.pyindex b51604d0d..a75743008 100644--- a/packages/cli/src/repowise/cli/commands/risk_cmd/target.py+++ b/packages/cli/src/repowise/cli/commands/risk_cmd/target.py@@ -143,7 +143,9 @@ def _print_global_hotspots(hotspots: list) -> None:table.add_column("File", style="cyan")table.add_column("Hotspot", justify="right")table.add_column("Owner")- table.add_column("Fixes", justify="right")+ # The header carries the window the rows' counts share.+ window = next((h["window"] for h in hotspots if h.get("window")), None)+ table.add_column(f"Fixes ({window})" if window else "Fixes", justify="right")for h in hotspots:score = h.get("hotspot_score")fixes = h.get("fix_count")diff --git a/packages/core/src/repowise/core/generation/editor_files/data.py b/packages/core/src/repowise/core/generation/editor_files/data.pyindex 1265117f1..bfa3d98d2 100644--- a/packages/core/src/repowise/core/generation/editor_files/data.py+++ b/packages/core/src/repowise/core/generation/editor_files/data.py@@ -46,16 +46,25 @@ class HotspotFile:churn_percentile: floatcommit_count_90d: intowner: str | None- # Bug-fix history for the same file. ``fix_count`` is the windowed- # production-code fix count (``GitMetadata.prior_defect_count``), and- # ``last_fix_date`` (``YYYY-MM-DD``) anchors it, because a count with no- # recency reads as an accusation about 2019; a date stays true between- # regenerations. ``bug_magnet`` is only ever set alongside a date, per the- # recency contract in ``types/health.ts``.+ # Bug-fix history for the same file. ``fix_count`` is the production-code+ # fix count over the prior-defect window (``GitMetadata.prior_defect_count``,+ # see ``fix_window``), and ``last_fix_date`` (``YYYY-MM-DD``) anchors it,+ # because a count with no recency reads as an accusation about 2019; a date+ # stays true between regenerations. ``bug_magnet`` is only ever set+ # alongside a date, per the recency contract in ``types/health.ts``.fix_count: int = 0bug_magnet: bool = Falselast_fix_date: str | None = None+ @property+ def fix_window(self) -> str:+ """The window ``fix_count`` covers, as the line prints it ("6 months")."""+ # Local import: the constants module loads the language registry, which+ # the many tests that build these dataclasses directly do not need.+ from repowise.core.ingestion.git_indexer._constants import PRIOR_DEFECT_WINDOW_LABEL++ return PRIOR_DEFECT_WINDOW_LABEL+@dataclass(frozen=True)class DecisionSummary:diff --git a/packages/core/src/repowise/core/generation/templates/_editor_block.j2 b/packages/core/src/repowise/core/generation/templates/_editor_block.j2index f069e356b..857f4ab68 100644--- a/packages/core/src/repowise/core/generation/templates/_editor_block.j2+++ b/packages/core/src/repowise/core/generation/templates/_editor_block.j2@@ -31,7 +31,7 @@ Scope: {{ data.scope_gaps | join(' · ') }}. Missing evidence is not a negative### Files that need care (bug-fix history first, then churn; check `get_risk` before editing){% for h in data.hotspots %}-- `{{ h.path }}`: {% if h.fix_count and h.last_fix_date %}{{ h.fix_count }} bug fix{{ 'es' if h.fix_count != 1 else '' }}, last fix {{ h.last_fix_date }}{% if h.bug_magnet %} (bug magnet){% endif %}; {% endif %}{{ h.commit_count_90d }} commits/90d+- `{{ h.path }}`: {% if h.fix_count and h.last_fix_date %}{{ h.fix_count }} bug fix{{ 'es' if h.fix_count != 1 else '' }} in {{ h.fix_window }}, last fix {{ h.last_fix_date }}{% if h.bug_magnet %} (bug magnet){% endif %}; {% endif %}{{ h.commit_count_90d }} commits/90d{% endfor %}{% endif %}{% set ch = data.code_health %}diff --git a/packages/core/src/repowise/core/ingestion/git_indexer/README.md b/packages/core/src/repowise/core/ingestion/git_indexer/README.mdindex 7ff09e02a..207eef7fb 100644--- a/packages/core/src/repowise/core/ingestion/git_indexer/README.md+++ b/packages/core/src/repowise/core/ingestion/git_indexer/README.md@@ -173,7 +173,7 @@ and a per-file rollup on `git_metadata` (`agent_commit_count`,| Module | Contents ||--------|----------|| `tiers.py` | `GitIndexTier` enum + `includes_blame` / `includes_co_change` |-| `_constants.py` | commit-depth defaults, decay half-lives, the bug-fix keyword classifier (`is_fix_commit`, mirrors the benchmark) + `PRIOR_DEFECT_WINDOW_DAYS`, skip heuristics |+| `_constants.py` | commit-depth defaults, decay half-lives, the bug-fix keyword classifier (`is_fix_commit`, mirrors the benchmark) + `PRIOR_DEFECT_WINDOW_DAYS` and the `PRIOR_DEFECT_WINDOW_LABEL` every fix count prints beside it, skip heuristics || `records.py` | `_CommitRec`, `GitIndexSummary` (carries `commit_rows`), the `git log` record format + rename/skip path helpers || `commit_rows.py` | `build_commit_rows` — per-commit Kamei features + change-risk from the walk's sunk commits (pure, in-memory author experience) || `agent_provenance.py` | `AgentProvenanceClassifier` — deterministic per-commit agent attribution (local channels, config-extensible) |diff --git a/packages/core/src/repowise/core/ingestion/git_indexer/_constants.py b/packages/core/src/repowise/core/ingestion/git_indexer/_constants.pyindex b3c698067..3d14f5789 100644--- a/packages/core/src/repowise/core/ingestion/git_indexer/_constants.py+++ b/packages/core/src/repowise/core/ingestion/git_indexer/_constants.py@@ -184,6 +184,9 @@ _FIX_COMMIT_EXCLUDE: tuple[re.Pattern[str], ...] = (# prior-defects baseline — a wider window than the 90d activity signals because# defect history is a slower-moving cluster than recent churn.PRIOR_DEFECT_WINDOW_DAYS: int = 180+# The window as a surface prints it beside a count: a bare fix total next to a+# 90-day commit count reads as a 90-day figure.+PRIOR_DEFECT_WINDOW_LABEL: str = f"{PRIOR_DEFECT_WINDOW_DAYS // 30} months"def is_fix_commit(subject: str) -> bool:diff --git a/packages/server/src/repowise/server/chat_view_builders.py b/packages/server/src/repowise/server/chat_view_builders.pyindex bc613ba9f..e97a89e39 100644--- a/packages/server/src/repowise/server/chat_view_builders.py+++ b/packages/server/src/repowise/server/chat_view_builders.py@@ -484,9 +484,12 @@ def risk_hotspots_view(artifact: ViewArtifact, options: Mapping[str, Any]) -> di]total = artifact.data.get("global_hotspots_total")total = max(total, len(usable)) if isinstance(total, int) else len(usable)+ # The rows share one window; name it so the counts never read as 90-day churn.+ window = next((h["window"] for h in shown if h.get("window")), None)+ over = f" in the last {window}" if window else ""return _chart(title="Bug fixes on top hotspots",- summary=f"Bug-fix commits on {len(rows)} hotspot files.",+ summary=f"Bug-fix commits{over} on {len(rows)} hotspot files.",basis=_basis("measured", "git history"),x=("file", "File"),series=[("fix_count", "Bug-fix commits")],diff --git a/packages/server/src/repowise/server/mcp_server/tool_risk/history.py b/packages/server/src/repowise/server/mcp_server/tool_risk/history.pyindex 7a6e33f20..7623fd244 100644--- a/packages/server/src/repowise/server/mcp_server/tool_risk/history.py+++ b/packages/server/src/repowise/server/mcp_server/tool_risk/history.py@@ -11,6 +11,8 @@ import mathfrom datetime import UTC, datetimefrom typing import Any+from repowise.core.ingestion.git_indexer._constants import PRIOR_DEFECT_WINDOW_LABEL+#: A file carrying this many counted bug fixes reads as bug-prone. Same trigger#: the PR bot uses for prior defects, so the two surfaces agree on "a lot"._BUG_PRONE_FIXES = 3@@ -111,7 +113,9 @@ def fix_annotation(meta: Any, now: datetime | None = None) -> dict | None:if count <= 0:return None- out: dict[str, Any] = {"fix_count": count}+ # The window rides with the count: a bare total beside 90-day churn reads+ # as a 90-day figure.+ out: dict[str, Any] = {"fix_count": count, "window": PRIOR_DEFECT_WINDOW_LABEL}last_fix_at = getattr(meta, "last_fix_at", None)if isinstance(last_fix_at, datetime):# Rows are stored naive-UTC; compare on the same footing.@@ -139,7 +143,7 @@ def _fix_clause(profile: dict | None) -> str:n = profile["fix_count"]magnet = " (bug magnet)" if profile.get("bug_magnet") else ""return (- f"{n} bug fix{'es' if n != 1 else ''} in 6mo, "+ f"{n} bug fix{'es' if n != 1 else ''} in {profile['window']}, "f"last {profile['last_fix_days_ago']}d before the indexed commit{magnet}, ")@@ -170,7 +174,6 @@ def _defect_profile(meta: Any, now: datetime | None = None) -> dict | None:profile = fix_annotation(meta, now=now)if profile is None:return None- profile["window"] = "6 months"symbols = _top_fix_symbols(getattr(meta, "fix_symbol_counts_json", None))if symbols:diff --git a/packages/ui/src/files/file-history-tab.tsx b/packages/ui/src/files/file-history-tab.tsxindex 564cafe95..8ac316dde 100644--- a/packages/ui/src/files/file-history-tab.tsx+++ b/packages/ui/src/files/file-history-tab.tsx@@ -20,7 +20,7 @@ import { FileMark } from "./file-marks";/** Matches `FixHistoryBadge`'s default tooltip — same claim, same wording. */const FIX_HISTORY_TITLE =- "Bug-fix commits that touched this file in the trailing defect window.";+ "Bug-fix commits that touched this file in the last 6 months.";interface FileHistoryTabProps {git: FileDetailGit | null;diff --git a/packages/ui/src/git/change-history-card.tsx b/packages/ui/src/git/change-history-card.tsxindex b04e77b97..0a2103f93 100644--- a/packages/ui/src/git/change-history-card.tsx+++ b/packages/ui/src/git/change-history-card.tsx@@ -74,7 +74,7 @@ export function ChangeHistoryCard({</span><spanclassName={`tabular-nums ${hasDefects ? "text-[var(--color-error)]" : "text-[var(--color-text-secondary)]"}`}- title="Bug-fix commits that touched this file in the trailing defect window."+ title="Bug-fix commits that touched this file in the last 6 months.">{priorDefectCount} {priorDefectCount === 1 ? "fix" : "fixes"}{fixAge ? ` · last ${fixAge}` : ""}diff --git a/packages/ui/src/git/fix-history-badge.tsx b/packages/ui/src/git/fix-history-badge.tsxindex c6d1a470d..476ef456a 100644--- a/packages/ui/src/git/fix-history-badge.tsx+++ b/packages/ui/src/git/fix-history-badge.tsx@@ -15,11 +15,11 @@ export interface FixHistoryBadgeProps {}const DEFAULT_TITLE =- "Bug-fix commits that touched this file in the trailing defect window.";+ "Bug-fix commits that touched this file in the last 6 months.";/** Symbol-level counts are matched by line range, so their copy hedges. */export const SYMBOL_FIX_TITLE =- "Bug fixes that landed in this symbol in the trailing defect window (approximate: matched by line range).";+ "Bug fixes that landed in this symbol in the last 6 months (approximate: matched by line range).";/*** The headline "N fixes, last X ago" pill. Renders nothing when the file hasdiff --git a/packages/ui/src/git/hotspot-table.tsx b/packages/ui/src/git/hotspot-table.tsxindex 23400643a..0618d261a 100644--- a/packages/ui/src/git/hotspot-table.tsx+++ b/packages/ui/src/git/hotspot-table.tsx@@ -183,8 +183,8 @@ export function HotspotTable({{showFixes && (<SortHeadercolumn="fixes"- label="Fixes"- title="Bug-fix commits that touched this file in the trailing defect window. Churn counts every change; this counts only the ones that fixed something."+ label="Fixes 6mo"+ title="Bug-fix commits that touched this file in the last 6 months. Churn counts every change; this counts only the ones that fixed something."sort={sort}onSortChange={onSortChange}className="w-24"diff --git a/tests/unit/cli/test_risk_cmd.py b/tests/unit/cli/test_risk_cmd.pyindex 2f6c62a3c..f27e04201 100644--- a/tests/unit/cli/test_risk_cmd.py+++ b/tests/unit/cli/test_risk_cmd.py@@ -342,3 +342,19 @@ def test_a_valid_ref_is_unaffected_by_the_ref_check(tmp_path: Path) -> None:result = _gate(repo, "HEAD", "--format", "json")assert result.exit_code == 0, result.outputassert json.loads(result.stdout)["ref"] == "HEAD"+++def test_fix_counts_print_their_window() -> None:+ # A bare fix count beside 90-day churn reads as a 90-day figure.+ from repowise.cli.commands.risk_cmd.card import _print_defects+ from repowise.cli.commands.risk_cmd.target import _print_global_hotspots+ from repowise.cli.helpers import console++ with console.capture() as cap:+ _print_defects({"fix_count": 4, "window": "6 months", "last_fix_days_ago": 2})+ _print_global_hotspots(+ [{"file_path": "a.py", "hotspot_score": 0.9, "fix_count": 4, "window": "6 months"}]+ )+ out = cap.get()+ assert "4 bug fix(es) in 6 months, last 2 day(s) ago" in out+ assert "Fixes (6 months)" in outdiff --git a/tests/unit/cli/test_tool_adapter_commands.py b/tests/unit/cli/test_tool_adapter_commands.pyindex 1e49347a7..510d4af0e 100644--- a/tests/unit/cli/test_tool_adapter_commands.py+++ b/tests/unit/cli/test_tool_adapter_commands.py@@ -1080,3 +1080,13 @@ def test_why_dashboard_projection_keeps_the_newly_named_lanes():assert [row["id"] for row in out["retired_decisions"]] == ["r1", "r2"]assert out["retired_decisions"][1]["lane"] == "dismissed"assert [row["id"] for row in out["unscoped_decisions"]] == ["u1"]+++def test_context_fix_signal_names_its_window() -> None:+ from repowise.cli.commands.context_cmd import _fix_signal++ assert _fix_signal({}) == ""+ assert (+ _fix_signal({"fix_count": 3, "window": "6 months", "last_fix_days_ago": 2})+ == "3 bug fixes in 6 months, last 2d ago"+ )diff --git a/tests/unit/generation/test_editor_file_base.py b/tests/unit/generation/test_editor_file_base.pyindex 6088831dd..826584c85 100644--- a/tests/unit/generation/test_editor_file_base.py+++ b/tests/unit/generation/test_editor_file_base.py@@ -482,7 +482,7 @@ def test_render_hotspot_row_leads_with_fix_history(gen):hotspots=[_hotspot("src/a.py", fix_count=5, bug_magnet=True, last_fix_date="2026-03-14")],)result = gen.render(data)- assert "5 bug fixes, last fix 2026-03-14 (bug magnet); 28 commits/90d" in result+ assert "5 bug fixes in 6 months, last fix 2026-03-14 (bug magnet); 28 commits/90d" in resultdef test_render_hotspot_row_singularizes_one_fix(gen):@@ -493,7 +493,7 @@ def test_render_hotspot_row_singularizes_one_fix(gen):hotspots=[_hotspot("src/a.py", fix_count=1, last_fix_date="2026-03-27")],)result = gen.render(data)- assert "1 bug fix, last fix 2026-03-27" in result+ assert "1 bug fix in 6 months, last fix 2026-03-27" in resultassert "1 bug fixes" not in resultdiff --git a/tests/unit/generation/test_editor_file_sections.py b/tests/unit/generation/test_editor_file_sections.pyindex 6205894a2..e20fb13b9 100644--- a/tests/unit/generation/test_editor_file_sections.py+++ b/tests/unit/generation/test_editor_file_sections.py@@ -171,7 +171,7 @@ def test_repo_facts_lead_the_block(gen):def test_hotspot_rows_carry_a_date_not_an_age(gen):rendered = gen.render(_full_data())- assert "4 bug fixes, last fix 2026-10-12 (bug magnet); 12 commits/90d" in rendered+ assert "4 bug fixes in 6 months, last fix 2026-10-12 (bug magnet); 12 commits/90d" in renderedassert " ago" not in rendereddiff --git a/tests/unit/server/mcp/test_defect_profile.py b/tests/unit/server/mcp/test_defect_profile.pyindex 16786c34b..3e171be48 100644--- a/tests/unit/server/mcp/test_defect_profile.py+++ b/tests/unit/server/mcp/test_defect_profile.py@@ -150,7 +150,7 @@ def test_fix_annotation_withholds_the_magnet_flag_without_an_age():# same word would describe a file fixed four times last month and one# fixed four times two years ago, so the flag drops rather than mislead.out = fix_annotation(_meta(prior_defect_count=9, bug_magnet=True, last_fix_at=None))- assert out == {"fix_count": 9}+ assert out == {"fix_count": 9, "window": "6 months"}assert "bug_magnet" not in out@@ -162,7 +162,12 @@ def test_fix_annotation_carries_count_age_and_flag():last_fix_at=datetime.now(UTC) - timedelta(days=14),))- assert out == {"fix_count": 5, "last_fix_days_ago": 14, "bug_magnet": True}+ assert out == {+ "fix_count": 5,+ "window": "6 months",+ "last_fix_days_ago": 14,+ "bug_magnet": True,+ }def test_fix_annotation_anchors_to_passed_reference_time():@@ -172,11 +177,11 @@ def test_fix_annotation_anchors_to_passed_reference_time():_meta(prior_defect_count=1, last_fix_at=last_fix),now=now,)- assert out == {"fix_count": 1, "last_fix_days_ago": 41}+ assert out == {"fix_count": 1, "window": "6 months", "last_fix_days_ago": 41}def test_defect_profile_still_builds_on_the_shared_annotation():- # The profile is the annotation plus a window and symbols, so the recency+ # The profile is the annotation (count, window, age) plus symbols, so the recency# contract is enforced in exactly one place.profile = _defect_profile(_meta(@@ -198,10 +203,12 @@ def test_risk_summary_clause_is_empty_without_fix_history():def test_risk_summary_clause_leads_with_fixes_and_closes_its_separator():- clause = _fix_clause({"fix_count": 5, "last_fix_days_ago": 14, "bug_magnet": True})- assert clause == "5 bug fixes in 6mo, last 14d before the indexed commit (bug magnet), "+ clause = _fix_clause(+ {"fix_count": 5, "window": "6 months", "last_fix_days_ago": 14, "bug_magnet": True}+ )+ assert clause == "5 bug fixes in 6 months, last 14d before the indexed commit (bug magnet), "def test_risk_summary_clause_singularizes_one_fix():- clause = _fix_clause({"fix_count": 1, "last_fix_days_ago": 2})- assert clause == "1 bug fix in 6mo, last 2d before the indexed commit, "+ clause = _fix_clause({"fix_count": 1, "window": "6 months", "last_fix_days_ago": 2})+ assert clause == "1 bug fix in 6 months, last 2d before the indexed commit, "diff --git a/tests/unit/server/mcp/test_fix_history_coherence.py b/tests/unit/server/mcp/test_fix_history_coherence.pyindex 5727a008c..a3ad9aa7b 100644--- a/tests/unit/server/mcp/test_fix_history_coherence.py+++ b/tests/unit/server/mcp/test_fix_history_coherence.py@@ -115,7 +115,7 @@ async def test_risk_summary_leads_with_fix_history_when_present(setup_mcp, sessi# The defect evidence comes before the churn number, and agrees with the# risk_type printed further along the same line.- assert "4 bug fixes in 6mo, last 7d before the indexed commit (bug magnet)" in summary+ assert "4 bug fixes in 6 months, last 7d before the indexed commit (bug magnet)" in summaryassert summary.index("bug fixes") < summary.index("direct dependents")assert "bug-prone" in summary# Not a churn hotspot (is_hotspot=False), so the summary makes no churn claim.@@ -192,6 +192,8 @@ async def test_get_context_triage_reports_fix_history(setup_mcp, session, repo_it = result["targets"]["src/auth/service.py"]assert t["fix_history"]["fix_count"] == 5+ # The count names its window, so it is never read as the 90-day churn figure.+ assert t["fix_history"]["window"] == "6 months"assert t["fix_history"]["last_fix_days_ago"] == 3assert t["fix_history"]["bug_magnet"] is True@@ -248,7 +250,7 @@ async def test_fix_history_anchors_to_historical_commit_two_years_ago(# get_risk: risk_summary, defect_profilerisk_res = await get_risk(["src/old/fixed.py"])target_risk = risk_res["targets"]["src/old/fixed.py"]- assert "1 bug fix in 6mo, last 30d before the indexed commit" in target_risk["risk_summary"]+ assert "1 bug fix in 6 months, last 30d before the indexed commit" in target_risk["risk_summary"]assert target_risk["defect_profile"]["last_fix_days_ago"] == 30assert target_risk["defect_profile"]["fix_count"] == 1diff --git a/tests/unit/server/test_chat_views.py b/tests/unit/server/test_chat_views.pyindex 58958db6c..78e19187a 100644--- a/tests/unit/server/test_chat_views.py+++ b/tests/unit/server/test_chat_views.py@@ -92,8 +92,8 @@ RISK = {"src/b.py": {"dependents_count": 6, "hotspot_score": 0.6087, "primary_owner": "Someone"},},"global_hotspots": [- {"file_path": "analyzer.py", "hotspot_score": 0.9998, "fix_count": 56, "primary_owner": "S"},- {"file_path": "parser.py", "hotspot_score": 0.9992, "fix_count": 48, "primary_owner": "S"},+ {"file_path": "analyzer.py", "hotspot_score": 0.9998, "fix_count": 56, "primary_owner": "S", "window": "6 months"},+ {"file_path": "parser.py", "hotspot_score": 0.9992, "fix_count": 48, "primary_owner": "S", "window": "6 months"},],"global_hotspots_total": 1037,"_meta": _META,@@ -198,6 +198,8 @@ def test_risk_hotspots_plot_fix_counts_not_scores():assert _series(part, "fix_count") == [56]assert part["data"]["total_rows"] == 1037assert part["data"]["truncated"] is True+ # The counts' window is named, so they never read as 90-day churn.+ assert "in the last 6 months" in str(part)def test_generic_table_over_a_list_keeps_values_and_the_total():