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.

feat(health): one Fix first queue across defect, maintainability and performance (#2821)

Raghav Chamadiyab131c907b22d
diff --git a/docs/agent/MCP_TOOLS.md b/docs/agent/MCP_TOOLS.md
index 976cf5911..0b685252c 100644
--- a/docs/agent/MCP_TOOLS.md
+++ b/docs/agent/MCP_TOOLS.md
@@ -949,7 +949,8 @@ health-relevant changes and running `repowise update`: neither re-calling
**Safe recipes:**
```text
-get_health(only=["directive"])
+get_health(only=["fix_first"])
+get_health(fix_id="fix1_...")
get_health(targets=["path"], include=["refactoring"])
get_health(targets=["module:path"], only=["modules","metrics"])
get_health(include=["trend"], only=["trend"])
@@ -965,16 +966,17 @@ get_health(opportunity_id="refop2_...")
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `targets` | list[string] | No | File paths, or `module:foo` to expand a module's file set. Empty means dashboard mode. |
-| `include` | list[string] | No | Opt-in blocks (default response stays lean): `"biomarkers"` (findings in dashboard mode), `"refactoring"` (structured, graph-aware refactoring plans; see below), `"trend"` (snapshot diff + declining / predicted-decline alerts), `"coverage"`, `"accuracy"` (the "does the score find the bugs?" stat, dashboard mode), `"signals"` (per-file process / people / topology signals, targeted mode), `"churn_complexity"` (churn x complexity quadrant points, dashboard mode), `"doc_drift"` (documentation whose claims about the tree no longer hold), and a dimension name (`"performance"` / `"defect"` / `"maintainability"` / `"advisory"`) to filter findings to that pillar. `"advisory"` is the only way to reach the advisory markers — `assertion_free_test` and `mock_saturated_test`. They carry a health impact of exactly zero, so they are out of every impact-ranked list by default: asking for the dimension is what returns them, and their absence from an unfiltered response is not a clean bill. |
+| `include` | list[string] | No | Opt-in blocks (default response stays lean): `"biomarkers"` (findings in dashboard mode), `"refactoring"` (structured, graph-aware refactoring plans; see below), `"trend"` (snapshot diff + declining / predicted-decline alerts), `"coverage"`, `"accuracy"` (the "does the score find the bugs?" stat, dashboard mode), `"signals"` (per-file process / people / topology signals, targeted mode), `"churn_complexity"` (churn x complexity quadrant points, dashboard mode), `"doc_drift"` (documentation whose claims about the tree no longer hold), `"semantics"` (`_meta.health_semantics`, the legend for weighted-deficit points and percentiles; the same on every call, so off by default), and a dimension name (`"performance"` / `"defect"` / `"maintainability"` / `"advisory"`) to filter findings to that pillar. `"advisory"` is the only way to reach the advisory markers: `assertion_free_test` and `mock_saturated_test`. They carry a health impact of exactly zero, so they are out of every impact-ranked list by default: asking for the dimension is what returns them, and their absence from an unfiltered response is not a clean bill. |
| `only` | list[string] | No | Keep just these top-level keys. `include` adds blocks, `only` subtracts them. `mode`, `_meta`, `unresolved`, `known_modules` and each kept list's `*_total` sibling always survive. The three `include` **block** names work as aliases: `biomarkers`→`findings`, `accuracy`→`defect_accuracy`, `refactoring`→`refactoring_plans`. Note that `refactoring_plans` is the raw
per-detector list and is now **opt-in**: `include=["refactoring"]` leads with
`refactoring_opportunities`, the composed unit, and emitting both would ship two
representations of the same work in one response. The `include` **dimension** names (`performance`, `defect`, `maintainability`, `advisory`) do not — they filter rows inside several blocks and have no single key to resolve to, so they land in `unknown_only_keys`. Nor does `signals`, which merges into `metrics[].signals` — in targeted mode, where `signals` applies, name `metrics` instead. |
| `repo` | string | No | *(workspace only)* Target repo alias |
| `limit` | int | No | Max rows in **every** ranked list (default 20, capped at 50). `0` means no rows; the `*_total` siblings still report the true counts. |
+| `fix_id` | string | No | Resolve one `fix_first` item `id` (`fix1_...`) to the full item: action steps, gain, effort, risk, verify, context and the next call. Answers `mode: "fix_item"`, with `found: false` and `item: null` when the id is no longer in the queue. |
| `finding_id` | string | No | Resolve an emitted stable health-finding `id` directly in one call. |
| `plan_id` | string | No | Resolve an emitted stable refactoring-plan `id` directly in one call. |
-| `opportunity_id` | string | No | Resolve one opportunity `id` directly. The prefix picks the pillar: `perf...` is a performance cause, `refop...` a composed refactoring. Mutually exclusive with the two above; passing more than one returns `mode: "conflict"` naming them rather than answering about whichever was checked first. |
+| `opportunity_id` | string | No | Resolve one opportunity `id` directly. The prefix picks the pillar: `perf...` is a performance cause, `refop...` a composed refactoring. Mutually exclusive with `fix_id` and the two above; passing more than one returns `mode: "conflict"` naming them, never answering about whichever was checked first. |
| `refactoring_type` / `refactoring_confidence` / `refactoring_effort` | string | No | Queue filters over the same read model and vocabulary the REST route uses. An unrecognized value is reported back in `ignored_arguments` rather than silently narrowing to nothing. |
| `refactoring_view` | string | No | Named ordering for `refactoring_opportunities`. `diversified` (default) round-robins the rank order over cause, refactoring type and area, because the ranked head is a genuine run of ties; `canonical` is the published rank order verbatim, ties and all; `file_spread` asked for one row per file, which a composed opportunity satisfies by construction, so it resolves onto the diversified order. Both older values keep working. It also selects the legacy `refactoring_plans` list's view, where `diversified` resolves to that list's historical `canonical` default. |
| `cursor` | int | No | Zero-based offset into a ranked collection; the `recovery` block names the exact next call. |
@@ -991,7 +993,7 @@ An unrecognized `scope` or `counts` falls back to the default and is named in
`ignored_arguments`, so a misspelling never answers a different question under
the name you asked for. Both are echoed on the response.
-**Returns:** Dashboard mode (no `targets`) returns a `directive`, repo-level KPIs
+**Returns:** Dashboard mode (no `targets`) returns `fix_first`, repo-level KPIs
(hotspot health, average health, worst performer, maintainability / performance
pillar averages), the lowest-scoring files, and a per-module NLOC-weighted
rollup. Targeted mode returns per-file marker findings with severity,
@@ -1000,25 +1002,26 @@ per-dimension scores, and the score breakdown. Each finding carries a `dimension
score; `advisory` describes and never deducts, which is why a file can carry an
advisory finding and a deduction of zero.
-**Lead with `directive`.** Dashboard mode opens with the single file to fix
-first, its dominant finding, `recovers_weighted_deficit_points` /
-`share_of_repo_gap_pct` (what
-fixing it buys the headline; the share is bounded by 100% and sums to 100%
-across `high_leverage_files` — the gross deficit of below-target files is the
-denominator, not the net gap, so a single file cannot read as closing more than
-the whole remaining gap), and `then`, the next two by leverage. Every other
-block ranks and describes; this one recommends. Same role as `get_risk`'s
-`directive`. Rank by `weighted_deficit`, not `score` — the score floors at 1.0.
-
-`recovers_points` remains an exact deprecated alias during the compatibility
-window; `recovers_points_compatibility` names its replacement.
-
-**`watch` is context, not a task.** When the leading cause is history-derived —
-churn, ownership, co-change, prior fixes — the directive carries it under
-`watch` rather than in the fix path, because no edit to the file settles it.
-If *no* file has a code-shape lead, `next_action` says so instead of naming a
-file to change, so an agent is never sent to refactor a file whose deficit is
-its history.
+**Lead with `fix_first`.** One ranked queue across refactoring, performance and
+code-shape findings, built once in core from stored rows; REST
+(`/api/repos/{id}/health/fix-first`), `repowise health` and the generated
+CLAUDE.md render the same object. The block carries `lead` (equal to
+`items[0]`), up to five `items` in a compact projection (`id`, `tier`, `kind`,
+`title`, `target`, `why`, `gain`, `effort`, `confidence`, `next_call`),
+`totals` (`candidates`, `eligible`, `shown`, and `excluded` counted by reason:
+`test`, `tooling`, `generated`, `expected`, `no_plan`, `below_min_worth`,
+`history_only`), `by_improves`, `model_version`, `basis`, and `detail_call`,
+the `get_health(fix_id=...)` call that returns the lead in full. `tier` is
+`now` (worth doing, and the plan is safe to start), `next` (worth doing, needs
+judgment) or `later`. Items are ordered by value first, the larger of the recoverable health and the size of the problem (CCN, lines and nesting past their bars, a critical or brain-method finding, a hot file), then by tier, so a function far past every bar leads as "Break up ..." ahead of tidy work that is safer to start. `kind` is `refactor` (one file's composed refactoring),
+`perf_fix` (one intervention, its sinks listed under it) or `finding` (a file's
+strongest code-shape finding with no plan). Always the production population,
+whatever `scope` says. `limit` caps the items, never which one leads.
+
+**History is context, not a task.** History markers (churn, ownership,
+co-change, prior fixes, governance) never create an item or lead one: they ride
+on the item for the same file under `context`, and a file whose only findings
+are history is counted in `totals.excluded.history_only`.
**Nothing is dropped silently.** Any `targets` entry that matched nothing is
named in `unresolved` with a reason (`not_indexed` → run `repowise update`,
@@ -1051,8 +1054,8 @@ than guessed when no row records a commit.
five ranked lists compose: `include=['refactoring']` on a mid-size repo lands
near the host's tool-result cap, past which the host rejects the whole result
and you get nothing. Pair `include` with `only` —
-`get_health(include=['refactoring'], only=['refactoring_plans'])` is the call
-`directive.plan_via` names. Anything that would still overflow is shed in the order this tool declares,
+`get_health(include=['refactoring'], only=['refactoring_plans'])` keeps one
+block. Anything that would still overflow is shed in the order this tool declares,
never silently: the response carries `truncated: true`, the `*_total` /
`*_emitted` / `*_reduced_reason` siblings describe what was there, and
`_meta.omitted` names refs that restore the dropped rows. Re-requesting one
@@ -1075,7 +1078,7 @@ a test asks a different question from defect risk in the code it covers, and at
the default limit a quarter of the headline list was describing the test suite.
Targeted mode is never split: you named the files, so you get their findings.
The ranked file lists split the same way: `worst_files` and
-`high_leverage_files` (and the `directive` built from them) are production files,
+`high_leverage_files` are production files,
and `test_worst_files` ranks the test files. `kpis.worst_performer_path` is the
worst production file and `kpis.worst_test_path` the worst test file. The KPI
averages still include test files — excluding them would move the repo's
@@ -1097,15 +1100,14 @@ make that actionable rather than a mystery:
(dashboard mode) is the top-N ranked by it, distinct from `worst_files`, which
sorts by raw score and ranks a 30-line file at 1.0 equal to a 1,200-line file at
1.0 that moves the average ~40x more.
-- `weighted_deficit`, `directive.recovers_weighted_deficit_points` and
- `gap_analysis.weighted_gap_points` share one unit — *score-points x NLOC* —
- which compares against itself and nothing else. Every `high_leverage_files`
- row and the `directive` also carry `share_of_repo_gap_pct`, the same quantity
+- `weighted_deficit` and `gap_analysis.weighted_gap_points` share one unit,
+ *score-points x NLOC*, which compares against itself and nothing else. Every
+ `high_leverage_files` row also carries `share_of_repo_gap_pct`, the same quantity
over the gross deficit of all below-target files
(`gap_analysis.weighted_gross_gap_points`), so the shares are bounded by 100%
and sum to 100% by construction; that plus
`gap_analysis.files_to_reach_target` is what answers "is this worth doing".
-- `_meta.health_semantics` gives the numerator, gross-deficit denominator,
+- `_meta.health_semantics` (with `include=["semantics"]`) gives the numerator, gross-deficit denominator,
nonnegative unbounded scale and direction. These are deterministic heuristic
triage points, not probabilities, normalized score points, percentages or
guaranteed improvement.
@@ -1171,9 +1173,8 @@ The opt-in enrichments:
`only=["refactoring_evidence"]` plus `cursor` pages the evidence. `found`
says whether the id named a stored opportunity; `status` is its triage
lifecycle (`open`, `acknowledged`, `resolved`, `false_positive`).
-- **`refactoring_directive`** rides on a bare `get_health()`: one opportunity,
- what it addresses, and the exact `opportunity_id` call that opens it. One
- primary-key read; it never touches the queue. **`refactoring_summary`**
+- A refactoring reaches a bare `get_health()` through `fix_first`, whose
+ `next_call` is the exact `opportunity_id` call that opens it. **`refactoring_summary`**
(`only=["refactoring_summary"]`) is the rollup by type, effort, confidence,
lifecycle and mechanical-vs-judgment, with facets.
- **`refactoring_plans`** is the raw per-detector list, unchanged and still
@@ -1233,9 +1234,8 @@ only two values across a whole repo's perf findings.
with `only`, so it can carry an entry for a block a projection dropped —
extra rows in a lookup table, never a missing one. Note it explains the
**findings**, not the
- plans it ships beside — the two sets differ (no plan kind is sourced from
- `coverage_gradient`), and `directive.plan_addresses_reason` is what reports
- that gap.
+ plans it ships beside: the two sets differ (no plan kind is sourced from
+ `coverage_gradient`).
**When to use:** Before opening a PR, to self-check the files you changed
(`targets=[...], include=["signals"]`) and confirm you are not regressing the
@@ -1246,8 +1246,9 @@ hotspots.
**Example calls:**
```
-get_health(only=["directive"]) # cheapest useful call: what to fix first
-get_health() # directive, kpis, gap_analysis, worst + high_leverage files
+get_health(only=["fix_first"]) # cheapest useful call: what to fix first
+get_health(fix_id="fix1_...") # one item in full: steps, verify, risk
+get_health() # fix_first, kpis, gap_analysis, high_leverage files
get_health(include=["accuracy", "churn_complexity"])
get_health(include=["biomarkers", "performance"]) # only performance findings
get_health(targets=["src/api/server.py"], include=["signals"])
@@ -1284,20 +1285,18 @@ per-file statement about lines, separate from the summary's commit-level
### Performance: one lead, then drill down
-A bare `get_health()` carries `performance_directive`: one bounded lead with
-its status (`plan_ready` / `advisory` / `investigate` / `clear` / `unavailable`),
-up to three `why_ranked` facets, the exact plan state, and a structured
-`next_action`, and, when a plan is stored, its `validation` basis. An opportunity
+A bare `get_health()` ranks performance work inside `fix_first`: one `perf_fix`
+item per intervention (the loop or function you change), with the sinks it
+covers under it, and a `next_call` that opens the opportunity. An opportunity
by id adds `plan_steps`, `validation` (tests and commands) and `siblings`: other
causes observed on the same lines. A rejected filter value is echoed with its
-accepted values in `ignored_arguments`. Performance findings carry `health_impact: 0` by construction, so
-they never competed for the main `directive` and the dashboard used to report
-counts and nothing to act on. `clear` means no supported pattern surfaced, which
-is not a claim about how the code runs; `unavailable` means this index has not
-materialized the analysis yet, or did so under an older model.
+accepted values in `ignored_arguments`. Performance findings carry
+`health_impact: 0` by construction, so they never rank in the impact-ordered
+finding lists. Rows with no safe plan, or whose repetition is expected, stay
+out of `fix_first` and are counted in its `totals.excluded`.
```
-get_health() # the lead
+get_health(only=["fix_first"]) # the lead
get_health(include=["performance"], only=["performance_summary"])
get_health(include=["performance"], only=["performance_opportunities"], performance_context="all")
get_health(opportunity_id="perf3_...") # the cause, its plan, its evidence
diff --git a/docs/layers/REFACTORING.md b/docs/layers/REFACTORING.md
index e441bc1a2..bad08280c 100644
--- a/docs/layers/REFACTORING.md
+++ b/docs/layers/REFACTORING.md
@@ -161,8 +161,8 @@ repowise health --refactoring-targets # ranked table
```
```python
-# MCP. A bare call already carries one bounded refactoring_directive.
-get_health()
+# MCP. A bare call leads with fix_first, which ranks refactorings beside the rest.
+get_health(only=["fix_first"])
get_health(include=["refactoring"], only=["refactoring_opportunities"], limit=6)
get_health(include=["refactoring"], only=["refactoring_summary"])
get_health(opportunity_id="refop2_...") # steps, plans, validation
diff --git a/packages/cli/src/repowise/cli/commands/health_cmd/command.py b/packages/cli/src/repowise/cli/commands/health_cmd/command.py
index 8ae5a0b47..968c4e6b8 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/command.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/command.py
@@ -36,7 +36,12 @@ from repowise.core.analysis.health.scope import DEFAULT_SCOPE, SCOPES, parse_sco
from repowise.core.analysis.health.scoring import compute_kpis
from .codegen import _generate_refactoring_code
-from .persist import _load_persisted_coverage_map, _load_recommendations, _persist_health
+from .persist import (
+ _load_fix_first,
+ _load_persisted_coverage_map,
+ _load_recommendations,
+ _persist_health,
+)
from .refactoring_targets import (
_render_refactoring_targets,
_render_stored_refactoring_targets,
@@ -45,11 +50,15 @@ from .summary import (
_render_badge,
_render_defect_accuracy_line,
_render_distribution_line,
+ _render_fix_first,
_render_performance_section,
_render_split_line,
)
from .trends import _render_trend
+#: Items the report leads with; the full queue is one REST or MCP call away.
+FIX_FIRST_ROWS = 3
+
@click.command("health")
@click.argument("path", required=False, type=click.Path(exists=True))
@@ -457,6 +466,10 @@ def health_command(
distribution as health_distribution,
)
+ # Lead with what to fix; a narrowed run is an inspection, not the worklist.
+ if not file_filter and not module_filter:
+ _render_fix_first(_load_fix_first(repo_path, limit=FIX_FIRST_ROWS))
+
kpis = report.kpis
avg = kpis.get("average_health")
band_str = ""
diff --git a/packages/cli/src/repowise/cli/commands/health_cmd/persist.py b/packages/cli/src/repowise/cli/commands/health_cmd/persist.py
index 56357ce31..1db3e0dde 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/persist.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/persist.py
@@ -51,6 +51,34 @@ def _load_persisted_coverage_map(repo_path: object) -> dict[str, dict]:
return {}
+def _load_fix_first(repo_path: object, *, limit: int) -> Any:
+ """The stored Fix-first queue, or ``None`` when the store cannot answer.
+
+ Best-effort like the coverage read: a missing repo row or an older store
+ leaves the report without the section; the report itself still prints.
+ """
+ from repowise.cli.helpers import get_db_url_for_repo, reconcile_schema_best_effort
+ from repowise.core.persistence import create_engine, create_session_factory, get_session
+ from repowise.core.persistence.crud import get_repository_by_path
+ from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
+
+ async def _do() -> Any:
+ url = get_db_url_for_repo(repo_path)
+ await reconcile_schema_best_effort(url)
+ engine = create_engine(url)
+ sf = create_session_factory(engine)
+ async with get_session(sf) as session:
+ repo = await get_repository_by_path(session, str(repo_path))
+ if repo is None:
+ return None
+ return await load_fix_first(session, repo.id, limit=limit)
+
+ try:
+ return run_async(_do())
+ except Exception:
+ return None
+
+
def _load_recommendations(
repo_path: Path, suggestions: Sequence[Any], metrics: Sequence[Any]
) -> list[dict[str, Any]]:
@@ -99,7 +127,7 @@ def _persist_health(repo_path: object, *, report: object) -> None:
overwrite the health tables for this repo with the freshly computed
values. Coverage tables are left untouched (owned by ``coverage add``).
Best-effort — a missing repo row or a DB error logs to stderr and
- returns rather than crashing the CLI.
+ returns; the CLI does not crash.
"""
from repowise.cli.helpers import get_db_url_for_repo, reconcile_schema_best_effort
from repowise.core.analysis.health.trends import snapshot_file_maps
diff --git a/packages/cli/src/repowise/cli/commands/health_cmd/summary.py b/packages/cli/src/repowise/cli/commands/health_cmd/summary.py
index ad3f448dc..428ff4dd8 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/summary.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/summary.py
@@ -1,7 +1,7 @@
"""Console renderers for the top-of-report summary lines.
-Performance-risk headline, band distribution, README badge, and the
-"does the score find the bugs?" defect-accuracy line.
+The Fix-first lead, performance-risk headline, band distribution, README
+badge, and the "does the score find the bugs?" defect-accuracy line.
"""
from __future__ import annotations
@@ -11,6 +11,33 @@ from typing import Any
from repowise.cli.helpers import console
+def _render_fix_first(queue: Any) -> None:
+ """What to fix first, as core ranks it: title, where, why, effort, how to verify."""
+ from rich.markup import escape
+
+ if queue is None:
+ return
+ if not queue.items:
+ console.print("\n[bold]Fix first[/bold]: nothing eligible in the stored analysis.")
+ return
+ totals = queue.totals
+ console.print(
+ f"\n[bold]Fix first[/bold] [dim]({totals.shown} of {totals.eligible} eligible; "
+ "tests, tooling and history-only files left out)[/dim]"
+ )
+ for item in queue.items:
+ target = item.target
+ where = target.file_path + (f":{target.line_start}" if target.line_start else "")
+ console.print(
+ f" {item.rank + 1}. [bold]{escape(item.title)}[/bold] "
+ f"[dim]{item.tier} · effort {item.effort.bucket} · {item.gain.text}[/dim]"
+ )
+ console.print(f" [cyan]{escape(where)}[/cyan]")
+ console.print(f" {escape(item.why)}")
+ if item.verify.command:
+ console.print(f" [dim]verify:[/dim] {escape(item.verify.command)}")
+
+
def _render_performance_section(report: Any, lang_by_path: dict[str, str]) -> None:
"""Honest performance headline: risk count + density + coverage + scope.
diff --git a/packages/core/src/repowise/core/analysis/actions/build.py b/packages/core/src/repowise/core/analysis/actions/build.py
index cbbc72423..4ac177f05 100644
--- a/packages/core/src/repowise/core/analysis/actions/build.py
+++ b/packages/core/src/repowise/core/analysis/actions/build.py
@@ -29,12 +29,10 @@ Row shapes (the field names are the SQL columns):
``sha``, ``subject``, ``committed_at`` (the commit's), ``file_path``,
``symbol``, ``biomarker_type``, ``severity``, ``change_kind``,
``line_start``, ``reason``, ``attribution_basis``.
-``performance``
- ``opportunity_id``, ``biomarker_type``, ``boundary_kind``, ``file_path``,
- ``intervention_symbol``, ``affected_call_sites_total``,
- ``affected_files_total``, ``actionability_state``, ``execution_context``,
- ``status`` (absent = open), and ``details`` (a dict) or ``details_json``
- carrying ``facets`` and ``plan``.
+``fix_first``
+ One mapping of the Fix-first builder's own inputs (``metrics``,
+ ``findings``, ``refactoring``, ``performance``, ``plans``); shapes in
+ ``repowise.core.analysis.health.fix_first.build``.
``security``
``file_path``, ``kind``, ``line_number``, ``snippet``, ``severity``,
``commit_sha`` (empty for the working tree).
@@ -63,8 +61,9 @@ from typing import Any
from repowise.core.analysis.dead_code.risk_factors import REVIEW_ONLY_KINDS
from repowise.core.analysis.finding_registry import excluded_types
+from repowise.core.analysis.health.fix_first import build_fix_first
from repowise.core.analysis.health.models import primary_finding, split_by_origin
-from repowise.core.analysis.health.rows import detail_map, field
+from repowise.core.analysis.health.rows import field
from repowise.core.analysis.health.scoring import HISTORY_CATEGORY, biomarker_category
from repowise.core.author_identity import author_identity_key
@@ -76,11 +75,11 @@ from .facts import (
DriftFacts,
FileFacts,
LeadFinding,
- PerfFacts,
RecentFinding,
RepoFacts,
SecretFacts,
)
+from .rules.code import FIX_FIRST_ACTIONS
from .rules.hygiene import PUBLIC_ENV_KIND, SECRET_KINDS
logger = logging.getLogger(__name__)
@@ -309,35 +308,9 @@ def build_recent(
return {"recent_findings": tuple(recent)}
-def build_perf(rows: Rows) -> dict[str, Any]:
- """Open production opportunities that are ready to plan or advise on."""
- out = []
- for r in rows:
- if not (
- _open(r)
- and field(r, "execution_context") == "production"
- and field(r, "actionability_state") in ("plan_ready", "advisory")
- ):
- continue
- details = detail_map(r)
- facets = details.get("facets") or {}
- plan = details.get("plan") or {}
- out.append(
- PerfFacts(
- opportunity_id=field(r, "opportunity_id"),
- biomarker=field(r, "biomarker_type"),
- boundary=field(r, "boundary_kind"),
- file_path=field(r, "file_path"),
- symbol=field(r, "intervention_symbol"),
- call_sites=field(r, "affected_call_sites_total") or 0,
- files=field(r, "affected_files_total") or 0,
- actionability=field(r, "actionability_state"),
- exposure=facets.get("exposure"),
- loop_magnitude=facets.get("loop_magnitude"),
- effort=plan.get("effort_bucket"),
- )
- )
- return {"perf": tuple(out)}
+def build_fix_first_store(rows: Mapping[str, Rows]) -> dict[str, Any]:
+ """The head of the Fix-first queue, from the rows its own builder reads."""
+ return {"fix_first": build_fix_first(**rows, limit=FIX_FIRST_ACTIONS).items}
def build_secrets(rows: Rows, files: Mapping[str, FileFacts]) -> dict[str, Any]:
@@ -441,7 +414,7 @@ def build_repo_facts(
health_findings: Rows = (),
authors: Rows | None = None,
commit_health: Rows | None = None,
- performance: Rows | None = None,
+ fix_first: Mapping[str, Rows] | None = None,
security: Rows | None = None,
doc_drift: Rows | None = None,
known_paths: Iterable[str] = (),
@@ -491,7 +464,7 @@ def build_repo_facts(
rows, week=week, open_findings=health_findings, files=known_files
),
)
- build("performance", performance, build_perf)
+ build("fix_first", fix_first, build_fix_first_store)
build("security", security, lambda rows: build_secrets(rows, known_files))
build("doc_drift", doc_drift, lambda rows: build_drift(rows, known_paths))
build("dead_code", dead_code, lambda rows: build_dead(rows, known_files))
@@ -513,7 +486,7 @@ __all__ = [
"build_decisions",
"build_drift",
"build_files",
- "build_perf",
+ "build_fix_first_store",
"build_recent",
"build_repo_facts",
"build_secrets",
diff --git a/packages/core/src/repowise/core/analysis/actions/engine.py b/packages/core/src/repowise/core/analysis/actions/engine.py
index 1fc58e406..04b4a4af8 100644
--- a/packages/core/src/repowise/core/analysis/actions/engine.py
+++ b/packages/core/src/repowise/core/analysis/actions/engine.py
@@ -22,7 +22,7 @@ RULES: tuple[Rule, ...] = (
code.fresh_regressions,
code.fragile_file,
code.fix_concentration,
- code.hot_path_perf,
+ code.fix_first,
hygiene.stale_decision,
hygiene.knowledge_loss,
hygiene.broken_doc_refs,
diff --git a/packages/core/src/repowise/core/analysis/actions/facts.py b/packages/core/src/repowise/core/analysis/actions/facts.py
index 6cc49c981..4741c058b 100644
--- a/packages/core/src/repowise/core/analysis/actions/facts.py
+++ b/packages/core/src/repowise/core/analysis/actions/facts.py
@@ -13,6 +13,8 @@ from dataclasses import dataclass, field
from datetime import datetime
from typing import Literal
+from repowise.core.analysis.health.fix_first import FixItem
+
CoverageStatus = Literal["measured", "stale", "unknown"]
@@ -63,21 +65,6 @@ class RecentFinding:
reason: str = ""
-@dataclass(frozen=True, slots=True)
-class PerfFacts:
- opportunity_id: str
- biomarker: str
- boundary: str | None
- file_path: str
- symbol: str | None
- call_sites: int
- files: int
- actionability: str
- exposure: str | None
- loop_magnitude: str | None
- effort: str | None
-
-
@dataclass(frozen=True, slots=True)
class SecretFacts:
file_path: str
@@ -140,7 +127,8 @@ class RepoFacts:
fix_shas_by_file: Mapping[str, frozenset[str]] = field(default_factory=dict)
fix_commits_90d: int = 0
recent_findings: tuple[RecentFinding, ...] = ()
- perf: tuple[PerfFacts, ...] = ()
+ #: The head of the shared Fix-first queue, built by the same core builder.
+ fix_first: tuple[FixItem, ...] = ()
secrets: tuple[SecretFacts, ...] = ()
drift: tuple[DriftFacts, ...] = ()
dead: tuple[DeadFacts, ...] = ()
diff --git a/packages/core/src/repowise/core/analysis/actions/model.py b/packages/core/src/repowise/core/analysis/actions/model.py
index 5aa0187bf..1b1498f1c 100644
--- a/packages/core/src/repowise/core/analysis/actions/model.py
+++ b/packages/core/src/repowise/core/analysis/actions/model.py
@@ -15,7 +15,7 @@ ActionRule = Literal[
"fresh_regressions",
"fragile_file",
"fix_concentration",
- "hot_path_perf",
+ "fix_first",
"stale_decision",
"knowledge_loss",
"broken_doc_refs",
diff --git a/packages/core/src/repowise/core/analysis/actions/rules/code.py b/packages/core/src/repowise/core/analysis/actions/rules/code.py
index e142ce9f4..e094eac0e 100644
--- a/packages/core/src/repowise/core/analysis/actions/rules/code.py
+++ b/packages/core/src/repowise/core/analysis/actions/rules/code.py
@@ -1,4 +1,4 @@
-"""Rules about the code itself: what got worse, what keeps breaking, what is slow."""
+"""Rules about the code itself: what got worse, what keeps breaking, what to fix first."""
from __future__ import annotations
@@ -9,7 +9,7 @@ from datetime import datetime
from ..context import RepoContext
from ..facts import FileFacts, RepoFacts
from ..model import Action, ActionCommand, ActionDetail, RuleOutcome, WhyFact, fingerprint
-from ._text import code, humanize, plural, py_list
+from ._text import code, plural, py_list
#: Files that tell the week's story as well as the quarter's: busy fragile
#: files someone touched this week, strongest first.
@@ -31,6 +31,9 @@ CONCENTRATION_MIN_REPEAT_FILES = 3
CONCENTRATION_MAX_ACTIONS = 2
+#: Fix-first items Do next reads; the queue is ranked, so these are its head.
+FIX_FIRST_ACTIONS = 3
+
#: Up to this many files, each gets its own action; beyond it, one action
#: carries the week and names the worst files. A heavy week of feature work can
#: add findings to seventy files, and seventy rows is not a to-do list.
@@ -233,8 +236,10 @@ def fragile_file(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
return RuleOutcome(rule, "unavailable", facts.unavailable["files"])
if ctx.fix_commits_90d == 0:
return RuleOutcome(rule, "not_applicable", "No bug-fix commits in the last 90 days.")
+ # A file Fix first already names carries one action, not two.
+ named = fix_first_paths(facts)
fragile = sorted(
- (f for f in facts.files.values() if _is_fragile(f, ctx)),
+ (f for f in facts.files.values() if _is_fragile(f, ctx) and f.path not in named),
key=lambda f: -(f.fix_commits_90d * f.commits_90d),
)
touched = [f for f in fragile if ctx.in_week(f.last_commit_at)]
@@ -354,6 +359,7 @@ def fix_concentration(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
if f.fix_commits_90d >= 3:
fixed_files[folder].append(path)
n_prod = len(production)
+ named = fix_first_paths(facts)
def lift(folder: str) -> float:
return (len(shas_per_folder[folder]) / total) / (files_per_folder[folder] / n_prod)
@@ -362,7 +368,9 @@ def fix_concentration(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
folder
for folder, shas in shas_per_folder.items()
if len(shas) / total >= CONCENTRATION_MIN_SHARE
- and len(fixed_files[folder]) >= CONCENTRATION_MIN_REPEAT_FILES
+ # Files Fix first names do not make a folder an area of work twice.
+ and len([p for p in fixed_files[folder] if p not in named])
+ >= CONCENTRATION_MIN_REPEAT_FILES
and lift(folder) >= CONCENTRATION_MIN_LIFT
]
chosen: list[str] = []
@@ -377,7 +385,9 @@ def fix_concentration(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
members = sorted(
fixed_files[folder], key=lambda p: -production[p].fix_commits_90d
)
- includes = tuple(p for p in members if _is_fragile(production[p], ctx))
+ includes = tuple(
+ p for p in members if _is_fragile(production[p], ctx) and p not in named
+ )
actions.append(
Action(
rule=rule,
@@ -440,88 +450,68 @@ def _ancestors(path: str) -> list[str]:
return ["/".join(parts[: i + 1]) for i in range(len(parts))]
-_BOUNDARY_NOUN = {
- "db": "database",
- "filesystem": "file system",
- "network": "network",
- "subprocess": "subprocess",
-}
+#: Fix-first tiers that become actions; ``later`` stays on the Code Health page.
+_FIX_FIRST_TIER = {"now": "act_now", "next": "plan"}
+
+def fix_first_paths(facts: RepoFacts) -> set[str]:
+ """Files the ``fix_first`` rule emits, so file-level rules do not repeat them."""
+ return {i.target.file_path for i in facts.fix_first if i.tier in _FIX_FIRST_TIER}
-def hot_path_perf(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
- """Repeated I/O an entry point can reach, whose cost grows with the data.
- Strict on purpose: on the repowise index 4 of 491 production opportunities
- clear it. The rest stay on the Performance tab as an inventory.
+def fix_first(facts: RepoFacts, ctx: RepoContext) -> RuleOutcome:
+ """The head of the shared Fix-first queue: one ranking for every surface.
+
+ Code health, refactoring and performance work all reach this list through
+ it, so Do next and the Code Health lead cannot disagree about what to fix.
"""
- rule = "hot_path_perf"
- if "performance" in facts.unavailable:
- return RuleOutcome(rule, "unavailable", facts.unavailable["performance"])
+ rule = "fix_first"
+ if "fix_first" in facts.unavailable:
+ return RuleOutcome(rule, "unavailable", facts.unavailable["fix_first"])
actions = []
- for p in facts.perf:
- if p.actionability not in ("plan_ready", "advisory"):
- continue
- if p.exposure != "entry_reachable":
+ for item in facts.fix_first:
+ tier = _FIX_FIRST_TIER.get(item.tier)
+ if tier is None:
continue
- if p.loop_magnitude != "grows_with_data" and p.call_sites < 3:
- continue
- where = code(p.symbol.rsplit("::", 1)[-1] if p.symbol else p.file_path)
- noun = _BOUNDARY_NOUN.get(p.boundary or "")
- if noun and p.call_sites > 1:
- title = f"Batch the {noun} calls loops make through {where}"
- elif noun:
- title = f"Move the {noun} call in {where} out of its loop"
- else:
- title = f"Fix the {humanize(p.biomarker)} in {where}"
+ target = item.target
+ symbol = target.symbol
actions.append(
Action(
rule=rule,
- tier="plan",
- horizons=("quarter",),
- severity="medium",
- title=title,
- impact=(
- f"{plural(p.call_sites, 'loop')} across {plural(p.files, 'file')} "
- f"{'reaches' if p.call_sites == 1 else 'reach'} it from code an entry "
- "point calls, once per item."
- ),
+ tier=tier,
+ horizons=("week", "quarter") if tier == "act_now" else ("quarter",),
+ severity="high" if tier == "act_now" else "medium",
+ title=item.title,
+ impact=item.why,
why=(
- WhyFact("file", posixpath.basename(p.file_path)),
- WhyFact("call sites", str(p.call_sites)),
- WhyFact("reachable from an entry point", "Yes", "inferred"),
- WhyFact(
- "cost",
- "Grows with the data"
- if p.loop_magnitude == "grows_with_data"
- else "Repeated per call site",
- "inferred",
- ),
+ WhyFact("gain", item.gain.text, "inferred"),
+ *(WhyFact(f.label, f.value, f.basis) for f in item.facts[:3]),
+ ),
+ target_kind="symbol" if symbol else "file",
+ target_path=target.file_path,
+ target_symbol=symbol,
+ identity=item.id,
+ surface="performance" if item.kind == "perf_fix" else "findings",
+ effort=_effort(item.effort.bucket),
+ confidence="high" if item.confidence.level == "high" else "medium",
+ done_when="It leaves Fix first on the next update.",
+ weight=float(len(facts.fix_first) - item.rank),
+ evidence_ids=tuple(
+ x for x in (item.source.opportunity_id, *item.source.finding_ids) if x
),
- target_kind="symbol" if p.symbol else "file",
- target_path=p.file_path,
- target_symbol=p.symbol,
- identity=p.opportunity_id,
- surface="performance",
- effort=_effort(p.effort),
- confidence="high" if p.actionability == "plan_ready" else "medium",
- done_when="The opportunity closes on the next update.",
- marker=p.biomarker,
- weight=float(p.call_sites),
- evidence_ids=(p.opportunity_id,),
- evidence_total=p.call_sites,
+ fingerprint=fingerprint(item.tier, item.gain.text),
+ details=tuple(
+ ActionDetail(path=step.file_path, line=step.line, reason=step.text)
+ for step in item.action.steps
+ ),
+ details_total=item.action.steps_total,
commands=(
ActionCommand(
- "Every call site, the fix strategy and the tests to run",
- mcp=f'get_health(opportunity_id="{p.opportunity_id}")',
- cli=f"repowise health --file {p.file_path}",
- ),
- ActionCommand(
- "The function's body and its callers",
- mcp=f'get_symbol("{p.symbol or p.file_path}", depth=1)',
- cli=f"repowise symbol {p.symbol or p.file_path}",
+ "The full item: steps, tests to run, risk",
+ mcp=f'get_health(fix_id="{item.id}")',
+ cli="repowise health",
),
),
- fingerprint=fingerprint(p.call_sites, p.actionability),
)
)
return RuleOutcome(rule, "evaluated", "", tuple(actions))
diff --git a/packages/core/src/repowise/core/analysis/health/fix_first/__init__.py b/packages/core/src/repowise/core/analysis/health/fix_first/__init__.py
new file mode 100644
index 000000000..e34e2e3a9
--- /dev/null
+++ b/packages/core/src/repowise/core/analysis/health/fix_first/__init__.py
@@ -0,0 +1,40 @@
+"""Fix first: one ranked list of what to fix, built once in core from stored rows.
+
+The builder is pure (``build.build_fix_first`` over plain rows); the loader that
+reads the stores lives in ``repowise.core.persistence.crud.analysis.fix_first``.
+"""
+
+from __future__ import annotations
+
+from .build import DEFAULT_LIMIT, build_fix_first
+from .model import (
+ FIX_EFFORTS,
+ FIX_EXCLUSIONS,
+ FIX_FACT_BASES,
+ FIX_FIRST_MODEL_VERSION,
+ FIX_GAIN_KINDS,
+ FIX_IMPROVES,
+ FIX_KINDS,
+ FIX_LEVELS,
+ FIX_SCOPES,
+ FIX_TIERS,
+ FixFirstQueue,
+ FixItem,
+)
+
+__all__ = [
+ "DEFAULT_LIMIT",
+ "FIX_EFFORTS",
+ "FIX_EXCLUSIONS",
+ "FIX_FACT_BASES",
+ "FIX_FIRST_MODEL_VERSION",
+ "FIX_GAIN_KINDS",
+ "FIX_IMPROVES",
+ "FIX_KINDS",
+ "FIX_LEVELS",
+ "FIX_SCOPES",
+ "FIX_TIERS",
+ "FixFirstQueue",
+ "FixItem",
+ "build_fix_first",
+]
diff --git a/packages/core/src/repowise/core/analysis/health/fix_first/build.py b/packages/core/src/repowise/core/analysis/health/fix_first/build.py
new file mode 100644
index 000000000..cde920f80
--- /dev/null
+++ b/packages/core/src/repowise/core/analysis/health/fix_first/build.py
@@ -0,0 +1,1059 @@
+"""Build the Fix-first queue from plain rows, with no store behind them.
+
+Every input is a sequence of rows, a row being a mapping or any object with the
+named attributes (``health.rows.field``). The SQL loader in
+``repowise.core.persistence.crud.analysis.fix_first`` narrows its reads and
+hands the rows here; a caller holding the same rows in memory calls
+:func:`build_fix_first` directly. The builder applies the whole rule, so a
+caller may pass unfiltered rows.
+
+Row shapes (field names are the SQL columns):
+
+``metrics``
+ ``file_path``, ``score``, ``nloc``, ``is_test``, ``analyzed_commit``,
+ ``updated_at``, plus ``commit_count_90d`` (git) and ``dependents`` (graph
+ in-degree).
+``findings``
+ ``file_path``, ``biomarker_type``, ``severity``, ``function_name``,
+ ``line_start``, ``line_end``, ``reason``, ``health_impact``, ``public_id``,
+ ``dimension``, ``status`` (absent = open), and ``details`` /
+ ``details_json`` (``ccn``, ``nloc``, ``max_nesting``) for the numbers a
+ sentence quotes.
+``refactoring``
+ The ``refactoring_opportunities`` columns, ``details`` (or
+ ``details_json``) carrying ``steps``, ``validation_profiles``,
+ ``dependents`` and ``lead_finding_ids``. A row under the minimum worth may
+ omit its details.
+``performance``
+ The ``performance_opportunities`` columns, ``details`` (or
+ ``details_json``) carrying ``facets``, ``plan`` and ``fix_rationale``. A
+ row with no plan, or an expected one, may omit its details.
+``plans``
+ Plan rows named by a refactoring step: ``public_id``, ``evidence`` /
+ ``evidence_json`` and ``plan`` / ``plan_json`` (an extract-method ``span``,
+ ``params``, ``returns``, ``suggested_name``). A step whose plan is absent
+ is kept, with less to say.
+"""
+
+from __future__ import annotations
+
+import functools
+import math
+from collections import Counter, defaultdict
+from collections.abc import Callable, Iterable, Mapping
+from dataclasses import dataclass
+from typing import Any
+
+from repowise.core.analysis.finding_registry import excluded_types
+from repowise.core.analysis.health.models import primary_finding, split_by_origin
+from repowise.core.analysis.health.perf.causal import code_context, execution_context
+from repowise.core.analysis.health.refactoring.extract_helper import _is_generated_path
+from repowise.core.analysis.health.rows import detail_map, field, json_field
+from repowise.core.analysis.health.scoring import biomarker_dimension
+from repowise.core.analysis.health.suggestions import suggestion_for
+
+from . import text
+from .model import (
+ EFFORT_RANK,
+ FIX_EFFORTS,
+ FIX_EXCLUSIONS,
+ FIX_IMPROVES,
+ LEVEL_RANK,
+ TIER_RANK,
+ FixAction,
+ FixConfidence,
+ FixContext,
+ FixEffortEstimate,
+ FixFact,
+ FixFirstQueue,
+ FixGain,
+ FixItem,
+ FixNextCall,
+ FixRankFact,
+ FixRisk,
+ FixSource,
+ FixStep,
+ FixTarget,
+ FixTest,
+ FixTotals,
+ FixVerify,
+ fix_id,
+)
+
+Rows = Iterable[Any]
+
+#: A refactoring whose credited gain is under this is not worth an item. The
+#: refactoring model credits only the share of a finding a plan removes and
+#: drops trivial spans itself (minimum worth), so this floor is on the file.
+MIN_WORTH = 0.5
+#: Credited health gain cut points for value 1, 2 and 3.
+GAIN_CUTS = (0.5, 1.5, 3.0)
+#: Problem-size cut points for value 1 to 4. Health credit is calibrated per
+#: finding and saturates, so a function far past every bar would rank with a
+#: tidy one without these. Each cut is a multiple of the detector's own bar.
+#: CCN 20 is twice the complex_method bar; 40, 80 and 150 double on from it.
+SIZE_CCN = (20, 40, 80, 150)
+#: 100 lines is past the large_method bar; 800 is a module living in one body.
+SIZE_NLOC = (100, 200, 400, 800)
+#: Nesting 5 is one past the nested_complexity bar; 8 is unreadable.
+SIZE_NESTING = (5, 6, 8, 99)
+#: A critical finding or a brain method is at least this size.
+SIZE_SEVERE = 2
+#: Measured size (CCN, lines or nesting alone, before the severity floor and
+#: the hot-file bonus) from which an item leads as "break up", naming the whole
+#: problem: CCN 40, 200 lines or nesting 6.
+SIZE_BREAK_UP = 2
+#: The highest value any unit reaches.
+VALUE_MAX = 4
+#: A file in the top fifth of production files by churn or dependents is hot.
+HOT_QUANTILE = 0.8
+MAX_FACTS = 5
+MAX_TESTS = 5
+MAX_STEPS = 5
+MAX_CONTEXT = 3
+#: In the first HEAD places no kind takes more than HEAD_PER_KIND, unless the
+#: other kinds have nothing at value 2 or above.
+HEAD = 5
+HEAD_PER_KIND = 3
+DEFAULT_LIMIT = 10
+
+
+@dataclass(frozen=True, slots=True)
+class _Unit:
+ """What ranking reads, and how to write the item once it is shown.
+
+ Items are written only for the ranks a caller keeps: the copy, facts and
+ verify block cost more than the ranking, and most units are never shown.
+ """
+
+ id: str
+ kind: str
+ tier: str
+ value: int
+ score: float
+ confidence: str
+ effort: str
+ improves: str
+ write: Callable[[int], FixItem]
+
+
+_VENDORED = frozenset({"vendor", "third_party", "thirdparty", "node_modules"})
+
+
+def _open(row: Any) -> bool:
+ return (field(row, "status") or "open") == "open"
+
+
+def _num(value: Any) -> float:
+ return float(value or 0.0)
+
+
+#: The shared path rules, memoised: they are pure on the path and the test
+#: check dominates a cold build.
+_code_context = functools.lru_cache(maxsize=65536)(code_context)
+_perf_context = functools.lru_cache(maxsize=65536)(execution_context)
+
+
+def _path_exclusion(
+ path: str, is_test: bool | None, context: str | None = None, *, perf: bool = False
+) -> str | None:
+ """Why a file is out of the queue, or ``None`` when it ships.
+
+ Code-shape work reads :func:`code_context`, where a CLI ships; a
+ performance fix reads the stored execution context, where a CLI loop is
+ off the request path. The stored ``is_test`` flag also marks a test.
+ """
+ ctx = context or (_perf_context(path) if perf else _code_context(path))
+ if is_test or ctx == "test":
+ return "test"
+ parts = set(path.lower().split("/")[:-1])
+ if _is_generated_path(path) or parts & _VENDORED:
+ return "generated"
+ # ``unknown`` under a directory is docs, examples or demos: code that does
+ # not ship. A root-level file stays eligible.
+ if ctx == "tooling" or (ctx == "unknown" and parts):
+ return "tooling"
+ return None
+
+
+def hot_cut_offset(count: int) -> int:
+ """Where the top fifth starts in ``count`` ascending values."""
+ return min(int(count * HOT_QUANTILE), count - 1)
+
+
+def hot_cut(value_at_offset: float | None) -> float:
+ """The value at :func:`hot_cut_offset`, never below 1 (zero is not hot)."""
+ return math.inf if value_at_offset is None else max(value_at_offset, 1)
+
+
+def _quantile_cut(values: list[int]) -> float:
+ """The smallest value in the top fifth of production files."""
+ if not values:
+ return math.inf
+ return hot_cut(sorted(values)[hot_cut_offset(len(values))])
+
+
+def _gain_value(gain: float, hot: bool) -> int:
+ return min(3, sum(gain >= cut for cut in GAIN_CUTS) + int(hot))
+
+
+def _magnitude(shape: Mapping[str, int]) -> int:
+ """How far the measured CCN, size or nesting sits past its bar, 0 to 4."""
+ return max(
+ sum(shape.get("ccn", 0) >= c for c in SIZE_CCN),
+ sum(shape.get("nloc", 0) >= c for c in SIZE_NLOC),
+ sum(shape.get("max_nesting", 0) >= c for c in SIZE_NESTING),
+ )
+
+
+def _size_value(shape: Mapping[str, int], hot: bool) -> int:
+ """How big the problem is, 0 to 4; a hot file counts one more."""
+ base = max(_magnitude(shape), SIZE_SEVERE if shape.get("severe") else 0)
+ return min(VALUE_MAX, base + int(hot and base > 0))
+
+
+def _risk(files_touched: int, dependents: int | None) -> FixRisk:
+ deps = dependents or 0
+ if files_touched >= 5 or deps >= 20:
+ level = "high"
+ elif files_touched >= 2 or deps >= 5:
+ level = "medium"
+ else:
+ level = "low"
+ parts = [f"touches {text.plural(files_touched, 'file')}"]
+ if dependents:
+ parts.append(f"{text.plural(dependents, 'file')} import it")
+ return FixRisk(level, dependents, files_touched, "; ".join(parts).capitalize() + ".")
+
+
+def _verify(profile: Mapping[str, Any] | None) -> FixVerify:
+ """The stored validation profile, shown short. Never recomputed here."""
+ if not profile:
+ return FixVerify((), 0, None, "unknown")
+ via = profile.get("via")
+ reason = f"reaches the changed code through the {text.humanize(via)}" if via else "covers it"
+ tests = tuple(FixTest(str(t), reason) for t in (profile.get("tests") or [])[:MAX_TESTS])
+ commands = profile.get("commands") or []
+ basis = profile.get("basis")
+ return FixVerify(
+ tests,
+ int(profile.get("total") or len(tests)),
+ commands[0] if commands else None,
+ basis if basis in ("measured", "inferred") else "unknown",
+ )
+
+
+class _Files:
+ """Per-file facts the units share: metrics, heat, history context."""
+
+ def __init__(
+ self,
+ metrics: Rows,
+ history: Mapping[str, list[Any]],
+ functions: Mapping[tuple[str, str], list[Any]],
+ cuts: tuple[float, float] | None,
+ ) -> None:
+ self.by_path = {field(m, "file_path"): m for m in metrics}
+ self.functions = functions
+ if cuts is None:
+ production = [m for m in self.by_path.values() if not field(m, "is_test")]
+ cuts = (
+ _quantile_cut([field(m, "commit_count_90d") or 0 for m in production]),
+ _quantile_cut([field(m, "dependents") or 0 for m in production]),
+ )
+ self.churn_cut, self.deps_cut = cuts
+ self.history = history
+
+ def is_test(self, path: str) -> bool | None:
+ """The stored flag; ``None`` when the file has no metric row or flag."""
+ return field(self.by_path.get(path), "is_test")
+
+ def commits(self, path: str) -> int:
+ return int(field(self.by_path.get(path), "commit_count_90d") or 0)
+
+ def dependents(self, path: str) -> int | None:
+ return field(self.by_path.get(path), "dependents")
+
+ def nloc(self, path: str) -> int | None:
+ return field(self.by_path.get(path), "nloc")
+
+ def hot(self, path: str) -> bool:
+ return self.commits(path) >= self.churn_cut or (self.dependents(path) or 0) >= self.deps_cut
+
+ def shape(self, path: str, symbol: str | None) -> dict[str, int]:
+ """The measured size of ``symbol`` in ``path``, from its findings."""
+ if not symbol:
+ return {}
+ found = self.functions.get((path, symbol))
+ if found is None:
+ tail = symbol.rsplit(".", 1)[-1]
+ found = next(
+ (
+ rows
+ for (p, fn), rows in self.functions.items()
+ if p == path and fn.rsplit(".", 1)[-1] == tail
+ ),
+ (),
+ )
+ return _measure(found)
+
+ def why(
+ self,
+ path: str,
+ *,
+ measured: str | None,
+ fallback: str,
+ dependents: int | None = None,
+ ) -> str:
+ """One sentence: the measured problem, then who depends on the file."""
+ deps = dependents if dependents is not None else self.dependents(path)
+ head = measured or fallback.rstrip(". ")
+ return f"{head}{text.exposure(deps, self.commits(path))}."
+
+ def context(self, path: str) -> tuple[FixContext, ...]:
+ """History is context: shown beside the item, never ranked on."""
+ out: list[FixContext] = []
+ commits = self.commits(path)
+ if commits:
+ out.append(FixContext("changes in 90 days", str(commits)))
+ if self.is_test(path):
+ out.append(FixContext("file kind", "test"))
+ ranked = sorted(self.history.get(path, ()), key=lambda f: -_num(field(f, "health_impact")))
+ for f in ranked:
+ out.append(
+ FixContext(text.humanize(field(f, "biomarker_type") or ""), field(f, "reason") or "")
+ )
+ return tuple(out[:MAX_CONTEXT])
+
+ def common_facts(self, path: str, dependents: int | None = None) -> list[FixFact]:
+ out = []
+ deps = dependents if dependents is not None else self.dependents(path)
+ if deps:
+ out.append(FixFact("files that import it", str(deps)))
+ commits = self.commits(path)
+ if commits:
+ out.append(FixFact("changes in 90 days", str(commits)))
+ return out
+
+
+def _tier(value: int, confidence: str, ready: bool) -> tuple[str, str]:
+ if value >= 2 and LEVEL_RANK.get(confidence, 0) >= 1 and ready:
+ return "now", "worth doing, and the plan is safe to start"
+ if value >= 2:
+ return "next", "worth doing; the fix needs judgment"
+ return "later", "smaller payoff"
+
+
+def _finish(
+ *,
+ kind: str,
+ source_id: str,
+ value: int,
+ ready: bool,
+ score: float,
+ confidence: str,
+ effort: str,
+ improves: str,
+ rank_inputs: Callable[[], list[FixRankFact]],
+ fields: Callable[[], dict[str, Any]],
+) -> _Unit:
+ confidence = confidence if confidence in LEVEL_RANK else "low"
+ effort = effort if effort in FIX_EFFORTS else "M"
+ tier, why_tier = _tier(value, confidence, ready)
+ item_id = fix_id(kind, source_id)
+
+ def write(rank: int) -> FixItem:
+ return FixItem(
+ id=item_id,
+ rank=rank,
+ tier=tier,
+ kind=kind,
+ improves=improves,
+ why_ranked=(
+ FixRankFact("value", str(value)),
+ *rank_inputs(),
+ FixRankFact("tier", why_tier),
+ ),
+ **fields(),
+ )
+
+ return _Unit(item_id, kind, tier, value, score, confidence, effort, improves, write)
+
+
+# --- refactoring ----------------------------------------------------------------
+
+
+def _plan_body(plan: Any) -> dict[str, Any]:
+ if plan is None:
+ return {}
+ body = json_field(plan, "plan", None) or json_field(plan, "plan_json", {})
+ return body if isinstance(body, dict) else {}
+
+
+def _evidence(plan: Any) -> dict[str, Any]:
+ if plan is None:
+ return {}
+ found = json_field(plan, "evidence", None) or json_field(plan, "evidence_json", {})
+ return found if isinstance(found, dict) else {}
+
+
+def _span(plan: Any) -> tuple[int | None, int | None]:
+ span = _plan_body(plan).get("span")
+ if isinstance(span, dict):
+ return span.get("start"), span.get("end")
+ return None, None
+
+
+def _refactor_step(order: int, step: Mapping[str, Any], plan: Any) -> FixStep:
+ kind = step.get("refactoring_type") or ""
+ path = step.get("file_path") or ""
+ sym = text.short_symbol(step.get("target_symbol")) or text.basename(path)
+ start, end = _span(plan)
+ if kind == "extract_method":
+ body = _plan_body(plan)
+ into = text.signature(
+ body.get("suggested_name"),
+ list(body.get("params") or []),
+ list(body.get("returns") or []),
+ )
+ where = f"lines {start}-{end} of {sym}" if start and end else f"part of {sym}"
+ line_text = f"Extract {where} into {into}"
+ elif kind == "extract_helper":
+ line_text = f"Replace the duplicate in {sym} with a call to one shared helper"
+ elif kind == "extract_class":
+ line_text = f"Move a cohesive group of {sym}'s methods into a new class"
+ elif kind == "split_file":
+ line_text = f"Split {text.basename(path)} along its independent groups"
+ elif kind == "break_cycle":
+ line_text = f"Break the import cycle at {text.basename(path)}"
+ elif kind == "move_method":
+ line_text = f"Move {sym} to the class it uses most"
+ else:
+ line_text = f"Apply the {text.humanize(kind)} step to {sym}"
+ mechanical = (step.get("applicability") or {}).get("classification") == "mechanical"
+ return FixStep(order, line_text, path, start or step.get("line_start"), mechanical)
+
+
+def _refactor_unit(
+ row: Any,
+ details: Mapping[str, Any],
+ steps: list[Mapping[str, Any]],
+ gain: float,
+ plans: Mapping[str, Any],
+ files: _Files,
+) -> _Unit:
+ path = field(row, "file_path")
+ lead = steps[0]
+ lead_type = lead.get("refactoring_type") or field(row, "lead_refactoring_type") or ""
+ sym = text.short_symbol(lead.get("target_symbol")) or text.basename(path)
+ marker = field(row, "lead_biomarker") or (
+ lead_type if lead_type in ("split_file", "break_cycle") else None
+ )
+ mechanical_n = sum(
+ (s.get("applicability") or {}).get("classification") == "mechanical" for s in steps
+ )
+ mechanical = mechanical_n == len(steps)
+ confidence = field(row, "confidence") or "medium"
+ hot = files.hot(path)
+ dimension = biomarker_dimension(marker) if marker else "maintainability"
+ shape = files.shape(path, lead.get("target_symbol"))
+ size = _size_value(shape, hot)
+
+ def fields() -> dict[str, Any]:
+ lead_plan = plans.get(lead.get("plan_id"))
+ start, end = _span(lead_plan)
+ body = _plan_body(lead_plan)
+ if (
+ _magnitude(shape) >= SIZE_BREAK_UP
+ and lead_type == "extract_method"
+ and start
+ and end
+ ):
+ # The helper's signature is in the step; the title keeps its name,
+ # or drops it when the problem and the span fill the line.
+ title = (
+ f"Start breaking up {sym} ({text.size_brief(shape)}): first lift lines "
+ f"{start}-{end}"
+ )
+ into = f" into {body.get('suggested_name') or 'a helper'}"
+ if len(title + into) <= text.TITLE_MAX:
+ title += into
+ else:
+ key = (
+ "extract_method_span"
+ if lead_type == "extract_method" and start and end
+ else lead_type
+ )
+ title = text.REFACTOR_TITLE.get(key, "Refactor {file}").format(
+ sym=sym,
+ file=text.basename(path),
+ start=start,
+ end=end,
+ name=body.get("suggested_name") or "a helper",
+ )
+ if len(steps) > 1:
+ title += f" (+{text.plural(len(steps) - 1, 'more step')})"
+ dependents = details.get("dependents")
+ if dependents is None:
+ dependents = files.dependents(path)
+ fix_steps = tuple(
+ _refactor_step(i + 1, s, plans.get(s.get("plan_id"))) for i, s in enumerate(steps)
+ )
+ facts = [
+ FixFact("health recoverable", f"+{gain:.1f}", "inferred"),
+ FixFact("steps", f"{len(steps)} ({mechanical_n} mechanical)"),
+ *files.common_facts(path, dependents),
+ ]
+ nloc = files.nloc(path)
+ if nloc:
+ facts.append(FixFact("file size", f"{nloc} lines"))
+ profiles = {p.get("id"): p for p in details.get("validation_profiles") or []}
+ profile = profiles.get(lead.get("validation_profile_id")) or next(
+ iter(profiles.values()), None
+ )
+ plan_ids = tuple(s.get("plan_id") for s in steps if s.get("plan_id"))
+ return {
+ "title": text.clip(title),
+ "target": FixTarget(
+ path,
+ sym if lead.get("target_symbol") else None,
+ fix_steps[0].line,
+ lead.get("line_end"),
+ ),
+ "why": files.why(
+ path,
+ measured=_refactor_measure(lead_type, sym, path, lead, lead_plan, files),
+ fallback=text.problem(marker, sym),
+ dependents=dependents,
+ ),
+ "facts": tuple(facts[:MAX_FACTS]),
+ "action": FixAction(
+ f"{text.plural(len(steps), 'step')}, {mechanical_n} mechanical",
+ fix_steps[:MAX_STEPS],
+ len(fix_steps),
+ mechanical,
+ ),
+ "gain": FixGain(
+ "health_points", round(gain, 3), text.health_gain(gain, ceiling=False)
+ ),
+ "effort": FixEffortEstimate(effort_bucket, "sized by the stored plan"),
+ "risk": _risk(int(field(row, "affected_files_total") or 1), dependents),
+ "confidence": FixConfidence(
+ confidence if confidence in LEVEL_RANK else "medium",
+ f"{mechanical_n} of {text.plural(len(steps), 'step')} proven mechanical "
+ "by the plan",
+ ),
+ "verify": _verify(profile),
+ "context": files.context(path),
+ "source": FixSource(
+ field(row, "opportunity_id"),
+ plan_ids,
+ tuple(details.get("lead_finding_ids") or ()),
+ ),
+ "next_call": FixNextCall(
+ "get_health", {"opportunity_id": field(row, "opportunity_id")}
+ ),
+ }
+
+ effort_bucket = field(row, "effort_bucket") or "M"
+ effort_bucket = effort_bucket if effort_bucket in FIX_EFFORTS else "M"
+ return _finish(
+ kind="refactor",
+ source_id=field(row, "opportunity_id"),
+ value=max(_gain_value(gain, hot), size),
+ ready=mechanical or confidence == "high",
+ score=_num(field(row, "rank_score")),
+ confidence=confidence if confidence in LEVEL_RANK else "medium",
+ effort=effort_bucket,
+ improves=dimension if dimension in FIX_IMPROVES else "maintainability",
+ rank_inputs=lambda: [
+ FixRankFact("health gain", f"{gain:.2f}"),
+ FixRankFact("problem size", str(size)),
+ FixRankFact("hot file", "yes" if hot else "no"),
+ ],
+ fields=fields,
+ )
+
+
+def _refactor_measure(
+ kind: str, sym: str, path: str, step: Mapping[str, Any], plan: Any, files: _Files
+) -> str | None:
+ """The numbers behind a refactoring, from its plan evidence or its findings."""
+ evidence = _evidence(plan)
+ name = text.basename(path)
+ if kind == "split_file" and evidence.get("file_nloc"):
+ return (
+ f"{name}: {text.plural(int(evidence['file_nloc']), 'line')} in "
+ f"{evidence.get('group_count') or 'several'} loosely coupled groups"
+ )
+ if kind == "break_cycle" and evidence.get("cycle_size"):
+ return f"{name} is in an import cycle of {evidence['cycle_size']} files"
+ if kind == "extract_class" and evidence.get("method_count"):
+ return (
+ f"{sym}: {evidence['method_count']} methods in "
+ f"{evidence.get('lcom4') or 'several'} groups that share little state"
+ )
+ if kind == "extract_helper" and evidence.get("duplicated_lines"):
+ return (
+ f"{sym}: {evidence['duplicated_lines']} lines duplicated across "
+ f"{evidence.get('occurrence_count') or 2} places"
+ )
+ return text.measured(sym, files.shape(path, step.get("target_symbol")))
+
+
+# --- performance ----------------------------------------------------------------
+
+
+def _perf_ready(row: Any) -> bool:
+ return (
+ field(row, "actionability_state") != "expected"
+ and field(row, "plan_state") == "available"
+ and bool(field(row, "fix_strategy"))
+ )
+
+
+def _perf_value(row: Any, facets: Mapping[str, Any]) -> int:
+ production = field(row, "execution_context") == "production"
+ grows = facets.get("loop_magnitude") == "grows_with_data"
+ unknown = facets.get("loop_magnitude") in (None, "unknown")
+ if (
+ production
+ and facets.get("exposure") == "entry_reachable"
+ and grows
+ and field(row, "boundary_kind") in ("db", "network")
+ ):
+ return 3
+ if production and (grows or unknown):
+ return 2
+ return 1
+
+
+def _perf_unit(rows: list[Any], files: _Files) -> _Unit:
+ lead = min(rows, key=lambda r: (field(r, "rank_position") or 0, field(r, "opportunity_id")))
+ details = detail_map(lead)
+ facets = details.get("facets") or {}
+ plan = details.get("plan") or {}
+ path = field(lead, "file_path") or ""
+ symbol = field(lead, "intervention_symbol")
+ exposure = facets.get("exposure")
+ magnitude = facets.get("loop_magnitude")
+ plan_steps = plan.get("steps") or []
+ mechanical = bool(plan_steps) and all(
+ s.get("applicability") == "mechanical" for s in plan_steps
+ )
+ ready = (
+ field(lead, "actionability_state") == "plan_ready" or field(lead, "fix_safety") == "proven"
+ )
+ effort = plan.get("effort_bucket")
+
+ def fields() -> dict[str, Any]:
+ # A cause with no intervention symbol is named by the function its plan edits.
+ first = plan_steps[0] if plan_steps else {}
+ name = (
+ text.short_symbol(symbol)
+ or text.short_symbol(first.get("symbol"))
+ or text.basename(path)
+ )
+ noun = text.BOUNDARY_NOUN.get(field(lead, "boundary_kind") or "")
+ call_sites = int(field(lead, "affected_call_sites_total") or 0)
+ files_n = int(field(lead, "affected_files_total") or 1)
+ amplification = facets.get("amplification")
+ call = f"{noun} call" if noun else "costly call"
+ shaped = text.PERF_SHAPE.get(field(lead, "biomarker_type") or "")
+ if shaped:
+ title = shaped[0].format(name=name)
+ elif noun and call_sites > 1:
+ title = f"Batch the {noun} calls loops make through {name}"
+ elif noun:
+ title = f"Move the {noun} call in {name} out of its loop"
+ else:
+ title = f"Fix the repeated work in {name}"
+ if shaped:
+ what, gain_text = shaped[1].format(name=name), shaped[2]
+ elif amplification == "quadratic":
+ what = f"{name} runs nested loops over the same data"
+ gain_text = "nested loop work that grows with the square of the data"
+ elif amplification == "per_call":
+ what, gain_text = f"{name} repeats a {call} on every call", f"one fewer {call} per call"
+ else:
+ what = f"{name} makes a {call} once per loop iteration"
+ gain_text = f"one {call} per loop iteration" + (
+ ", grows with the data"
+ if magnitude == "grows_with_data"
+ else ", bounded by a fixed loop"
+ if magnitude == "bounded"
+ else "; loop size unknown"
+ )
+ reach = []
+ if call_sites > 1:
+ reach.append(f"{call_sites} call sites in {text.plural(files_n, 'file')} reach it")
+ if exposure == "entry_reachable":
+ reach.append("an entry point reaches it")
+ if magnitude == "grows_with_data":
+ reach.append("the loop grows with the data")
+ facts = [
+ FixFact("call sites", str(call_sites)),
+ FixFact("files", str(files_n)),
+ FixFact(
+ "reachable from an entry point",
+ {"entry_reachable": "Yes", "not_entry_reachable": "No"}.get(exposure or "", "Unknown"),
+ "inferred" if exposure in ("entry_reachable", "not_entry_reachable") else "unknown",
+ ),
+ FixFact(
+ "loop size",
+ text.humanize(magnitude) if magnitude and magnitude != "n/a" else "unknown",
+ "inferred" if magnitude in ("grows_with_data", "bounded") else "unknown",
+ ),
+ ]
+ sinks = sorted({field(r, "terminal_sink") for r in rows if field(r, "terminal_sink")})
+ if len(sinks) > 1:
+ facts.append(FixFact("sinks this fix covers", str(len(sinks))))
+ steps = tuple(
+ FixStep(
+ int(s.get("order") or i + 1),
+ s.get("action", "")
+ + (f" ({text.short_symbol(s.get('symbol'))})" if s.get("symbol") else ""),
+ s.get("file_path") or path,
+ s.get("line"),
+ s.get("applicability") == "mechanical",
+ )
+ for i, s in enumerate(plan_steps)
+ )
+ strategy = field(lead, "fix_strategy") or ""
+ return {
+ "title": text.clip(title),
+ "target": FixTarget(
+ path, name if symbol or first.get("symbol") else None, first.get("line")
+ ),
+ "why": f"{what}; {', '.join(reach) or 'the loop size is unknown'}.",
+ "facts": tuple(facts[:MAX_FACTS]),
+ "action": FixAction(
+ text.FIX_STRATEGY.get(strategy, text.humanize(strategy).capitalize()),
+ steps[:MAX_STEPS],
+ len(steps),
+ mechanical,
+ ),
+ "gain": FixGain("performance", None, gain_text),
+ "effort": FixEffortEstimate(
+ effort if effort in FIX_EFFORTS else "M",
+ "sized by the stored plan" if effort else "not sized; the plan has no estimate",
+ ),
+ "risk": _risk(files_n, None),
+ "confidence": FixConfidence(
+ confidence,
+ details.get("fix_rationale")
+ or f"{text.humanize(field(lead, 'actionability_state'))} plan",
+ ),
+ "verify": _verify(plan.get("validation")),
+ "context": files.context(path),
+ "source": FixSource(field(lead, "opportunity_id")),
+ "next_call": FixNextCall(
+ "get_health", {"opportunity_id": field(lead, "opportunity_id")}
+ ),
+ }
+
+ confidence = facets.get("actionability_confidence") or "low"
+ confidence = confidence if confidence in LEVEL_RANK else "low"
+ return _finish(
+ kind="perf_fix",
+ source_id=f"{path}::{symbol or path}",
+ value=_perf_value(lead, facets),
+ ready=ready or mechanical,
+ score=_num(field(lead, "rank_score")),
+ confidence=confidence,
+ effort=effort or "M",
+ improves="performance",
+ rank_inputs=lambda: [
+ FixRankFact("runs in", field(lead, "execution_context") or "unknown"),
+ FixRankFact("entry reachable", exposure or "unknown"),
+ FixRankFact("loop size", magnitude or "unknown"),
+ FixRankFact("boundary", field(lead, "boundary_kind") or "none"),
+ ],
+ fields=fields,
+ )
+
+
+# --- findings with no plan ----------------------------------------------------------
+
+
+def _finding_unit(lead: Any, files: _Files) -> _Unit:
+ path = field(lead, "file_path")
+ marker = field(lead, "biomarker_type") or ""
+ function = field(lead, "function_name")
+ impact = _num(field(lead, "health_impact"))
+ hot = files.hot(path)
+ public_id = field(lead, "public_id")
+ dimension = biomarker_dimension(marker)
+ shape = files.shape(path, function)
+ size = _size_value(shape, hot)
+
+ def fields() -> dict[str, Any]:
+ where = function or text.basename(path)
+ summary = text.first_sentence(suggestion_for(marker))
+ line = field(lead, "line_start")
+ if _magnitude(shape) >= SIZE_BREAK_UP and function:
+ title = f"Break up {where} ({text.size_brief(shape)})"
+ else:
+ title = text.FINDING_TITLE.get(marker, "Address the finding in {where}").format(
+ where=where
+ )
+ return {
+ "title": text.clip(title),
+ "target": FixTarget(path, function, line, field(lead, "line_end")),
+ "why": files.why(
+ path,
+ measured=text.measured(where, files.shape(path, function)),
+ fallback=field(lead, "reason") or text.problem(marker, where),
+ ),
+ "facts": tuple(
+ [
+ FixFact("finding", marker),
+ FixFact("severity", field(lead, "severity") or "unknown"),
+ *files.common_facts(path),
+ ][:MAX_FACTS]
+ ),
+ "action": FixAction(summary, (FixStep(1, summary, path, line, False),), 1, False),
+ "gain": FixGain(
+ "health_points", round(impact, 3), text.health_gain(impact, ceiling=True)
+ ),
+ "effort": FixEffortEstimate("M", "not sized; no stored plan covers this finding"),
+ "risk": _risk(1, files.dependents(path)),
+ "confidence": FixConfidence(
+ "medium", "Measured from the code; no stored plan has checked a fix."
+ ),
+ "verify": _verify(None),
+ "context": files.context(path),
+ "source": FixSource(None, (), (public_id,) if public_id else ()),
+ "next_call": FixNextCall(
+ "get_health", {"targets": [path], "include": ["biomarkers"]}
+ ),
+ }
+
+ return _finish(
+ kind="finding",
+ source_id=public_id or f"{path}::{marker}::{function or ''}",
+ value=max(_gain_value(impact, hot), size),
+ ready=False,
+ score=impact,
+ confidence="medium",
+ effort="M",
+ improves=dimension if dimension in FIX_IMPROVES else "defect",
+ rank_inputs=lambda: [
+ FixRankFact("health gain", f"{impact:.2f}"),
+ FixRankFact("problem size", str(size)),
+ FixRankFact("hot file", "yes" if hot else "no"),
+ ],
+ fields=fields,
+ )
+
+
+# --- order ------------------------------------------------------------------------
+
+
+def _order(units: list[_Unit]) -> list[_Unit]:
+ ranked = sorted(
+ units,
+ key=lambda u: (
+ -u.value,
+ TIER_RANK[u.tier],
+ -LEVEL_RANK.get(u.confidence, 0),
+ EFFORT_RANK.get(u.effort, 1),
+ -u.score,
+ u.id,
+ ),
+ )
+ head: list[_Unit] = []
+ taken: Counter[str] = Counter()
+ while ranked and len(head) < HEAD:
+ pick = ranked[0]
+ if taken[pick.kind] >= HEAD_PER_KIND:
+ pick = next(
+ (
+ u
+ for u in ranked
+ if u.value >= 2
+ and u.kind != pick.kind
+ and taken[u.kind] < HEAD_PER_KIND
+ ),
+ pick,
+ )
+ ranked.remove(pick)
+ head.append(pick)
+ taken[pick.kind] += 1
+ return head + ranked
+
+
+def _by_function(findings: Iterable[Any]) -> dict[tuple[str, str], list[Any]]:
+ out: dict[tuple[str, str], list[Any]] = defaultdict(list)
+ for f in findings:
+ name = field(f, "function_name")
+ if name:
+ out[(field(f, "file_path"), name)].append(f)
+ return dict(out)
+
+
+def _measure(findings: Iterable[Any]) -> dict[str, int]:
+ """A function's largest measured CCN, size and nesting across its findings.
+
+ ``severe`` is set when any of them is critical or a brain method.
+ """
+ shape: dict[str, int] = {}
+ for f in findings:
+ if field(f, "severity") == "critical" or field(f, "biomarker_type") == "brain_method":
+ shape["severe"] = 1
+ details = detail_map(f)
+ for k in ("ccn", "nloc", "max_nesting", "lcom4", "method_count"):
+ v = details.get(k)
+ if isinstance(v, (int, float)) and v > shape.get(k, 0):
+ shape[k] = int(v)
+ return shape
+
+
+def _basis(metrics: Rows) -> dict[str, str | None]:
+ stamped = [(str(at), at, m) for m in metrics if (at := field(m, "updated_at"))]
+ if not stamped:
+ return {"analyzed_commit": None, "health_analyzed_at": None}
+ _key, at, latest = max(stamped, key=lambda s: s[0])
+ return {
+ "analyzed_commit": field(latest, "analyzed_commit"),
+ "health_analyzed_at": at.isoformat() if hasattr(at, "isoformat") else str(at),
+ }
+
+
+def build_fix_first(
+ *,
+ metrics: Rows = (),
+ findings: Rows = (),
+ refactoring: Rows = (),
+ performance: Rows = (),
+ plans: Rows = (),
+ limit: int | None = DEFAULT_LIMIT,
+ scope: str = "production",
+ basis: Mapping[str, str | None] | None = None,
+ item_id: str | None = None,
+ hot_cuts: tuple[float, float] | None = None,
+) -> FixFirstQueue:
+ """One ranked queue of what to fix, from stored rows (shapes in the module docstring).
+
+ ``scope="all"`` keeps test files (labelled in ``context``); ``limit=None``
+ keeps every eligible item. ``basis`` is the analysis stamp when the caller
+ read it apart; otherwise it comes from the metrics' ``updated_at``.
+ ``item_id`` keeps just that item, at its rank, for a lookup by id.
+ ``hot_cuts`` are the (churn, dependents) thresholds for a hot file when the
+ caller measured them over more files than it passed in ``metrics``; see
+ :func:`hot_cut` for the rule.
+ """
+ metrics = list(metrics)
+ keep_tests = scope == "all"
+ excluded = dict.fromkeys(FIX_EXCLUSIONS, 0)
+ hidden = excluded_types()
+
+ by_file: dict[str, list[Any]] = defaultdict(list)
+ for f in findings:
+ if (
+ _num(field(f, "health_impact")) > 0
+ and field(f, "biomarker_type") not in hidden
+ and field(f, "dimension") != "performance"
+ and _open(f)
+ ):
+ by_file[field(f, "file_path")].append(f)
+ split = {path: split_by_origin(rows) for path, rows in by_file.items()}
+ files = _Files(
+ metrics,
+ {p: hist for p, (_shape, hist) in split.items() if hist},
+ _by_function(f for shape, _hist in split.values() for f in shape),
+ hot_cuts,
+ )
+
+ def out_of_scope(path: str, context: str | None = None, *, perf: bool = False) -> bool:
+ reason = _path_exclusion(path, files.is_test(path), context, perf=perf)
+ if reason is None or (reason == "test" and keep_tests):
+ return False
+ excluded[reason] += 1
+ return True
+
+ plan_rows = {field(p, "public_id"): p for p in plans}
+ units: list[_Unit] = []
+ planned_files: set[str] = set()
+ for row in sorted(
+ (r for r in refactoring if _open(r)),
+ key=lambda r: (field(r, "rank_position") or 0, field(r, "opportunity_id")),
+ ):
+ path = field(row, "file_path")
+ if out_of_scope(path):
+ continue
+ if _num(field(row, "recoverable_health")) < MIN_WORTH:
+ excluded["below_min_worth"] += 1
+ continue
+ details = detail_map(row)
+ steps = list(details.get("steps") or [])
+ gain = _num(field(row, "recoverable_health"))
+ if not steps:
+ excluded["below_min_worth"] += 1
+ continue
+ units.append(_refactor_unit(row, details, steps, gain, plan_rows, files))
+ # Only a plan that became an item speaks for the file's findings; an
+ # excluded one leaves them to compete on their own.
+ planned_files.add(path)
+
+ # Ceiling: grouped by the intervention as stored, until persistence writes
+ # one row per intervention.
+ groups: dict[tuple[str, str], list[Any]] = defaultdict(list)
+ for row in performance:
+ if _open(row):
+ path = field(row, "file_path") or ""
+ groups[(path, field(row, "intervention_symbol") or path)].append(row)
+ for (path, _symbol), rows in groups.items():
+ context = field(rows[0], "execution_context")
+ if out_of_scope(path, context, perf=True):
+ continue
+ ready = [r for r in rows if _perf_ready(r)]
+ if not ready:
+ expected = any(field(r, "actionability_state") == "expected" for r in rows)
+ excluded["expected" if expected else "no_plan"] += 1
+ continue
+ units.append(_perf_unit(ready, files))
+
+ for path, (shape, history) in split.items():
+ if path in planned_files:
+ continue
+ lead = primary_finding(shape)
+ if lead is None and not history:
+ continue # advisory only: nothing to fix, nothing to count
+ if out_of_scope(path):
+ continue
+ if lead is None:
+ excluded["history_only"] += 1
+ continue
+ units.append(_finding_unit(lead, files))
+
+ ordered = _order(units)
+ if item_id is not None:
+ shown = [(i, u) for i, u in enumerate(ordered) if u.id == item_id]
+ else:
+ keep = ordered if limit is None else ordered[: max(limit, 0)]
+ shown = list(enumerate(keep))
+ by_improves = Counter(u.improves for u in units)
+ return FixFirstQueue(
+ items=tuple(u.write(rank) for rank, u in shown),
+ totals=FixTotals(
+ candidates=len(units) + sum(excluded.values()),
+ eligible=len(units),
+ shown=len(shown),
+ excluded=excluded,
+ ),
+ by_improves={k: by_improves.get(k, 0) for k in FIX_IMPROVES},
+ basis=dict(basis) if basis is not None else _basis(metrics),
+ )
+
+
+__all__ = [
+ "DEFAULT_LIMIT",
+ "GAIN_CUTS",
+ "HEAD",
+ "HEAD_PER_KIND",
+ "MIN_WORTH",
+ "build_fix_first",
+ "hot_cut",
+ "hot_cut_offset",
+]
diff --git a/packages/core/src/repowise/core/analysis/health/fix_first/model.py b/packages/core/src/repowise/core/analysis/health/fix_first/model.py
new file mode 100644
index 000000000..ec95e4ad8
--- /dev/null
+++ b/packages/core/src/repowise/core/analysis/health/fix_first/model.py
@@ -0,0 +1,269 @@
+"""What one Fix-first item is, and the closed vocabularies it is written in.
+
+Mirrored by ``packages/types/src/fix-first.ts``; ``test_wire_vocabulary_parity``
+fails when the two disagree.
+"""
+
+from __future__ import annotations
+
+import hashlib
+from dataclasses import asdict, dataclass, field
+from typing import Any, Literal, get_args
+
+#: Bumped when ranking, eligibility or the item shape changes meaning.
+FIX_FIRST_MODEL_VERSION = 1
+
+FixTier = Literal["now", "next", "later"]
+FIX_TIERS: tuple[str, ...] = get_args(FixTier)
+
+FixKind = Literal["refactor", "perf_fix", "finding"]
+FIX_KINDS: tuple[str, ...] = get_args(FixKind)
+
+FixImproves = Literal["defect", "maintainability", "performance"]
+FIX_IMPROVES: tuple[str, ...] = get_args(FixImproves)
+
+FixGainKind = Literal["health_points", "performance"]
+FIX_GAIN_KINDS: tuple[str, ...] = get_args(FixGainKind)
+
+FixEffort = Literal["S", "M", "L", "XL"]
+FIX_EFFORTS: tuple[str, ...] = get_args(FixEffort)
+
+FixLevel = Literal["high", "medium", "low"]
+FIX_LEVELS: tuple[str, ...] = get_args(FixLevel)
+
+FixFactBasis = Literal["measured", "inferred", "unknown"]
+FIX_FACT_BASES: tuple[str, ...] = get_args(FixFactBasis)
+
+FixExclusion = Literal[
+ "test", "tooling", "generated", "expected", "no_plan", "below_min_worth", "history_only"
+]
+FIX_EXCLUSIONS: tuple[str, ...] = get_args(FixExclusion)
+
+FixScope = Literal["production", "all"]
+FIX_SCOPES: tuple[str, ...] = get_args(FixScope)
+
+TIER_RANK = {t: i for i, t in enumerate(FIX_TIERS)}
+LEVEL_RANK = {"high": 2, "medium": 1, "low": 0}
+EFFORT_RANK = {e: i for i, e in enumerate(FIX_EFFORTS)}
+
+_ID_PREFIX = "fix1_"
+
+
+def fix_id(kind: str, source_id: str) -> str:
+ """Stable while the source id is: the item's kind and what it was built from."""
+ return _ID_PREFIX + hashlib.sha256(f"{kind}:{source_id}".encode()).hexdigest()[:20]
+
+
+@dataclass(frozen=True, slots=True)
+class FixTarget:
+ file_path: str
+ symbol: str | None = None
+ line_start: int | None = None
+ line_end: int | None = None
+
+
+@dataclass(frozen=True, slots=True)
+class FixFact:
+ label: str
+ value: str
+ basis: FixFactBasis = "measured"
+
+
+@dataclass(frozen=True, slots=True)
+class FixRankFact:
+ factor: str
+ value: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixStep:
+ order: int
+ text: str
+ file_path: str
+ line: int | None = None
+ mechanical: bool = False
+
+
+@dataclass(frozen=True, slots=True)
+class FixAction:
+ summary: str
+ steps: tuple[FixStep, ...]
+ steps_total: int
+ mechanical: bool
+
+
+@dataclass(frozen=True, slots=True)
+class FixGain:
+ kind: FixGainKind
+ value: float | None
+ text: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixEffortEstimate:
+ bucket: FixEffort
+ basis: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixRisk:
+ level: FixLevel
+ dependents: int | None
+ files_touched: int
+ text: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixConfidence:
+ level: FixLevel
+ reason: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixTest:
+ path: str
+ reason: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixVerify:
+ tests: tuple[FixTest, ...]
+ tests_total: int
+ command: str | None
+ basis: FixFactBasis
+
+
+@dataclass(frozen=True, slots=True)
+class FixContext:
+ label: str
+ value: str
+
+
+@dataclass(frozen=True, slots=True)
+class FixSource:
+ opportunity_id: str | None = None
+ plan_ids: tuple[str, ...] = ()
+ finding_ids: tuple[str, ...] = ()
+
+
+@dataclass(frozen=True, slots=True)
+class FixNextCall:
+ tool: str
+ arguments: dict[str, Any]
+
+
+@dataclass(frozen=True, slots=True)
+class FixItem:
+ id: str
+ rank: int
+ tier: FixTier
+ kind: FixKind
+ improves: FixImproves
+ title: str
+ target: FixTarget
+ why: str
+ facts: tuple[FixFact, ...]
+ action: FixAction
+ gain: FixGain
+ effort: FixEffortEstimate
+ risk: FixRisk
+ confidence: FixConfidence
+ verify: FixVerify
+ context: tuple[FixContext, ...]
+ source: FixSource
+ next_call: FixNextCall
+ why_ranked: tuple[FixRankFact, ...] = ()
+
+ def as_dict(self) -> dict[str, Any]:
+ return asdict(self)
+
+ def compact(self) -> dict[str, Any]:
+ """The projection a list renders; the full item is one lookup away."""
+ return {
+ "id": self.id,
+ "tier": self.tier,
+ "kind": self.kind,
+ "title": self.title,
+ "target": asdict(self.target),
+ "why": self.why,
+ "gain": self.gain.text,
+ "effort": self.effort.bucket,
+ "confidence": self.confidence.level,
+ "next_call": asdict(self.next_call),
+ }
+
+
+def _exclusions() -> dict[str, int]:
+ return dict.fromkeys(FIX_EXCLUSIONS, 0)
+
+
+@dataclass(frozen=True, slots=True)
+class FixTotals:
+ candidates: int = 0
+ eligible: int = 0
+ shown: int = 0
+ excluded: dict[str, int] = field(default_factory=_exclusions)
+
+
+@dataclass(frozen=True, slots=True)
+class FixFirstQueue:
+ items: tuple[FixItem, ...] = ()
+ totals: FixTotals = field(default_factory=FixTotals)
+ by_improves: dict[str, int] = field(default_factory=lambda: dict.fromkeys(FIX_IMPROVES, 0))
+ model_version: int = FIX_FIRST_MODEL_VERSION
+ basis: dict[str, str | None] = field(
+ default_factory=lambda: {"analyzed_commit": None, "health_analyzed_at": None}
+ )
+
+ @property
+ def lead(self) -> FixItem | None:
+ return self.items[0] if self.items else None
+
+ def find(self, item_id: str) -> FixItem | None:
+ return next((i for i in self.items if i.id == item_id), None)
+
+ def as_dict(self, *, compact: bool = False) -> dict[str, Any]:
+ render = (lambda i: i.compact()) if compact else (lambda i: i.as_dict())
+ return {
+ "items": [render(i) for i in self.items],
+ "lead": render(self.lead) if self.lead else None,
+ "totals": asdict(self.totals),
+ "by_improves": dict(self.by_improves),
+ "model_version": self.model_version,
+ "basis": dict(self.basis),
+ }
+
+
+__all__ = [
+ "EFFORT_RANK",
+ "FIX_EFFORTS",
+ "FIX_EXCLUSIONS",
+ "FIX_FACT_BASES",
+ "FIX_FIRST_MODEL_VERSION",
+ "FIX_GAIN_KINDS",
+ "FIX_IMPROVES",
+ "FIX_KINDS",
+ "FIX_LEVELS",
+ "FIX_SCOPES",
+ "FIX_TIERS",
+ "LEVEL_RANK",
+ "TIER_RANK",
+ "FixAction",
+ "FixConfidence",
+ "FixContext",
+ "FixEffortEstimate",
+ "FixFact",
+ "FixFirstQueue",
+ "FixGain",
+ "FixItem",
+ "FixNextCall",
+ "FixRankFact",
+ "FixRisk",
+ "FixSource",
+ "FixStep",
+ "FixTarget",
+ "FixTest",
+ "FixTotals",
+ "FixVerify",
+ "fix_id",
+]
diff --git a/packages/core/src/repowise/core/analysis/health/fix_first/text.py b/packages/core/src/repowise/core/analysis/health/fix_first/text.py
new file mode 100644
index 000000000..2948189b4
--- /dev/null
+++ b/packages/core/src/repowise/core/analysis/health/fix_first/text.py
@@ -0,0 +1,203 @@
+"""Plain-language copy for Fix-first items: titles, problems, gains.
+
+Biomarker ids and internal units (CCN, LCOM, deficit points) never reach a
+title, a why sentence or a gain; they may appear in ``facts``, which renderers
+label through their own glossary.
+"""
+
+from __future__ import annotations
+
+import posixpath
+
+TITLE_MAX = 90
+
+#: What the finding says about the code, completing "<subject> ...". The
+#: fallback when no measured fact is stored; each phrase must hold for every
+#: finding of its kind, so none claims coverage or callers it was not given.
+PROBLEM: dict[str, str] = {
+ "brain_method": "is long, branchy and widely depended on",
+ "complex_method": "has many independent paths through it",
+ "nested_complexity": "nests its control flow deeply",
+ "bumpy_road": "repeats nested blocks side by side, a sign it does several jobs",
+ "large_method": "is long",
+ "god_class": "holds too much of its subsystem in one class",
+ "low_cohesion": "holds groups of methods that share little state",
+ "complex_conditional": "packs several boolean operators into one condition",
+ "primitive_obsession": "takes a long list of parameters",
+ "dry_violation": "duplicates code, so a fix has to land in more than one place",
+ "error_handling": "handles an exception in a way that can hide a failure",
+ "coverage_gap": "has low measured test coverage",
+ "untested_hotspot": "changes often and has low measured test coverage",
+ "function_hotspot": "is complex and keeps changing",
+ "split_file": "holds several loosely related parts in one file",
+ "break_cycle": "sits in an import cycle",
+}
+
+#: Imperative title for a finding with no plan, given "<where>".
+FINDING_TITLE: dict[str, str] = {
+ "brain_method": "Split {where} into smaller functions",
+ "complex_method": "Reduce the branching in {where}",
+ "nested_complexity": "Flatten the nesting in {where}",
+ "bumpy_road": "Split {where} into stages",
+ "large_method": "Shorten {where}",
+ "god_class": "Break up the {where} class",
+ "low_cohesion": "Split {where} along its unrelated method groups",
+ "complex_conditional": "Simplify the condition in {where}",
+ "primitive_obsession": "Group the parameters of {where}",
+ "dry_violation": "Remove the duplicated code in {where}",
+ "error_handling": "Fix the exception handling in {where}",
+ "coverage_gap": "Add tests for {where}",
+ "untested_hotspot": "Add tests for {where}",
+ "function_hotspot": "Simplify {where}, which keeps changing",
+}
+
+#: Imperative title for a composed refactoring, by its lead step's type.
+REFACTOR_TITLE: dict[str, str] = {
+ "extract_method": "Extract a helper from {sym}",
+ "extract_method_span": "Extract lines {start}-{end} of {sym} into {name}",
+ "extract_helper": "Replace the duplicated code in {sym} with one shared helper",
+ "extract_class": "Extract a class from {sym}",
+ "split_file": "Split {file} into smaller modules",
+ "break_cycle": "Break the import cycle through {file}",
+ "move_method": "Move {sym} next to the code it uses",
+}
+
+BOUNDARY_NOUN = {
+ "db": "database",
+ "filesystem": "file system",
+ "network": "network",
+ "subprocess": "subprocess",
+}
+
+#: Performance causes whose cost is not a boundary call: (title, problem, gain).
+PERF_SHAPE: dict[str, tuple[str, str, str]] = {
+ "string_concat_in_loop": (
+ "Build the string in {name} with one join after the loop",
+ "{name} grows a string by concatenation inside a loop",
+ "one string copy per loop iteration",
+ ),
+ "membership_test_against_list_in_loop": (
+ "Use a set for the membership test in {name}",
+ "{name} searches a list once per loop iteration",
+ "one list scan per loop iteration",
+ ),
+ "unbounded_read_reduced_in_memory": (
+ "Let the query reduce the rows {name} reads",
+ "{name} reads every row and reduces them in memory",
+ "rows the database could have reduced, read on every call",
+ ),
+}
+
+FIX_STRATEGY: dict[str, str] = {
+ "batch_or_prefetch_io": "Batch the calls, or fetch the data once before the loop",
+ "replace_membership_collection": "Use a set or dict for the membership test",
+ "buffer_string_accumulation": "Collect the pieces in a list and join them once",
+ "push_reduction_into_query": "Let the query do the reduction",
+}
+
+
+def humanize(token: str) -> str:
+ return token.replace("_", " ")
+
+
+def plural(n: int, noun: str) -> str:
+ return f"{n:,} {noun}" if n == 1 else f"{n:,} {noun}s"
+
+
+def short_symbol(symbol: str | None) -> str | None:
+ """``path/to/x.py::Cls.method`` reads as ``Cls.method``."""
+ return symbol.rsplit("::", 1)[-1] if symbol else None
+
+
+def basename(path: str) -> str:
+ return posixpath.basename(path) or path
+
+
+def clip(text: str, limit: int = TITLE_MAX) -> str:
+ return text if len(text) <= limit else text[: limit - 3].rstrip() + "..."
+
+
+def problem(marker: str | None, subject: str) -> str:
+ phrase = PROBLEM.get(marker or "")
+ if phrase is None:
+ return f"{subject} has a {humanize(marker)} finding" if marker else f"{subject} needs work"
+ return f"{subject} {phrase}"
+
+
+def health_gain(value: float, *, ceiling: bool) -> str:
+ shown = "under +0.1" if value < 0.05 else f"+{value:.1f}"
+ return f"{'up to ' if ceiling else ''}{shown} health on this file"
+
+
+def measured(subject: str, shape: dict[str, int]) -> str | None:
+ """``walk_file: CCN 12, 60 lines, nests 4 deep`` from stored findings, or ``None``."""
+ if shape.get("lcom4") and shape.get("method_count"):
+ return (
+ f"{subject}: {plural(shape['method_count'], 'method')} in "
+ f"{shape['lcom4']} groups that share little state"
+ )
+ parts = []
+ if shape.get("ccn"):
+ parts.append(f"CCN {shape['ccn']}")
+ if shape.get("nloc"):
+ parts.append(plural(shape["nloc"], "line"))
+ if (shape.get("max_nesting") or 0) >= 3:
+ parts.append(f"nests {shape['max_nesting']} deep")
+ return f"{subject}: {', '.join(parts)}" if parts else None
+
+
+def size_brief(shape: dict[str, int]) -> str:
+ """``CCN 249, 1,280 lines``: the two numbers a title has room for."""
+ parts = []
+ if shape.get("ccn"):
+ parts.append(f"CCN {shape['ccn']}")
+ if shape.get("nloc"):
+ parts.append(plural(shape["nloc"], "line"))
+ if not parts and shape.get("max_nesting"):
+ parts.append(f"nests {shape['max_nesting']} deep")
+ return ", ".join(parts) or "large"
+
+
+def exposure(dependents: int | None, commits: int) -> str:
+ """``; 7 files import it, changed 15 times in 90 days``, or nothing."""
+ parts = []
+ if dependents:
+ parts.append(f"{plural(dependents, 'file')} import{'s' if dependents == 1 else ''} it")
+ if commits:
+ parts.append(f"changed {plural(commits, 'time')} in 90 days")
+ return "; " + ", ".join(parts) if parts else ""
+
+
+def signature(name: str | None, params: list[str], returns: list[str]) -> str:
+ """``compute_x(a, b) -> c``; a long parameter list is cut with its count."""
+ shown = ", ".join(params[:4]) + (f", +{len(params) - 4} more" if len(params) > 4 else "")
+ out = f"{name}({shown})" if name else "a helper" + (f" taking ({shown})" if params else "")
+ return out + (f" -> {', '.join(returns[:3])}" if returns else "")
+
+
+def first_sentence(text: str) -> str:
+ head, dot, _ = text.partition(". ")
+ return head + "." if dot else text
+
+
+__all__ = [
+ "BOUNDARY_NOUN",
+ "FINDING_TITLE",
+ "FIX_STRATEGY",
+ "PERF_SHAPE",
+ "PROBLEM",
+ "REFACTOR_TITLE",
+ "TITLE_MAX",
+ "basename",
+ "clip",
+ "exposure",
+ "first_sentence",
+ "health_gain",
+ "humanize",
+ "measured",
+ "plural",
+ "problem",
+ "short_symbol",
+ "signature",
+ "size_brief",
+]
diff --git a/packages/core/src/repowise/core/analysis/health/perf/causal.py b/packages/core/src/repowise/core/analysis/health/perf/causal.py
index 235f66520..caf733332 100644
--- a/packages/core/src/repowise/core/analysis/health/perf/causal.py
+++ b/packages/core/src/repowise/core/analysis/health/perf/causal.py
@@ -91,12 +91,11 @@ which is the one thing the fallback must not do.
"""
-def execution_context(file_path: str) -> ExecutionContext:
- """Where this code runs. An identity input, so it is classified once.
+def code_context(file_path: str) -> ExecutionContext:
+ """Whether this code ships, without :func:`execution_context`'s CLI rule.
- ``unknown`` is a positive answer, not a gap: a path with no directory, or
- one under a directory whose execution role is genuinely ambiguous, carries
- no evidence either way.
+ A CLI is product code an edit can improve, so code-shape surfaces read
+ this; only performance treats a CLI loop as off the request path.
"""
normalized = file_path.replace("\\", "/")
if not normalized:
@@ -105,7 +104,7 @@ def execution_context(file_path: str) -> ExecutionContext:
return "test"
segments = normalized.lower().split("/")
parts = set(segments)
- if parts & _TOOLING_PARTS or "/cli/" in f"/{normalized.lower()}/":
+ if parts & _TOOLING_PARTS:
return "tooling"
if any(pair in _TOOLING_DIR_PAIRS for pair in pairwise(segments[:-1])):
return "tooling"
@@ -114,6 +113,21 @@ def execution_context(file_path: str) -> ExecutionContext:
return "production"
+def execution_context(file_path: str) -> ExecutionContext:
+ """Where this code runs. An identity input, so it is classified once.
+
+ ``unknown`` is a positive answer, not a gap: a path with no directory, or
+ one under a directory whose execution role is genuinely ambiguous, carries
+ no evidence either way. A CLI loop is not a request path, so CLI code is
+ ``tooling`` here.
+ """
+ context = code_context(file_path)
+ normalized = file_path.replace("\\", "/").lower()
+ if context in ("production", "unknown") and "/cli/" in f"/{normalized}/":
+ return "tooling"
+ return context
+
+
def cost_shape(marker: str) -> str:
"""Compatibility family for observations that may share one intervention."""
if marker in {"io_in_loop", "nested_loop_with_io"}:
diff --git a/packages/core/src/repowise/core/analysis/health/rows.py b/packages/core/src/repowise/core/analysis/health/rows.py
index 3e7f28b4c..068bac932 100644
--- a/packages/core/src/repowise/core/analysis/health/rows.py
+++ b/packages/core/src/repowise/core/analysis/health/rows.py
@@ -14,6 +14,13 @@ from typing import Any
def field(row: Any, name: str, default: Any = None) -> Any:
"""Read one attribute from a dataclass, an ORM row, or a mapping."""
+ # Exact-type fast paths first: the ``Mapping`` check is an ABC lookup,
+ # and a fold over a repository's rows calls this a hundred thousand times.
+ kind = type(row)
+ if kind is dict:
+ return row.get(name, default)
+ if isinstance(row, tuple):
+ return getattr(row, name, default)
if isinstance(row, Mapping):
return row.get(name, default)
return getattr(row, name, default)
diff --git a/packages/core/src/repowise/core/analysis/health/scoring.py b/packages/core/src/repowise/core/analysis/health/scoring.py
index 13d2ba175..36edeafd5 100644
--- a/packages/core/src/repowise/core/analysis/health/scoring.py
+++ b/packages/core/src/repowise/core/analysis/health/scoring.py
@@ -554,6 +554,11 @@ def biomarker_category(name: str) -> str:
return _BIOMARKER_CATEGORY.get(name, "size_and_complexity")
+def history_biomarkers() -> frozenset[str]:
+ """Every biomarker in :data:`HISTORY_CATEGORY`, for a query that filters by name."""
+ return frozenset(n for n, c in _BIOMARKER_CATEGORY.items() if c == HISTORY_CATEGORY)
+
+
def dimensions_for(name: str) -> set[str]:
"""Dimensions a biomarker's deduction contributes to.
diff --git a/packages/core/src/repowise/core/generation/editor_files/data.py b/packages/core/src/repowise/core/generation/editor_files/data.py
index fbaf410d6..672fda15b 100644
--- a/packages/core/src/repowise/core/generation/editor_files/data.py
+++ b/packages/core/src/repowise/core/generation/editor_files/data.py
@@ -94,7 +94,9 @@ class CodeHealthBlock:
performance_coverage_pct: float | None = None
performance_skipped_files: int = 0
performance_unsupported_languages: list[tuple[str, int]] = field(default_factory=list)
- critical_biomarkers: list[dict] = field(default_factory=list)
+ # The lead of the shared Fix-first queue: ``title``, ``where``
+ # (``path:line``) and ``why`` per item, at most three.
+ fix_first: list[dict] = field(default_factory=list)
@dataclass(frozen=True)
diff --git a/packages/core/src/repowise/core/generation/editor_files/fetcher.py b/packages/core/src/repowise/core/generation/editor_files/fetcher.py
index d7b22199a..7144d06e0 100644
--- a/packages/core/src/repowise/core/generation/editor_files/fetcher.py
+++ b/packages/core/src/repowise/core/generation/editor_files/fetcher.py
@@ -25,6 +25,7 @@ from repowise.core.entry_candidacy import conventional_entry_stems
from repowise.core.generation.entry_points import rank_entry_points
from repowise.core.index_scope import load_index_scope, resolve_index_scope
from repowise.core.persistence import crud
+from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
from repowise.core.persistence.models import (
DecisionRecord,
GitMetadata,
@@ -50,6 +51,7 @@ _MAX_MODULES = 10
_MAX_ENTRY_POINTS = 10
_MAX_HOTSPOTS = 5
_MAX_DECISIONS = 8
+_MAX_FIX_FIRST = 3
def _signed_by(signature) -> str:
@@ -355,8 +357,8 @@ class EditorFileDataFetcher:
async def _get_code_health(self) -> CodeHealthBlock | None:
"""Build the compact code-health block for CLAUDE.md.
- Filters per plan §9: critical biomarkers in hotspot files, plus
- any Brain Method finding. Empty list when no health data yet.
+ KPIs, then the lead of the Fix-first queue every other surface renders.
+ ``None`` when no health data yet.
"""
metric_rows = list(
(
@@ -377,10 +379,9 @@ class EditorFileDataFetcher:
# zero-total-weight fallback to a plain mean. The empty case cannot
# reach it — ``metric_rows`` is checked above.
avg = nloc_weighted_score(metric_rows)
- # The worst file and the critical list name production files: a test
- # is not the file an agent should be told to handle with care.
+ # The worst file names a production file: a test is not the file an
+ # agent should be told to handle with care.
production, tests = split_tests(metric_rows)
- test_paths = {m.file_path for m in tests}
worst = min(production or tests, key=lambda m: m.score)
# Hotspot-flagged paths, and the hotspot KPI over them. Both come from
@@ -434,49 +435,24 @@ class EditorFileDataFetcher:
lang_by_path = await crud.get_file_language_map(self._session, self._repo_id)
perf_coverage = coverage_for_metrics(metric_rows, lang_by_path)
- # Critical biomarkers: brain methods, or critical-severity findings
- # in hotspot files. Cap at 5 to keep CLAUDE.md tight.
- f_res = await self._session.execute(
- select(HealthFinding)
- .where(
- HealthFinding.repository_id == self._repo_id,
- HealthFinding.status == "open",
- HealthFinding.biomarker_type.not_in(excluded_types()),
- )
- .order_by(HealthFinding.health_impact.desc())
- )
- all_findings = list(f_res.scalars().all())
-
# Open performance-finding count + density over covered LOC (the honest
# headline the diluted /10 hides).
- performance_findings = sum(
- 1 for f in all_findings if (f.dimension or "defect") == "performance"
- )
+ performance_findings = (
+ await self._session.execute(
+ select(func.count()).where(
+ HealthFinding.repository_id == self._repo_id,
+ HealthFinding.status == "open",
+ HealthFinding.dimension == "performance",
+ HealthFinding.biomarker_type.not_in(excluded_types()),
+ )
+ )
+ ).scalar_one()
performance_findings_density: float | None = None
if perf_coverage.covered_nloc > 0:
performance_findings_density = round(
10000.0 * performance_findings / perf_coverage.covered_nloc, 2
)
- critical = []
- for f in all_findings:
- if len(critical) >= 5:
- break
- if f.file_path in test_paths:
- continue
- if f.biomarker_type == "brain_method" or (
- f.severity == "critical" and f.file_path in hotspot_paths
- ):
- critical.append(
- {
- "path": f.file_path,
- "summary": (
- f"{f.biomarker_type.replace('_', ' ')}"
- + (f" ({f.function_name})" if f.function_name else "")
- + f" — impact −{f.health_impact:.1f}"
- ),
- }
- )
# The trend the snapshots record, or nothing: a repository indexed once
# has no trend, and the section used to print "stable" for it anyway.
@@ -504,9 +480,26 @@ class EditorFileDataFetcher:
),
performance_skipped_files=perf_coverage.skipped_files,
performance_unsupported_languages=perf_coverage.unsupported_languages,
- critical_biomarkers=critical,
+ fix_first=await self._get_fix_first(),
)
+ async def _get_fix_first(self) -> list[dict]:
+ """The queue's top items, or nothing on a store that cannot build it."""
+ try:
+ async with self._session.begin_nested():
+ queue = await load_fix_first(self._session, self._repo_id, limit=_MAX_FIX_FIRST)
+ except Exception: # an index from before the refactoring or perf tables
+ return []
+ return [
+ {
+ "title": item.title,
+ "where": item.target.file_path
+ + (f":{item.target.line_start}" if item.target.line_start else ""),
+ "why": item.why,
+ }
+ for item in queue.items
+ ]
+
async def _get_kg_data(
self,
) -> tuple[list[KGLayerSummary], list[KGTourStepSummary]]:
diff --git a/packages/core/src/repowise/core/generation/templates/agents_md.j2 b/packages/core/src/repowise/core/generation/templates/agents_md.j2
index 0768d3120..ed298e746 100644
--- a/packages/core/src/repowise/core/generation/templates/agents_md.j2
+++ b/packages/core/src/repowise/core/generation/templates/agents_md.j2
@@ -48,11 +48,11 @@ Machine-readable scope: `{{ data.index_scope | tojson }}`
### Code health
Three co-equal signals: code health {{ data.code_health.average_health }}/10 avg{% if data.code_health.band %} ({{ data.code_health.band }}){% endif %}, hotspot health {{ data.code_health.hotspot_health }}/10{% if data.code_health.hotspot_trend %} ({{ data.code_health.hotspot_trend }}){% endif %}, worst `{{ data.code_health.worst_path }}` at {{ data.code_health.worst_score }}/10{% if data.code_health.maintainability_average is not none %} · maintainability {{ data.code_health.maintainability_average }}/10{% endif %}{% if data.code_health.performance_average is not none %} · performance risk {{ data.code_health.performance_findings }} open static performance finding{{ 's' if data.code_health.performance_findings != 1 else '' }}{% endif %}. Detail: `get_health()`.
-{% if data.code_health.critical_biomarkers %}
+{% if data.code_health.fix_first %}
-Critical files:
-{% for b in data.code_health.critical_biomarkers %}
-- `{{ b.path }}` — {{ b.summary }}
+Fix first:
+{% for f in data.code_health.fix_first %}
+- {{ f.title }} (`{{ f.where }}`): {{ f.why }}
{% endfor %}
{% endif %}
{% endif %}
diff --git a/packages/core/src/repowise/core/generation/templates/claude_md.j2 b/packages/core/src/repowise/core/generation/templates/claude_md.j2
index ab826143c..35f17a13c 100644
--- a/packages/core/src/repowise/core/generation/templates/claude_md.j2
+++ b/packages/core/src/repowise/core/generation/templates/claude_md.j2
@@ -48,11 +48,11 @@ Machine-readable scope: `{{ data.index_scope | tojson }}`
### Code health
Three co-equal signals: code health {{ data.code_health.average_health }}/10 avg{% if data.code_health.band %} ({{ data.code_health.band }}){% endif %}, hotspot health {{ data.code_health.hotspot_health }}/10{% if data.code_health.hotspot_trend %} ({{ data.code_health.hotspot_trend }}){% endif %}, worst `{{ data.code_health.worst_path }}` at {{ data.code_health.worst_score }}/10{% if data.code_health.maintainability_average is not none %} · maintainability {{ data.code_health.maintainability_average }}/10{% endif %}{% if data.code_health.performance_average is not none %} · performance risk {{ data.code_health.performance_findings }} open static performance finding{{ 's' if data.code_health.performance_findings != 1 else '' }}{% endif %}. Detail: `get_health()`.
-{% if data.code_health.critical_biomarkers %}
+{% if data.code_health.fix_first %}
-Critical files:
-{% for b in data.code_health.critical_biomarkers %}
-- `{{ b.path }}` — {{ b.summary }}
+Fix first:
+{% for f in data.code_health.fix_first %}
+- {{ f.title }} (`{{ f.where }}`): {{ f.why }}
{% endfor %}
{% endif %}
{% endif %}
diff --git a/packages/core/src/repowise/core/persistence/crud/analysis/actions.py b/packages/core/src/repowise/core/persistence/crud/analysis/actions.py
index 407aa2cc2..f90394ec7 100644
--- a/packages/core/src/repowise/core/persistence/crud/analysis/actions.py
+++ b/packages/core/src/repowise/core/persistence/crud/analysis/actions.py
@@ -30,13 +30,13 @@ from repowise.core.analysis.actions.build import (
build_decisions,
build_drift,
build_files,
- build_perf,
build_recent,
build_secrets,
lead_paths,
with_leads,
)
from repowise.core.analysis.actions.facts import FileFacts
+from repowise.core.analysis.actions.rules.code import FIX_FIRST_ACTIONS
from repowise.core.analysis.actions.rules.hygiene import PUBLIC_ENV_KIND, SECRET_KINDS
from repowise.core.analysis.dead_code.risk_factors import REVIEW_ONLY_KINDS
from repowise.core.analysis.finding_registry import excluded_types
@@ -55,9 +55,9 @@ from ...models import (
GraphMetric,
HealthFileMetric,
HealthFinding,
- PerformanceOpportunity,
SecurityFinding,
)
+from .fix_first import load_fix_first
logger = logging.getLogger(__name__)
@@ -218,22 +218,8 @@ async def _recent(
return build_recent(rows, week=since, open_findings=open_findings, files=files)
-async def _perf(session: AsyncSession, repo_id: str) -> dict[str, Any]:
- rows = (
- (
- await session.execute(
- select(PerformanceOpportunity).where(
- PerformanceOpportunity.repository_id == repo_id,
- PerformanceOpportunity.status == "open",
- PerformanceOpportunity.execution_context == "production",
- PerformanceOpportunity.actionability_state.in_(("plan_ready", "advisory")),
- )
- )
- )
- .scalars()
- .all()
- )
- return build_perf(rows)
+async def _fix_first(session: AsyncSession, repo_id: str) -> dict[str, Any]:
+ return {"fix_first": (await load_fix_first(session, repo_id, limit=FIX_FIRST_ACTIONS)).items}
async def _secrets(session: AsyncSession, repo_id: str, files: dict[str, FileFacts]) -> dict:
@@ -401,7 +387,7 @@ async def load_repo_facts(session: AsyncSession, repo_id: str) -> RepoFacts:
files: dict[str, FileFacts] = values.get("files") or {}
await read("authors", lambda: _authors(session, repo_id, since))
await read("commit_health", lambda: _recent(session, repo_id, week, files))
- await read("performance", lambda: _perf(session, repo_id))
+ await read("fix_first", lambda: _fix_first(session, repo_id))
await read("security", lambda: _secrets(session, repo_id, files))
await read("doc_drift", lambda: _drift(session, repo_id))
await read("dead_code", lambda: _dead(session, repo_id, files))
diff --git a/packages/core/src/repowise/core/persistence/crud/analysis/fix_first.py b/packages/core/src/repowise/core/persistence/crud/analysis/fix_first.py
new file mode 100644
index 000000000..d033548eb
--- /dev/null
+++ b/packages/core/src/repowise/core/persistence/crud/analysis/fix_first.py
@@ -0,0 +1,422 @@
+"""Read the stores into the Fix-first queue.
+
+The reads here only narrow; the row-to-item rule is the pure builder in
+``repowise.core.analysis.health.fix_first.build``. Findings are read only for
+files that can become an item or a counted exclusion: the files of worthwhile
+opportunities and ready performance fixes, the files carrying the most
+code-shape deduction, and the history-only files. Explanatory JSON is read
+only for rows that can become an item, so the payload stays proportional to
+the queue, not the repository.
+
+Ceiling: plain finding items come only from the :data:`FINDING_FILES` files
+with the most open code-shape deduction, so a file below that line never
+becomes a finding item (a file with a plan or a performance fix still does).
+Upgrade path: materialize each file's lead finding and its size at index
+time, as refactoring and performance already are, and rank them in SQL.
+
+The built queue is cached in process, keyed by the repository and the
+newest write to each store it reads, so repeated calls between updates cost
+one aggregate read.
+"""
+
+from __future__ import annotations
+
+from collections import OrderedDict, namedtuple
+from typing import Any
+
+from sqlalchemy import and_, case, func, or_, select
+from sqlalchemy.ext.asyncio import AsyncSession
+
+from repowise.core.analysis.finding_registry import excluded_types
+from repowise.core.analysis.health.fix_first import DEFAULT_LIMIT, FixFirstQueue, build_fix_first
+from repowise.core.analysis.health.fix_first.build import MIN_WORTH, hot_cut, hot_cut_offset
+from repowise.core.analysis.health.rows import detail_map
+from repowise.core.analysis.health.scoring import history_biomarkers
+
+from ...models import (
+ GitMetadata,
+ GraphMetric,
+ HealthFileMetric,
+ HealthFinding,
+ PerformanceOpportunity,
+ RefactoringOpportunity,
+ RefactoringSuggestion,
+)
+
+#: Files read for plan-less finding items, by open code-shape deduction.
+#: Ceiling: a file past this rank never becomes a finding item. The queue
+#: shows ten, and finding items rank below plans of the same value.
+FINDING_FILES = 100
+
+
+def _plain(result: Any) -> list[Any]:
+ """Rows as named tuples: the builder reads each field many times, and a
+ tuple attribute is several times cheaper than a SQL row's."""
+ rows = result.all()
+ if not rows:
+ return []
+ shape = namedtuple("Row", rows[0]._fields) # type: ignore[misc]
+ return [shape(*r) for r in rows]
+
+
+async def _metrics(session: AsyncSession, repo_id: str, paths: set[str]) -> list[Any]:
+ if not paths:
+ return []
+ return _plain(
+ await session.execute(
+ select(
+ HealthFileMetric.file_path,
+ HealthFileMetric.nloc,
+ HealthFileMetric.is_test,
+ GitMetadata.commit_count_90d,
+ GraphMetric.in_degree.label("dependents"),
+ )
+ .outerjoin(
+ GitMetadata,
+ (GitMetadata.repository_id == HealthFileMetric.repository_id)
+ & (GitMetadata.file_path == HealthFileMetric.file_path),
+ )
+ .outerjoin(
+ GraphMetric,
+ (GraphMetric.repository_id == HealthFileMetric.repository_id)
+ & (GraphMetric.node_id == HealthFileMetric.file_path),
+ )
+ .where(
+ HealthFileMetric.repository_id == repo_id, HealthFileMetric.file_path.in_(paths)
+ )
+ )
+ )
+
+
+async def _hot_cuts(session: AsyncSession, repo_id: str) -> tuple[float, float]:
+ """The builder's hot-file thresholds over every production file.
+
+ Two integer columns per file, so the whole population costs one narrow read
+ while the builder sees full rows for the candidates only.
+ """
+ m = HealthFileMetric
+ rows = (
+ await session.execute(
+ select(
+ func.coalesce(GitMetadata.commit_count_90d, 0),
+ func.coalesce(GraphMetric.in_degree, 0),
+ )
+ .select_from(m)
+ .outerjoin(
+ GitMetadata,
+ (GitMetadata.repository_id == m.repository_id)
+ & (GitMetadata.file_path == m.file_path),
+ )
+ .outerjoin(
+ GraphMetric,
+ (GraphMetric.repository_id == m.repository_id) & (GraphMetric.node_id == m.file_path),
+ )
+ .where(m.repository_id == repo_id, or_(m.is_test.is_(None), m.is_test.is_(False)))
+ )
+ ).all()
+ if not rows:
+ return hot_cut(None), hot_cut(None)
+ at = hot_cut_offset(len(rows))
+ churn, deps = (sorted(column) for column in zip(*rows, strict=True))
+ return hot_cut(churn[at]), hot_cut(deps[at])
+
+
+async def _basis(session: AsyncSession, repo_id: str) -> dict[str, str | None]:
+ row = (
+ await session.execute(
+ select(HealthFileMetric.updated_at, HealthFileMetric.analyzed_commit)
+ .where(
+ HealthFileMetric.repository_id == repo_id,
+ HealthFileMetric.updated_at.is_not(None),
+ )
+ .order_by(HealthFileMetric.updated_at.desc())
+ .limit(1)
+ )
+ ).first()
+ if row is None:
+ return {"analyzed_commit": None, "health_analyzed_at": None}
+ return {"analyzed_commit": row.analyzed_commit, "health_analyzed_at": row.updated_at.isoformat()}
+
+
+def _eligible_findings(repo_id: str) -> Any:
+ """Open, scoring, code-health findings a surface may show."""
+ f = HealthFinding
+ return and_(
+ f.repository_id == repo_id,
+ f.status == "open",
+ f.health_impact > 0,
+ or_(f.dimension.is_(None), f.dimension != "performance"),
+ f.biomarker_type.not_in(excluded_types()),
+ )
+
+
+#: One stand-in row per history-only file: the builder reads from it only
+#: that the file's findings are all history, which is what it counts.
+_HistoryOnly = namedtuple("_HistoryOnly", "file_path biomarker_type health_impact dimension")
+
+
+async def _finding_files(session: AsyncSession, repo_id: str) -> tuple[set[str], list[Any]]:
+ """The heaviest code-shape files, and one row for each history-only file."""
+ f = HealthFinding
+ shaped_impact = func.sum(
+ case((f.biomarker_type.in_(history_biomarkers()), 0.0), else_=f.health_impact)
+ )
+ rows = (
+ await session.execute(
+ select(
+ f.file_path,
+ shaped_impact.label("shaped"),
+ func.max(f.biomarker_type).label("marker"),
+ func.max(f.health_impact).label("impact"),
+ )
+ .where(_eligible_findings(repo_id))
+ .group_by(f.file_path)
+ )
+ ).all()
+ heaviest = sorted((r for r in rows if r.shaped > 0), key=lambda r: (-r.shaped, r.file_path))
+ history_only = [
+ _HistoryOnly(r.file_path, r.marker, r.impact, "defect") for r in rows if not r.shaped
+ ]
+ return {r.file_path for r in heaviest[:FINDING_FILES]}, history_only
+
+
+async def _findings(
+ session: AsyncSession, repo_id: str, full: set[str], planned: set[str], functions: set[str]
+) -> list[Any]:
+ """Every eligible finding in ``full``; in ``planned`` only what an item quotes.
+
+ A file with a plan that becomes an item needs its history markers (the
+ item's context) and the findings on the function the plan changes (its
+ numbers); its other findings never lead, because the plan speaks for it.
+ """
+ if not full and not planned:
+ return []
+ f = HealthFinding
+ history = history_biomarkers()
+ return _plain(
+ await session.execute(
+ select(
+ f.file_path,
+ f.biomarker_type,
+ f.severity,
+ f.function_name,
+ f.line_start,
+ f.line_end,
+ f.reason,
+ f.health_impact,
+ f.public_id,
+ f.dimension,
+ f.status,
+ # Only a code-shape finding's numbers are quoted.
+ case((f.biomarker_type.in_(history), None), else_=f.details_json).label(
+ "details_json"
+ ),
+ ).where(
+ _eligible_findings(repo_id),
+ or_(
+ f.file_path.in_(full),
+ and_(
+ f.file_path.in_(planned - full),
+ or_(f.biomarker_type.in_(history), f.function_name.in_(functions)),
+ ),
+ ),
+ )
+ )
+ )
+
+
+async def _refactoring(session: AsyncSession, repo_id: str) -> list[Any]:
+ o = RefactoringOpportunity
+ return _plain(
+ await session.execute(
+ select(
+ o.opportunity_id,
+ o.rank_position,
+ o.rank_score,
+ o.file_path,
+ o.lead_biomarker,
+ o.lead_refactoring_type,
+ o.effort_bucket,
+ o.confidence,
+ o.affected_files_total,
+ o.recoverable_health,
+ o.status,
+ case((o.recoverable_health >= MIN_WORTH, o.details_json)).label("details_json"),
+ )
+ .where(o.repository_id == repo_id, o.status == "open")
+ .order_by(o.rank_position)
+ )
+ )
+
+
+async def _performance(session: AsyncSession, repo_id: str) -> list[Any]:
+ p = PerformanceOpportunity
+ ready = and_(
+ p.actionability_state != "expected",
+ p.plan_state == "available",
+ p.fix_strategy.is_not(None),
+ )
+ return _plain(
+ await session.execute(
+ select(
+ p.opportunity_id,
+ p.rank_position,
+ p.rank_score,
+ p.execution_context,
+ p.boundary_kind,
+ p.biomarker_type,
+ p.actionability_state,
+ p.plan_state,
+ p.fix_strategy,
+ p.fix_safety,
+ p.file_path,
+ p.intervention_symbol,
+ p.terminal_sink,
+ p.affected_call_sites_total,
+ p.affected_files_total,
+ p.status,
+ case((ready, p.details_json)).label("details_json"),
+ )
+ .where(p.repository_id == repo_id, p.status == "open")
+ .order_by(p.rank_position)
+ )
+ )
+
+
+def _decoded(rows: list[Any]) -> list[Any]:
+ """``details_json`` decoded once into ``details``, which the builder reads first."""
+ if not rows:
+ return rows
+ fields = [("details" if f == "details_json" else f) for f in rows[0]._fields]
+ shape = namedtuple("Row", fields) # type: ignore[misc]
+ out = []
+ for r in rows:
+ values = list(r)
+ at = fields.index("details")
+ values[at] = detail_map(r) if r.details_json else None
+ out.append(shape(*values))
+ return out
+
+
+def _steps(refactoring: list[Any]) -> list[dict[str, Any]]:
+ """Every step of the opportunities that can become an item."""
+ return [s for r in refactoring if r.details for s in r.details.get("steps") or []]
+
+
+async def _plans(session: AsyncSession, repo_id: str, steps: list[dict[str, Any]]) -> list[Any]:
+ """The plans those steps name: span, signature, evidence."""
+ ids = {s.get("plan_id") for s in steps if s.get("plan_id")}
+ if not ids:
+ return []
+ return _plain(
+ await session.execute(
+ select(
+ RefactoringSuggestion.public_id,
+ RefactoringSuggestion.evidence_json,
+ RefactoringSuggestion.plan_json,
+ ).where(
+ RefactoringSuggestion.repository_id == repo_id,
+ RefactoringSuggestion.public_id.in_(ids),
+ )
+ )
+ )
+
+
+#: Built queues kept in process. A handful covers the shapes one surface asks
+#: for (dashboard, CLI, Do next, one id), per repository a server holds.
+CACHE_SIZE = 32
+_cache: OrderedDict[tuple[Any, ...], FixFirstQueue] = OrderedDict()
+
+
+async def _stamp(session: AsyncSession, repo_id: str) -> tuple[Any, ...]:
+ """The newest write and the row count of every store the queue reads.
+
+ A rewrite, a triage change (``updated_at`` moves) or a deletion (the
+ count moves) changes it; git and graph rows are rewritten with the
+ health rows that read them.
+ """
+ stamps: list[Any] = []
+ for model in (HealthFileMetric, HealthFinding, RefactoringOpportunity, PerformanceOpportunity):
+ stamps.extend(
+ (
+ await session.execute(
+ select(func.max(model.updated_at), func.count()).where(
+ model.repository_id == repo_id
+ )
+ )
+ ).one()
+ )
+ return tuple(stamps)
+
+
+def clear_fix_first_cache() -> None:
+ _cache.clear()
+
+
+async def load_fix_first(
+ session: AsyncSession,
+ repository_id: str,
+ *,
+ limit: int | None = DEFAULT_LIMIT,
+ scope: str = "production",
+ item_id: str | None = None,
+) -> FixFirstQueue:
+ """The Fix-first queue for one repository, from its stored analysis.
+
+ ``item_id`` keeps only that item, at its rank, for a lookup by id.
+ """
+ key = (
+ str(session.bind.url) if session.bind is not None else None,
+ repository_id,
+ limit,
+ scope,
+ item_id,
+ await _stamp(session, repository_id),
+ )
+ cached = _cache.get(key)
+ if cached is not None:
+ _cache.move_to_end(key)
+ return cached
+ queue = await _build(session, repository_id, limit=limit, scope=scope, item_id=item_id)
+ _cache[key] = queue
+ while len(_cache) > CACHE_SIZE:
+ _cache.popitem(last=False)
+ return queue
+
+
+async def _build(
+ session: AsyncSession,
+ repository_id: str,
+ *,
+ limit: int | None,
+ scope: str,
+ item_id: str | None,
+) -> FixFirstQueue:
+ refactoring = _decoded(await _refactoring(session, repository_id))
+ performance = _decoded(await _performance(session, repository_id))
+ steps = _steps(refactoring)
+ heavy, history_only = await _finding_files(session, repository_id)
+ # Ceiling: a plan whose details carry no steps is not an item, so its
+ # file is read in full like any other.
+ planned = {r.file_path for r in refactoring if r.details and r.details.get("steps")}
+ full = heavy | {p.file_path for p in performance if p.details} | (
+ {r.file_path for r in refactoring if r.details} - planned
+ )
+ functions = {s["target_symbol"] for s in steps if s.get("target_symbol")}
+ findings = await _findings(session, repository_id, full, planned, functions)
+ paths = full | planned | {r.file_path for r in history_only}
+ return build_fix_first(
+ metrics=await _metrics(session, repository_id, paths),
+ findings=[*findings, *(r for r in history_only if r.file_path not in full | planned)],
+ refactoring=refactoring,
+ performance=performance,
+ plans=await _plans(session, repository_id, steps),
+ limit=limit,
+ scope=scope,
+ item_id=item_id,
+ basis=await _basis(session, repository_id),
+ hot_cuts=await _hot_cuts(session, repository_id),
+ )
+
+
+__all__ = ["CACHE_SIZE", "FINDING_FILES", "clear_fix_first_cache", "load_fix_first"]
diff --git a/packages/server/src/repowise/server/mcp_server/_budget/contracts.py b/packages/server/src/repowise/server/mcp_server/_budget/contracts.py
index 4ddfd9ac1..b6b9e62cd 100644
--- a/packages/server/src/repowise/server/mcp_server/_budget/contracts.py
+++ b/packages/server/src/repowise/server/mcp_server/_budget/contracts.py
@@ -318,12 +318,10 @@ _CONTRACTS: dict[str, ResponseBudgetContract] = {
),
protected=(
"mode",
- "directive",
- # Both pillar leads are bounded by construction and are the only
- # actionable content a bare dashboard carries for them, so shedding
- # one would leave that pillar with counts and nothing to do.
- "performance_directive",
- "refactoring_directive",
+ # The one lead, bounded by construction (at most five compact
+ # items): shedding it would leave the dashboard with nothing to do.
+ "fix_first",
+ "fix_id",
"opportunity_id",
"model_state",
"targets",
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/analysis_meta.py b/packages/server/src/repowise/server/mcp_server/tool_health/analysis_meta.py
index 20c715ae9..a8545c789 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/analysis_meta.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/analysis_meta.py
@@ -6,7 +6,6 @@ from typing import Any
from sqlalchemy import func, select
-from repowise.core.analysis.health.semantics import health_semantics_contract
from repowise.core.persistence.models import HealthFileMetric
@@ -71,7 +70,6 @@ def _write_health_analysis_meta(
distinct_commits: int,
) -> None:
"""The one place the analysis-freshness block is shaped."""
- meta["health_semantics"] = health_semantics_contract()
metrics = has_metrics
analyzed = latest_at is not None
commits_count = distinct_commits
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/blocks.py b/packages/server/src/repowise/server/mcp_server/tool_health/blocks.py
index 7ba453fc2..4f1cab351 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/blocks.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/blocks.py
@@ -20,7 +20,6 @@ from repowise.server.mcp_server.tool_health.coverage import _coverage_block
from repowise.server.mcp_server.tool_health.loading import HealthData
from repowise.server.mcp_server.tool_health.paging import Pager
from repowise.server.mcp_server.tool_health.pillars import (
- _recommendation_lede,
_render_performance,
_render_refactoring,
)
@@ -41,10 +40,6 @@ def add_optional_blocks(
result["trend"] = _trend_block(data, req, pager)
_render_refactoring(result, data.refactoring, req, pager)
_render_performance(result, data.performance, req, pager)
- if req.wants_lede:
- result["recommendation_lede"] = _recommendation_lede(
- data.performance, data.refactoring_recommendations, data.reference_repository, req
- )
if "coverage" in include:
result["coverage"] = _coverage_block(
data.coverage_rows,
@@ -164,8 +159,7 @@ def _suggestion_legend(data: HealthData) -> dict[str, str]:
change what a surviving key contains.
The legend explains the findings, not ``refactoring_plans``, so an entry can
- describe a biomarker no plan addresses. ``directive.plan_addresses_reason``
- reports that mismatch.
+ describe a biomarker no plan addresses.
"""
present_types = {getattr(r, "biomarker_type", None) for r in data.findings.legend_rows}
return {bt: suggestion_for(bt) for bt in sorted(t for t in present_types if t)}
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/dashboard.py b/packages/server/src/repowise/server/mcp_server/tool_health/dashboard.py
index b6cd7796c..348809ad5 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/dashboard.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/dashboard.py
@@ -12,11 +12,7 @@ from repowise.server.mcp_server.tool_health.loading import HealthData
from repowise.server.mcp_server.tool_health.paging import Pager
from repowise.server.mcp_server.tool_health.request import HealthRequest
from repowise.server.mcp_server.tool_health.serialize import _serialize_finding, _serialize_metric
-from repowise.server.mcp_server.tool_health.summary import (
- _compute_kpis,
- _directive,
- _gap_analysis,
-)
+from repowise.server.mcp_server.tool_health.summary import _compute_kpis, _gap_analysis
from repowise.server.mcp_server.tool_health.targeted import ModeTotals
@@ -43,26 +39,8 @@ def build_dashboard(
coverage=data.perf_coverage,
)
result: dict[str, Any] = {
- # Lead with the recommendation; every block below ranks and describes.
- "directive": _directive(
- data.by_leverage,
- data.leads,
- gap.get("weighted_gross_gap_points") or 0,
- data.plan_biomarkers_by_path,
- data.plan_count_by_path,
- ),
- # Additive leads for the refactoring and performance pillars, which
- # the deficit-ranked directive above cannot express.
- **(
- {"refactoring_directive": data.refactoring.directive}
- if data.refactoring.directive is not None
- else {}
- ),
- **(
- {"performance_directive": data.performance.directive}
- if data.performance.directive is not None
- else {}
- ),
+ # The one lead; every block below ranks and describes.
+ **({"fix_first": _fix_first_block(data)} if data.fix_first is not None else {}),
"mode": "dashboard",
"scope": pop.reported_scope,
"counts": pop.reported_counts,
@@ -112,6 +90,15 @@ def build_dashboard(
return result, ModeTotals(metrics=None, trends=None, modules=len(all_modules))
+def _fix_first_block(data: HealthData) -> dict[str, Any]:
+ """Core's queue in the compact projection, with the call for one full item."""
+ queue = data.fix_first
+ block = queue.as_dict(compact=True)
+ if queue.lead is not None:
+ block["detail_call"] = f"get_health(fix_id={queue.lead.id!r})"
+ return block
+
+
def _metric_row(data: HealthData, m: Any) -> dict[str, Any]:
return _serialize_metric(m, data.leads.get(m.file_path), is_test=m.file_path in data.test_paths)
@@ -119,8 +106,7 @@ def _metric_row(data: HealthData, m: Any) -> dict[str, Any]:
def _high_leverage_rows(data: HealthData, gap: dict[str, Any]) -> list[dict[str, Any]]:
"""The leverage ranking, each row with its share of the repository's gap.
- The one place ``weighted_deficit`` gets a denominator, in the unit
- ``directive`` speaks. The denominator is the gross deficit of below-target
+ The one place ``weighted_deficit`` gets a denominator. The denominator is the gross deficit of below-target
files, so shares stay within 100%; the net gap would let above-target files
shrink it and push one large file past 100% (issue #1437).
"""
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/details.py b/packages/server/src/repowise/server/mcp_server/tool_health/details.py
index 58e405b31..cc6b67bc5 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/details.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/details.py
@@ -9,6 +9,7 @@ from sqlalchemy import select
from repowise.core.analysis.health.counts import DEFAULT_COUNTS
from repowise.core.analysis.health.scope import DEFAULT_SCOPE
from repowise.core.persistence.crud import get_health_finding_by_public_id
+from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
from repowise.core.persistence.models import HealthFinding
from repowise.server.mcp_server._meta import build_meta as _build_meta
from repowise.server.mcp_server.tool_health.analysis_meta import _attach_repository_analysis_meta
@@ -39,6 +40,7 @@ async def _detail_response(
finding_id: str | None,
plan_id: str | None,
opportunity_id: str | None,
+ fix_id: str | None = None,
only_set: set[str],
limit: int,
cursor: int,
@@ -48,6 +50,8 @@ async def _detail_response(
At most one selector is set by the time this runs: ``_selector_conflict``
refuses two before any read.
"""
+ if fix_id:
+ return await _fix_detail_response(session, repository, fix_id)
if finding_id:
return await _finding_detail_response(
session, repository, reference_repository, finding_id
@@ -97,6 +101,24 @@ async def _finding_detail_response(
return result
+async def _fix_detail_response(session: Any, repository: Any, fix_id: str) -> dict[str, Any]:
+ """One Fix-first item in full: action steps, verify, risk, context."""
+ item = (await load_fix_first(session, repository.id, item_id=fix_id)).find(fix_id)
+ result = {
+ "mode": "fix_item",
+ "fix_id": fix_id,
+ "item": item.as_dict() if item else None,
+ "found": item is not None,
+ "_meta": _build_meta(
+ repository=repository, targets=[item.target.file_path] if item else None
+ ),
+ }
+ if item is None:
+ result["next_action"] = "get_health() lists the current fix_first ids"
+ await _attach_repository_analysis_meta(session, repository, result["_meta"])
+ return result
+
+
async def _plan_detail_response(
session: Any, repository: Any, reference_repository: str, plan_id: str
) -> dict[str, Any]:
@@ -145,7 +167,7 @@ def _selector_conflict(**selectors: str | None) -> dict[str, Any] | None:
"resolved": False,
"reason": "mutually_exclusive_selectors",
"selectors": named,
- "detail": "Pass exactly one of finding_id, plan_id, opportunity_id.",
+ "detail": "Pass exactly one of fix_id, finding_id, plan_id, opportunity_id.",
}
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/loading.py b/packages/server/src/repowise/server/mcp_server/tool_health/loading.py
index 252285366..9cc8a7363 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/loading.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/loading.py
@@ -11,11 +11,11 @@ from __future__ import annotations
from dataclasses import asdict, dataclass, field
from typing import Any
-from sqlalchemy import select
from sqlalchemy.exc import SQLAlchemyError
from repowise.core.analysis.doc_drift.constants import UNAVAILABLE_NO_TABLE
from repowise.core.analysis.health.churn_complexity import churn_complexity_points
+from repowise.core.analysis.health.fix_first import FixFirstQueue
from repowise.core.analysis.health.grading import TARGET_SCORE
from repowise.core.analysis.health.perf.coverage import PerfCoverage, coverage_for_metrics
from repowise.core.analysis.health.ranking import deduction_by_path, sort_metrics_worst_first
@@ -40,7 +40,8 @@ from repowise.core.persistence.crud import (
load_coverage_for_repo,
load_coverage_history,
)
-from repowise.core.persistence.models import HealthFileMetric, RefactoringSuggestion
+from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
+from repowise.core.persistence.models import HealthFileMetric
from repowise.server.mcp_server._helpers import filter_rows_by_attr
from repowise.server.mcp_server.tool_health.findings import (
FindingSets,
@@ -56,10 +57,14 @@ from repowise.server.mcp_server.tool_health.pillars import (
)
from repowise.server.mcp_server.tool_health.population import Population, load_population
from repowise.server.mcp_server.tool_health.request import HealthRequest
-from repowise.server.mcp_server.tool_health.summary import _DIRECTIVE_CANDIDATES, _leads_by_file
+from repowise.server.mcp_server.tool_health.summary import _leads_by_file
from repowise.server.services.performance_health import PerformanceHealthService
from repowise.server.services.refactoring_health import RefactoringHealthService, plan_view
+FIX_FIRST_CAP = 5
+"""Items in the dashboard's ``fix_first`` block, however large ``limit`` is.
+The rest are one ``get_health(fix_id=...)`` or REST page away."""
+
@dataclass
class HealthData:
@@ -90,8 +95,7 @@ class HealthData:
drift_unavailable: str | None = None
churn_points: list[dict[str, Any]] = field(default_factory=list)
snapshots: list[Any] = field(default_factory=list)
- plan_biomarkers_by_path: dict[str, set[str]] = field(default_factory=dict)
- plan_count_by_path: dict[str, int] = field(default_factory=dict)
+ fix_first: FixFirstQueue | None = None
# Dashboard only: the worst-first test files, ranked apart from
# ``metric_rows`` so a test never heads the production worklist.
test_metric_rows: list[HealthFileMetric] = field(default_factory=list)
@@ -162,9 +166,7 @@ async def load_health_data(
data.by_leverage, data.leads = _rank_leverage_and_leads(
pop, metric_rows, findings, req, data.test_metric_rows
)
- data.plan_biomarkers_by_path, data.plan_count_by_path = await _read_directive_plans(
- session, repository, pop, req, data.by_leverage
- )
+ data.fix_first = await _read_fix_first(session, repository, pop, req)
return data
@@ -269,7 +271,6 @@ async def _read_pillars(
wants=req.wants,
included="performance" in req.include_set and req.wants_performance_opportunities,
file_paths=pop.target_paths,
- scoped=pop.scoped,
limit=req.limit,
cursor=req.cursor,
view=req.performance_view,
@@ -401,9 +402,6 @@ def _rank_leverage_and_leads(
Targeted mode reduces the whole (small) scoped set. Dashboard mode reduces
only the rows of files it prints: identical output at a fraction of the cost.
-
- Computed inside the session because the directive's plan lookup needs
- ``by_leverage``.
"""
if pop.scoped:
return [], _leads_by_file(findings.lead_rows)
@@ -417,48 +415,17 @@ def _rank_leverage_and_leads(
printed = {m.file_path for m in metric_rows[: req.limit]}
printed |= {m.file_path for m in test_metric_rows[: req.limit]}
printed |= {m.file_path for m in by_leverage[: req.limit]}
- # The directive's candidates, unconditionally: its leads must not depend
- # on ``limit``, or ``limit=0`` would make it assert wrong claims.
- printed |= {m.file_path for m in by_leverage[:_DIRECTIVE_CANDIDATES]}
return by_leverage, _leads_by_file([r for r in findings.lead_rows if r.file_path in printed])
-async def _read_directive_plans(
- session: Any,
- repository: Any,
- pop: Population,
- req: HealthRequest,
- by_leverage: list[HealthFileMetric],
-) -> tuple[dict[str, set[str]], dict[str, int]]:
- """Which biomarkers the stored plans for the directive's candidates actually address.
-
- The directive points at ``include=['refactoring']`` for the fix, but some
- biomarkers have no plan kind, so it must know whether a plan addresses the
- cause it names. Read for the directive's candidates only, two columns, and
- only when the directive survives the projection. ``status == "open"``
- mirrors ``get_refactoring_suggestions``; candidates are already
- exclude-filtered.
+async def _read_fix_first(
+ session: Any, repository: Any, pop: Population, req: HealthRequest
+) -> FixFirstQueue | None:
+ """The dashboard's one lead: the Fix-first queue core builds from stored rows.
+
+ Always the production population, whatever ``scope`` says: a test file is
+ never the first thing to fix.
"""
- plan_biomarkers_by_path: dict[str, set[str]] = {}
- plan_count_by_path: dict[str, int] = {}
- if pop.scoped or not req.wants("directive") or not by_leverage:
- return plan_biomarkers_by_path, plan_count_by_path
- directive_paths = [m.file_path for m in by_leverage[:_DIRECTIVE_CANDIDATES]]
- for path, source in (
- await session.execute(
- select(
- RefactoringSuggestion.file_path,
- RefactoringSuggestion.source_biomarker,
- ).where(
- RefactoringSuggestion.repository_id == repository.id,
- RefactoringSuggestion.status == "open",
- RefactoringSuggestion.file_path.in_(directive_paths),
- )
- )
- ).all():
- # Counted apart from attribution: ``split_file`` and ``break_cycle``
- # plans store an empty ``source_biomarker``.
- plan_count_by_path[path] = plan_count_by_path.get(path, 0) + 1
- if source:
- plan_biomarkers_by_path.setdefault(path, set()).add(source)
- return plan_biomarkers_by_path, plan_count_by_path
+ if pop.scoped or not req.wants("fix_first"):
+ return None
+ return await load_fix_first(session, repository.id, limit=min(req.limit, FIX_FIRST_CAP))
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/pillars.py b/packages/server/src/repowise/server/mcp_server/tool_health/pillars.py
index e8a0a56fd..18ba0d388 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/pillars.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/pillars.py
@@ -1,15 +1,12 @@
-"""Performance and refactoring pillar blocks for get_health: the queue, rollup and lead."""
+"""Performance and refactoring pillar blocks for get_health: the queue and its rollup."""
from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
-from repowise.core.analysis.health.perf.opportunity_rank import NON_LEADING_MARKERS
-from repowise.core.analysis.health.refactoring.recommendations import Recommendation
from repowise.server.mcp_server.tool_health.paging import Pager
from repowise.server.mcp_server.tool_health.request import HealthRequest
-from repowise.server.mcp_server.tool_health.serialize import _serialize_refactoring
from repowise.server.services.performance_health import (
PerformanceHealthService,
PerformancePage,
@@ -54,7 +51,6 @@ class _PerformanceBlocks:
page: PerformancePage | None = None
summary: dict[str, Any] | None = None
- directive: dict[str, Any] | None = None
ignored: dict[str, str] = field(default_factory=dict)
@@ -64,7 +60,6 @@ async def _performance_blocks(
wants: Any,
included: bool,
file_paths: tuple[str, ...] | None,
- scoped: bool,
limit: int,
cursor: int,
view: str | None,
@@ -74,16 +69,15 @@ async def _performance_blocks(
actionability: str | None,
sort: str | None,
) -> _PerformanceBlocks:
- """Read the materialized queue, its rollup, and the dashboard lead.
+ """Read the materialized queue and its rollup.
Each block is gated on surviving the projection, so a caller that asked for
- one of the three does not pay for the other two.
+ one does not pay for the other.
"""
page = None
query = None
ignored: dict[str, str] = {}
if included:
- # The lede quotes only the first row, so projected down to it, read one.
emits_queue = wants("performance_opportunities")
query, ignored = parse_query(
context=context,
@@ -110,10 +104,6 @@ async def _performance_blocks(
if included and wants("performance_summary")
else None
),
- # Dashboard lead: one primary-key read, independent of repo size.
- directive=(
- await service.directive() if not scoped and wants("performance_directive") else None
- ),
ignored=ignored,
)
@@ -124,7 +114,6 @@ class _RefactoringBlocks:
page: Any = None
summary: dict[str, Any] | None = None
- directive: dict[str, Any] | None = None
ignored: dict[str, str] = field(default_factory=dict)
@@ -142,10 +131,10 @@ async def _refactoring_blocks(
confidence: str | None = None,
effort: str | None = None,
) -> _RefactoringBlocks:
- """Read the materialized queue, its rollup, and the dashboard lead.
+ """Read the materialized queue and its rollup.
Each block is gated on surviving the projection, so a caller that asked for
- one of the three does not pay for the other two.
+ one does not pay for the other.
"""
page = None
ignored: dict[str, str] = {}
@@ -172,12 +161,6 @@ async def _refactoring_blocks(
return _RefactoringBlocks(
page=page,
summary=await service.summary() if rollup_wanted else None,
- # Dashboard only: a targeted call is about the files the caller named.
- directive=(
- await service.directive()
- if not scoped and wants("refactoring_directive")
- else None
- ),
ignored=ignored,
)
@@ -246,76 +229,3 @@ def _render_performance(
"only=['performance_opportunities'], limit=6)"
),
}
-
-
-_PERFORMANCE_LEAD_KEYS = (
- "opportunity_id",
- "intervention_symbol",
- "boundary_kind",
- "execution_context",
- "affected_call_sites_total",
- "rank_score",
-)
-
-_RECOMMENDATION_LEAD_KEYS = (
- "id",
- "refactoring_type",
- "file_path",
- "target_symbol",
- "benefit",
- "leverage",
- "cost",
- "risk",
- "rank_score",
-)
-
-
-def _recommendation_lede(
- performance: _PerformanceBlocks,
- recommendations: list[Recommendation],
- reference_repository: str,
- req: HealthRequest,
-) -> dict[str, Any]:
- """One performance opportunity beside one plan, when both pillars were asked for."""
- performance_lead = next(
- (
- item
- for item in (performance.page.items if performance.page else [])
- if item.get("biomarker_type") not in NON_LEADING_MARKERS
- ),
- None,
- )
- lead_payload = (
- _serialize_refactoring(recommendations[0], reference_repository)
- if recommendations
- else None
- )
- return {
- "performance_opportunities_total": (
- performance.page.total if performance.page else 0
- ),
- "refactoring_plans_total": len(recommendations),
- "performance_lead": (
- {key: performance_lead[key] for key in _PERFORMANCE_LEAD_KEYS}
- if performance_lead
- else None
- ),
- "recommendation_lead": (
- {key: lead_payload[key] for key in _RECOMMENDATION_LEAD_KEYS}
- if lead_payload
- else None
- ),
- # The lead's plan, from the one place that decides plan linkage.
- "performance_plan_id": (
- performance_lead["plan_reference"] if performance_lead else None
- ),
- "performance_plan_reason": (
- performance_lead["plan_reason"] if performance_lead else None
- ),
- "next_call": (
- f"get_health(targets={req.raw_targets!r}, repo={req.repo!r}, "
- "include=['performance','refactoring'], limit=3, "
- "only=['performance_opportunities','refactoring_plans'], "
- f"refactoring_view='{req.refactoring_view}')"
- ),
- }
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/request.py b/packages/server/src/repowise/server/mcp_server/tool_health/request.py
index f82690e82..e273cf04e 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/request.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/request.py
@@ -37,6 +37,8 @@ _KNOWN_INCLUDES = frozenset(
"advisory",
# Opts into provisional finding types, each labelled "unverified".
"unverified",
+ # The shared legend for deficit points and percentiles, in ``_meta``.
+ "semantics",
}
)
@@ -125,19 +127,11 @@ class HealthRequest:
@property
def wants_performance_opportunities(self) -> bool:
- return (
- self.wants("performance_opportunities")
- or self.wants("recommendation_lede")
- or self.wants("performance_summary")
- )
+ return self.wants("performance_opportunities") or self.wants("performance_summary")
@property
def wants_refactoring_opportunities(self) -> bool:
- return (
- self.wants("refactoring_opportunities")
- or self.wants("recommendation_lede")
- or self.wants("refactoring_summary")
- )
+ return self.wants("refactoring_opportunities") or self.wants("refactoring_summary")
@property
def needs_test_paths(self) -> bool:
@@ -164,14 +158,4 @@ class HealthRequest:
``include=["refactoring"]`` leads with composed opportunities, and
emitting plans too would ship the same work twice.
"""
- return "refactoring" in self.include_set and (
- "refactoring_plans" in self.only_set
- # The cross-pillar lede quotes one plan.
- or self.wants_lede
- )
-
- @property
- def wants_lede(self) -> bool:
- return {"performance", "refactoring"} <= self.include_set and self.wants(
- "recommendation_lede"
- )
+ return "refactoring" in self.include_set and "refactoring_plans" in self.only_set
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/summary.py b/packages/server/src/repowise/server/mcp_server/tool_health/summary.py
index 639403beb..9c8f5dad6 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/summary.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/summary.py
@@ -1,4 +1,4 @@
-"""Repository summaries for get_health: KPIs, gap analysis, per-file leads, the directive."""
+"""Repository summaries for get_health: KPIs, gap analysis and per-file leads."""
from __future__ import annotations
@@ -14,10 +14,6 @@ from repowise.core.analysis.health.scoring import (
)
from repowise.core.persistence.models import HealthFileMetric
-# ``fix_first`` plus the two in ``then``. The plan lookup, the lead set and the
-# directive must agree on it.
-_DIRECTIVE_CANDIDATES = 3
-
def _leads_by_file(findings: list[Any]) -> dict[str, dict[str, Any]]:
"""Reduce each file's findings to its dominant cause + pre-clamp magnitude.
@@ -51,102 +47,6 @@ def _leads_by_file(findings: list[Any]) -> dict[str, dict[str, Any]]:
return leads
-def _directive(
- by_leverage: list[HealthFileMetric],
- leads: dict[str, dict[str, Any]],
- gap_points: int,
- plan_biomarkers_by_path: dict[str, set[str]] | None = None,
- plan_count_by_path: dict[str, int] | None = None,
-) -> dict[str, Any] | None:
- """The one file to fix first, and what fixing it buys.
-
- Every other block ranks and describes; this one recommends, like
- ``get_risk``'s ``directive``. Ranked by ``weighted_deficit`` (``score``
- floors at 1.0), so it names the file that moves the repo average.
- """
- if not by_leverage:
- return None
- # The highest-leverage file with something an edit can remove, else the
- # top file, flagged below rather than given an invented task.
- top = next(
- (m for m in by_leverage if (leads.get(m.file_path) or {}).get("actionable_biomarker")),
- by_leverage[0],
- )
- recovers = round(max(TARGET_SCORE - top.score, 0.0) * max(top.nloc, 1))
- lead = leads.get(top.file_path) or {}
- # Does a plan behind ``plan_via`` address the cause in ``reason``? Some
- # biomarkers (e.g. ``coverage_gradient``) have no plan kind at all.
- lead_biomarker = lead.get("actionable_biomarker")
- available = (plan_biomarkers_by_path or {}).get(top.file_path, set())
- addresses = bool(lead_biomarker) and lead_biomarker in available
- out = {
- "fix_first": top.file_path,
- "reason": lead.get("actionable_reason") or f"scores {round(top.score, 2)}",
- # What this file recovers at target, and its share of the gross gap
- # (see ``_gap_analysis`` for the denominator).
- "recovers_weighted_deficit_points": recovers,
- "recovers_points": recovers,
- "recovers_points_compatibility": {
- "deprecated": True,
- "replacement": "recovers_weighted_deficit_points",
- "equivalent_value": True,
- },
- "share_of_repo_gap_pct": (round(100.0 * recovers / gap_points, 1) if gap_points else None),
- "then": [m.file_path for m in by_leverage if m.file_path != top.file_path][:2],
- # Projected with ``only``: the bare ``include`` call restates the whole
- # dashboard and can exceed the MCP token cap.
- "plan_via": "get_health(include=['refactoring'], only=['refactoring_plans'])",
- "plan_addresses_reason": addresses,
- }
- # Context, not a task: no edit to this file settles history.
- if lead.get("watch_biomarker"):
- out["watch"] = {
- "biomarker": lead["watch_biomarker"],
- "reason": lead.get("watch_reason"),
- "note": "History-derived. Read it as context; there is nothing here to fix.",
- }
- if not lead_biomarker:
- # No file has a code-shape lead: the deficit is history.
- out["next_action"] = (
- "No file's leading cause is code shape; the deficit on this one is "
- "history. Read watch for what is moving and leave it alone."
- )
- return out
- if addresses:
- out["next_action"] = "inspect matching plan via plan_via"
- return out
- out["plan_note"] = _plan_note(
- lead_biomarker, available, (plan_count_by_path or {}).get(top.file_path, 0)
- )
- out["next_action"] = f"investigate {lead_biomarker}"
- return out
-
-
-def _plan_note(lead_biomarker: str, available: set[str], n_plans: int) -> str:
- """Name the gap rather than leaving the caller to diff two biomarker vocabularies.
-
- The three branches call for different next moves: plans for other causes,
- plans with no recorded cause, or no plans.
- """
- if available:
- # Not "only X, Y": plans with an empty ``source_biomarker`` cannot be named.
- return (
- f"No stored plan addresses {lead_biomarker!r}; the plans on this file "
- f"target {', '.join(sorted(available))}. Treat plan_via as related "
- f"cleanup, not the fix for reason."
- )
- if n_plans:
- return (
- f"No stored plan addresses {lead_biomarker!r}; this file's {n_plans} "
- f"plan(s) record no source biomarker. Treat plan_via as related "
- f"cleanup, not the fix for reason."
- )
- return (
- f"No plan addresses {lead_biomarker!r}; this file has no plans. "
- "Use the finding itself."
- )
-
-
def _gap_analysis(metrics: list[HealthFileMetric]) -> dict[str, Any]:
"""How few files must reach 8.0 for the *weighted average* to reach 8.0.
diff --git a/packages/server/src/repowise/server/mcp_server/tool_health/tool.py b/packages/server/src/repowise/server/mcp_server/tool_health/tool.py
index 8285f961f..306006459 100644
--- a/packages/server/src/repowise/server/mcp_server/tool_health/tool.py
+++ b/packages/server/src/repowise/server/mcp_server/tool_health/tool.py
@@ -13,6 +13,7 @@ from typing import Any
from repowise.core.analysis.health.counts import DEFAULT_COUNTS
from repowise.core.analysis.health.scope import DEFAULT_SCOPE
+from repowise.core.analysis.health.semantics import health_semantics_contract
from repowise.core.persistence.database import get_session
from repowise.core.registry import ToolRecipe
from repowise.core.registry import mcp_tool_registry as mcp
@@ -59,8 +60,13 @@ __all__ = ["_ONLY_ALIASES", "get_health"]
evidence_basis="measured",
recipes=(
ToolRecipe(
- "health_directive",
- 'get_health(only=["directive"])',
+ "health_fix_first",
+ 'get_health(only=["fix_first"])',
+ ("get_health",),
+ ),
+ ToolRecipe(
+ "health_fix_item",
+ 'get_health(fix_id="fix1_...")',
("get_health",),
),
ToolRecipe(
@@ -126,6 +132,7 @@ async def get_health(
finding_id: str | None = None,
plan_id: str | None = None,
opportunity_id: str | None = None,
+ fix_id: str | None = None,
performance_view: str | None = None,
performance_context: str | None = None,
performance_boundary: str | None = None,
@@ -137,16 +144,16 @@ async def get_health(
) -> dict:
"""Code-health scores and findings from stored analysis.
- No ``targets`` returns a dashboard; targets rank files and findings.
+ No ``targets``: a dashboard led by ``fix_first``, what to fix first;
+ targets rank files and findings.
Never recomputes health: commit, then run ``repowise update``.
Every block and accepted value: docs/agent/MCP_TOOLS.md.
Args:
- targets: file paths or ``module:<name>``; unmatched ones land in
- ``unresolved``.
+ targets: file paths or ``module:<name>``; misses land in ``unresolved``.
include: ``biomarkers``|``refactoring``|``trend``|``coverage``|
- ``accuracy``|``signals``|``churn_complexity``|``doc_drift``,
- or a dimension incl. ``advisory``; ``performance`` and
+ ``accuracy``|``signals``|``churn_complexity``|``doc_drift``|
+ ``semantics``, or a dimension incl. ``advisory``; ``performance`` and
``refactoring`` add queues.
only: keys to keep; identity, totals, recovery survive.
``biomarkers``/``accuracy``/``refactoring`` alias their block key;
@@ -155,21 +162,20 @@ async def get_health(
repo: usually omitted.
limit: max rows per ranked list, ``0`` for none.
cursor: zero-based offset into a ranked list.
- finding_id/plan_id: stable ``id`` from a finding or plan.
+ fix_id/finding_id/plan_id: stable ``id`` of an item, finding or plan.
opportunity_id: ``perf...``/``refop...``: the unit, its steps or
plan, evidence paged by ``only=["*_evidence"]``.
refactoring_view: ``diversified`` (default)|``canonical``|
``file_spread``; _type/_confidence/_effort filter.
performance_view/_context/_boundary/_confidence/_actionability/_sort:
- queue filters; a rejected value lists the accepted.
+ queue filters.
scope / counts: default ``all``/``everything``. ``production`` drops
- test files; ``code_shape`` drops the git-derived half of the
- score and its findings.
+ test files; ``code_shape`` drops git-derived score and findings.
"""
started = perf_counter()
conflict = _selector_conflict(
- finding_id=finding_id, plan_id=plan_id, opportunity_id=opportunity_id
+ fix_id=fix_id, finding_id=finding_id, plan_id=plan_id, opportunity_id=opportunity_id
)
if conflict is not None:
return _note_inapplicable_controls(conflict, scope, counts)
@@ -208,11 +214,13 @@ async def get_health(
finding_id=finding_id,
plan_id=plan_id,
opportunity_id=opportunity_id,
+ fix_id=fix_id,
only_set=req.only_set,
limit=req.limit,
cursor=req.cursor,
)
if detail is not None:
+ _attach_semantics(detail, req)
return _note_inapplicable_controls(detail, scope, counts)
data = await load_health_data(
session, repository, reference_repository, ctx.path, req
@@ -235,11 +243,18 @@ async def get_health(
_attach_health_analysis_meta(result["_meta"], data.pop.all_metrics)
pager.report_omissions(result, omission_collector, reference_repository)
omission_collector.attach(result)
+ _attach_semantics(result, req)
# Server-side wall clock, as ``get_context`` reports.
result["_meta"]["timing_ms"] = round((perf_counter() - started) * 1000, 2)
return result
+def _attach_semantics(result: dict[str, Any], req: HealthRequest) -> None:
+ """The unit legend, on request: it is the same on every call."""
+ if "semantics" in req.include_set:
+ result.setdefault("_meta", {})["health_semantics"] = health_semantics_contract()
+
+
def _finish(
result: dict[str, Any],
data: HealthData,
diff --git a/packages/server/src/repowise/server/routers/code_health/__init__.py b/packages/server/src/repowise/server/routers/code_health/__init__.py
index 760a64f7f..037baadde 100644
--- a/packages/server/src/repowise/server/routers/code_health/__init__.py
+++ b/packages/server/src/repowise/server/routers/code_health/__init__.py
@@ -20,6 +20,7 @@ from . import (
coverage_routes, # noqa: F401
files_routes, # noqa: F401
findings_routes, # noqa: F401
+ fix_first_routes, # noqa: F401
map_routes, # noqa: F401
overview_routes, # noqa: F401
performance_routes, # noqa: F401
diff --git a/packages/server/src/repowise/server/routers/code_health/fix_first_routes.py b/packages/server/src/repowise/server/routers/code_health/fix_first_routes.py
new file mode 100644
index 000000000..a54b798f8
--- /dev/null
+++ b/packages/server/src/repowise/server/routers/code_health/fix_first_routes.py
@@ -0,0 +1,67 @@
+"""The Fix-first queue: one ranked list of what to fix, as core builds it.
+
+A thin adapter over ``load_fix_first``; ranking, eligibility and copy are
+core's, so this surface and the agent surface cannot disagree.
+"""
+
+from __future__ import annotations
+
+from typing import Any
+
+from fastapi import Depends, HTTPException, Query
+from pydantic import BaseModel
+from sqlalchemy.ext.asyncio import AsyncSession
+
+from repowise.core.analysis.health.fix_first import FIX_SCOPES, FixItem
+from repowise.core.analysis.health.fix_first.model import FixTotals
+from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
+from repowise.server.deps import get_db_session
+
+from ._router import router
+
+
+class FixFirstQueueResponse(BaseModel):
+ """``FixFirstQueue.as_dict()``: the stored fields plus the ``lead`` it derives."""
+
+ items: list[FixItem]
+ lead: FixItem | None
+ totals: FixTotals
+ by_improves: dict[str, int]
+ model_version: int
+ basis: dict[str, str | None]
+
+
+def _scope(scope: str) -> str:
+ if scope not in FIX_SCOPES:
+ raise HTTPException(status_code=422, detail=f"scope must be one of {list(FIX_SCOPES)}")
+ return scope
+
+
[email protected]("/api/repos/{repo_id}/health/fix-first", response_model=FixFirstQueueResponse)
+async def get_fix_first(
+ repo_id: str,
+ limit: int = Query(10, ge=0, le=50),
+ scope: str = Query("production", description="production (default) or all"),
+ session: AsyncSession = Depends(get_db_session),
+) -> dict[str, Any]:
+ """The ranked queue, its lead, and how many units each rule excluded."""
+ queue = await load_fix_first(session, repo_id, limit=limit, scope=_scope(scope))
+ return queue.as_dict()
+
+
[email protected]("/api/repos/{repo_id}/health/fix-first/{fix_id}", response_model=FixItem)
+async def get_fix_first_item(
+ repo_id: str,
+ fix_id: str,
+ scope: str = Query("production"),
+ session: AsyncSession = Depends(get_db_session),
+) -> dict[str, Any]:
+ """One item by its stable id, wherever it ranks."""
+ queue = await load_fix_first(session, repo_id, scope=_scope(scope), item_id=fix_id)
+ item = queue.find(fix_id)
+ if item is None:
+ raise HTTPException(status_code=404, detail="No open Fix-first item with that id")
+ return item.as_dict()
+
+
+__all__ = ["get_fix_first", "get_fix_first_item"]
diff --git a/packages/server/src/repowise/server/routers/code_health/refactoring_routes.py b/packages/server/src/repowise/server/routers/code_health/refactoring_routes.py
index 00d93a55d..4151421b5 100644
--- a/packages/server/src/repowise/server/routers/code_health/refactoring_routes.py
+++ b/packages/server/src/repowise/server/routers/code_health/refactoring_routes.py
@@ -11,7 +11,7 @@ from typing import Any
from fastapi import Depends, HTTPException, Query
from sqlalchemy.ext.asyncio import AsyncSession
-from repowise.core.analysis.health.models import primary_finding
+from repowise.core.analysis.health.models import primary_finding, split_by_origin
from repowise.core.analysis.health.scoring import ZERO_IMPACT_DIMENSIONS
from repowise.core.analysis.health.suggestions import suggestion_for as _suggestion_for
from repowise.core.persistence import crud
@@ -83,6 +83,14 @@ async def health_work_queue(
sort: str = Query(
"impact_per_effort", pattern="^(impact_per_effort|total_impact|score|finding_count)$"
),
+ history: str = Query(
+ "exclude",
+ pattern="^(exclude|include)$",
+ description=(
+ "exclude (default) leaves out files whose only findings are history "
+ "markers: context, not work an edit can do. include keeps them."
+ ),
+ ),
scope: str = ScopeQuery,
counts: str = CountsQuery,
session: AsyncSession = Depends(get_db_session),
@@ -152,6 +160,7 @@ async def health_work_queue(
max_effort_rank = effort_rank.get(max_effort or "", 99)
targets: list[dict] = []
+ history_only = 0
for file_path, fs in by_file.items():
m = metric_by_path.get(file_path)
# Absent means either filtered out above, or a file this reading
@@ -160,6 +169,11 @@ async def health_work_queue(
# top of a list ordered by how bad things are.
if m is None:
continue
+ # Naming a marker reaches it whatever its origin, as with the
+ # zero-impact dimensions above.
+ if history == "exclude" and biomarker is None and not split_by_origin(fs)[0]:
+ history_only += 1
+ continue
nloc = m.nloc
score = m.score
primary = primary_finding(fs)
@@ -211,6 +225,7 @@ async def health_work_queue(
"targets": targets[offset : offset + limit],
"total": len(targets),
"finding_total": sum(t["finding_count"] for t in targets),
+ "history_only_excluded": history_only,
"offset": offset,
"limit": limit,
}
diff --git a/packages/server/src/repowise/server/schemas/code_health.py b/packages/server/src/repowise/server/schemas/code_health.py
index c5ef618ac..742aceddf 100644
--- a/packages/server/src/repowise/server/schemas/code_health.py
+++ b/packages/server/src/repowise/server/schemas/code_health.py
@@ -206,5 +206,8 @@ class HealthWorkQueueResponse(BaseModel):
#: Findings across those files, so the page can size the work, not just
#: the file count it is paging through.
finding_total: int = 0
+ #: Files left out because every finding on them is a history marker
+ #: (``history=exclude``, the default). Not counted in ``total``.
+ history_only_excluded: int = 0
offset: int = 0
limit: int = 0
diff --git a/packages/server/src/repowise/server/services/performance_health.py b/packages/server/src/repowise/server/services/performance_health.py
index e02ebed82..8bc088194 100644
--- a/packages/server/src/repowise/server/services/performance_health.py
+++ b/packages/server/src/repowise/server/services/performance_health.py
@@ -386,73 +386,6 @@ class PerformanceHealthService:
grouped = await performance_facet_counts(self._session, self._repository_id)
return _rescope(base, grouped, contexts)
- async def directive(self) -> dict[str, Any]:
- """One bounded next action for a bare dashboard call.
-
- Selection is the best concrete next action rather than the highest raw
- rank: the materialized order already sorts actionable work above
- high-volume evidence, so the lead is the first row.
-
- The lead and the counts come off the same row read, because the lead is
- the reason the row exists.
- """
- row = await get_performance_summary(self._session, self._repository_id)
- summary = _summary_of(row)
- if summary["status"] == "unavailable":
- return {
- "status": "unavailable",
- "reason": summary["reason"],
- "detail": summary["detail"],
- }
- lead = _loads(row.summary_json).get("lead")
- counts = summary["actionability"]
- base = {
- "performance_model_version": PERFORMANCE_MODEL_VERSION,
- "opportunities_total": summary["total"],
- "plan_ready_total": counts.get("plan_ready", 0),
- "advisory_total": counts.get("advisory", 0),
- "investigate_total": counts.get("investigate", 0),
- "expected_total": counts.get("expected", 0),
- }
- if summary["status"] == "stale_model":
- return {
- **base,
- "status": "unavailable",
- "reason": "stale_model",
- "detail": (
- "The stored performance analysis predates the current model. "
- "Run repowise update to rescore."
- ),
- }
- if lead is None:
- return {
- **base,
- "status": "clear",
- # Never "fast": the analysis found no supported pattern, which
- # is not a measurement of how this code runs.
- "detail": "No supported open pattern surfaced.",
- }
- return {
- **base,
- "status": lead["actionability_state"],
- "opportunity_id": lead["opportunity_id"],
- "title": _title(lead),
- "file_path": lead["file_path"],
- "execution_context": lead["execution_context"],
- "boundary_kind": lead["boundary_kind"],
- "affected_call_sites_total": lead["affected_call_sites_total"],
- "observations_total": lead["observations_total"],
- "why_ranked": lead["why_ranked"][:3],
- "plan_state": lead["plan_state"],
- "plan_reason": _PLAN_REASONS[lead["plan_state"]],
- "prerequisites": lead["prerequisites"],
- **_plan_brief(lead.get("plan"), economics=False),
- "next_action": {
- "tool": "get_health",
- "arguments": {"opportunity_id": lead["opportunity_id"]},
- },
- }
-
# -- detail ------------------------------------------------------------
async def detail(
@@ -650,25 +583,19 @@ def evidence_block(
return block
-def _plan_brief(plan: dict[str, Any] | None, *, economics: bool = True) -> dict[str, Any]:
- """The stored plan's validation (and steps, economics), or nothing on an older store."""
+def _plan_brief(plan: dict[str, Any] | None) -> dict[str, Any]:
+ """The stored plan's validation, steps and economics, or nothing on an older store."""
if not plan:
return {}
validation = plan.get("validation") or {}
- keys = ("basis", "via", "total", "tests", "commands") if economics else ("basis", "via", "total")
- brief: dict[str, Any] = {"validation": {key: validation.get(key) for key in keys}}
- if economics:
- brief["plan_steps"] = plan.get("steps", [])
- brief["plan_economics"] = {
+ keys = ("basis", "via", "total", "tests", "commands")
+ return {
+ "validation": {key: validation.get(key) for key in keys},
+ "plan_steps": plan.get("steps", []),
+ "plan_economics": {
key: plan.get(key) for key in ("effort_bucket", "benefit", "cost", "risk")
- }
- return brief
-
-
-def _title(lead: dict[str, Any]) -> str:
- """A human cause, not a marker name."""
- symbol = lead.get("intervention_symbol") or lead.get("terminal_sink") or lead["file_path"]
- return f"{lead['biomarker_type']} reaching {symbol}"
+ },
+ }
def _unresolved_detail(state: dict[str, Any]) -> str:
diff --git a/packages/types/package.json b/packages/types/package.json
index 760dac2ea..1b3d2d658 100644
--- a/packages/types/package.json
+++ b/packages/types/package.json
@@ -35,6 +35,7 @@
"./coupling": "./src/coupling.ts",
"./stats": "./src/stats.ts",
"./refactoring": "./src/refactoring.ts",
+ "./fix-first": "./src/fix-first.ts",
"./generated/http": "./src/generated/http.ts"
},
"publishConfig": {
diff --git a/packages/types/src/actions.ts b/packages/types/src/actions.ts
index a884b1b03..a6ef39310 100644
--- a/packages/types/src/actions.ts
+++ b/packages/types/src/actions.ts
@@ -11,7 +11,7 @@ export type ActionRule =
| "fresh_regressions"
| "fragile_file"
| "fix_concentration"
- | "hot_path_perf"
+ | "fix_first"
| "stale_decision"
| "knowledge_loss"
| "broken_doc_refs"
diff --git a/packages/types/src/fix-first.ts b/packages/types/src/fix-first.ts
new file mode 100644
index 000000000..0cac4abbf
--- /dev/null
+++ b/packages/types/src/fix-first.ts
@@ -0,0 +1,125 @@
+/**
+ * Fix first: one ranked list of what to fix, built once in core from stored rows.
+ *
+ * Mirrors `repowise.core.analysis.health.fix_first.model`.
+ * `test_wire_vocabulary_parity.py` fails when the unions below and their
+ * Python twins disagree.
+ */
+
+export type FixTier = "now" | "next" | "later";
+
+export type FixKind = "refactor" | "perf_fix" | "finding";
+
+export type FixImproves = "defect" | "maintainability" | "performance";
+
+export type FixGainKind = "health_points" | "performance";
+
+export type FixEffort = "S" | "M" | "L" | "XL";
+
+export type FixLevel = "high" | "medium" | "low";
+
+/** `unknown` is printed as a fact, never read as zero. */
+export type FixFactBasis = "measured" | "inferred" | "unknown";
+
+/** Why a unit of work is not in the queue; each is counted in `totals.excluded`. */
+export type FixExclusion =
+ | "test"
+ | "tooling"
+ | "generated"
+ | "expected"
+ | "no_plan"
+ | "below_min_worth"
+ | "history_only";
+
+/** `all` keeps test files, labelled in `context`. */
+export type FixScope = "production" | "all";
+
+export interface FixTarget {
+ file_path: string;
+ symbol: string | null;
+ line_start: number | null;
+ line_end: number | null;
+}
+
+export interface FixFact {
+ label: string;
+ value: string;
+ basis: FixFactBasis;
+}
+
+export interface FixStep {
+ order: number;
+ text: string;
+ file_path: string;
+ line: number | null;
+ mechanical: boolean;
+}
+
+export interface FixNextCall {
+ tool: string;
+ arguments: Record<string, unknown>;
+}
+
+export interface FixItem {
+ /** `fix1_<20 hex>`: stable while the item's source id is. */
+ id: string;
+ rank: number;
+ tier: FixTier;
+ kind: FixKind;
+ improves: FixImproves;
+ /** Imperative, at most 90 characters, no biomarker ids. */
+ title: string;
+ target: FixTarget;
+ /** One plain sentence: the problem, and why it matters here. */
+ why: string;
+ facts: FixFact[];
+ action: { summary: string; steps: FixStep[]; steps_total: number; mechanical: boolean };
+ gain: { kind: FixGainKind; value: number | null; text: string };
+ effort: { bucket: FixEffort; basis: string };
+ risk: { level: FixLevel; dependents: number | null; files_touched: number; text: string };
+ confidence: { level: FixLevel; reason: string };
+ verify: {
+ tests: { path: string; reason: string }[];
+ tests_total: number;
+ command: string | null;
+ basis: FixFactBasis;
+ };
+ /** History signals: shown beside the item, never ranked on. */
+ context: { label: string; value: string }[];
+ source: { opportunity_id: string | null; plan_ids: string[]; finding_ids: string[] };
+ next_call: FixNextCall;
+ /** The value inputs and the tier reason, so the order is explainable. */
+ why_ranked: { factor: string; value: string }[];
+}
+
+/** The projection a list renders; the full item is one lookup away. */
+export interface FixItemCompact {
+ id: string;
+ tier: FixTier;
+ kind: FixKind;
+ title: string;
+ target: FixTarget;
+ why: string;
+ gain: string;
+ effort: FixEffort;
+ confidence: FixLevel;
+ next_call: FixNextCall;
+}
+
+export interface FixFirstTotals {
+ candidates: number;
+ eligible: number;
+ shown: number;
+ excluded: Record<FixExclusion, number>;
+}
+
+export interface FixFirstQueue<Item = FixItem> {
+ items: Item[];
+ /** `items[0]`, or null when nothing is eligible. */
+ lead: Item | null;
+ totals: FixFirstTotals;
+ /** Eligible items per pillar they improve. */
+ by_improves: Record<FixImproves, number>;
+ model_version: number;
+ basis: { analyzed_commit: string | null; health_analyzed_at: string | null };
+}
diff --git a/packages/types/src/generated/http.ts b/packages/types/src/generated/http.ts
index 5ce1bb16a..7353122b6 100644
--- a/packages/types/src/generated/http.ts
+++ b/packages/types/src/generated/http.ts
@@ -1513,6 +1513,50 @@ export interface FindingStatusUpdate {
status: string;
}
+export interface FixAction {
+ summary: string;
+ steps: FixStep[];
+ steps_total: number;
+ mechanical: boolean;
+}
+
+export interface FixConfidence {
+ level: "high" | "medium" | "low";
+ reason: string;
+}
+
+export interface FixContext {
+ label: string;
+ value: string;
+}
+
+export interface FixEffortEstimate {
+ bucket: "S" | "M" | "L" | "XL";
+ basis: string;
+}
+
+export interface FixFact {
+ label: string;
+ value: string;
+ basis?: "measured" | "inferred" | "unknown";
+}
+
+/** ``FixFirstQueue.as_dict()``: the stored fields plus the ``lead`` it derives. */
+export interface FixFirstQueueResponse {
+ items: FixItem[];
+ lead: FixItem | null;
+ totals: FixTotals;
+ by_improves: Record<string, number>;
+ model_version: number;
+ basis: Record<string, string | null>;
+}
+
+export interface FixGain {
+ kind: "health_points" | "performance";
+ value: number | null;
+ text: string;
+}
+
/** One changed file's recency-weighted bug-fix record. */
export interface FixHistoryFileResponse {
path: string;
@@ -1536,6 +1580,85 @@ export interface FixHistoryResponse {
files: FixHistoryFileResponse[];
}
+export interface FixItem {
+ id: string;
+ rank: number;
+ tier: "now" | "next" | "later";
+ kind: "refactor" | "perf_fix" | "finding";
+ improves: "defect" | "maintainability" | "performance";
+ title: string;
+ target: FixTarget;
+ why: string;
+ facts: FixFact[];
+ action: FixAction;
+ gain: FixGain;
+ effort: FixEffortEstimate;
+ risk: FixRisk;
+ confidence: FixConfidence;
+ verify: FixVerify;
+ context: FixContext[];
+ source: FixSource;
+ next_call: FixNextCall;
+ why_ranked?: FixRankFact[];
+}
+
+export interface FixNextCall {
+ tool: string;
+ arguments: Record<string, unknown>;
+}
+
+export interface FixRankFact {
+ factor: string;
+ value: string;
+}
+
+export interface FixRisk {
+ level: "high" | "medium" | "low";
+ dependents: number | null;
+ files_touched: number;
+ text: string;
+}
+
+export interface FixSource {
+ opportunity_id?: string | null;
+ plan_ids?: string[];
+ finding_ids?: string[];
+}
+
+export interface FixStep {
+ order: number;
+ text: string;
+ file_path: string;
+ line?: number | null;
+ mechanical?: boolean;
+}
+
+export interface FixTarget {
+ file_path: string;
+ symbol?: string | null;
+ line_start?: number | null;
+ line_end?: number | null;
+}
+
+export interface FixTest {
+ path: string;
+ reason: string;
+}
+
+export interface FixTotals {
+ candidates?: number;
+ eligible?: number;
+ shown?: number;
+ excluded?: Record<string, number>;
+}
+
+export interface FixVerify {
+ tests: FixTest[];
+ tests_total: number;
+ command: string | null;
+ basis: "measured" | "inferred" | "unknown";
+}
+
/** Optional per-call overrides for the enrichment provider/model. */
export interface GenerateCodeRequest {
provider?: string | null;
@@ -1853,6 +1976,7 @@ export interface HealthWorkQueueResponse {
targets?: HealthWorkItem[];
total?: number;
finding_total?: number;
+ history_only_excluded?: number;
offset?: number;
limit?: number;
}
diff --git a/packages/types/src/health.ts b/packages/types/src/health.ts
index d54dab8ea..12db48ac5 100644
--- a/packages/types/src/health.ts
+++ b/packages/types/src/health.ts
@@ -1226,6 +1226,11 @@ export interface HealthWorkQueueResponse {
* inventing one.
*/
finding_total?: number;
+ /**
+ * Files left out because every finding on them is a history marker
+ * (`history: "exclude"`, the default). Not counted in `total`.
+ */
+ history_only_excluded?: number;
offset?: number;
limit?: number;
}
@@ -1251,6 +1256,8 @@ export interface HealthWorkQueueQuery {
only_failing?: boolean;
max_effort?: string;
sort?: "impact_per_effort" | "total_impact" | "score" | "finding_count";
+ /** `"exclude"` (default) leaves out files whose only findings are history markers. */
+ history?: "exclude" | "include";
/** Which half of the repository to describe. Defaults to `"all"`. */
scope?: HealthScope;
}
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 2db796006..cc6848c42 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -34,3 +34,4 @@ export * from "./health.js";
export * from "./coupling.js";
export * from "./stats.js";
export * from "./refactoring.js";
+export * from "./fix-first.js";
diff --git a/packages/ui/vitest.config.ts b/packages/ui/vitest.config.ts
index 5080705e8..3a82b3429 100644
--- a/packages/ui/vitest.config.ts
+++ b/packages/ui/vitest.config.ts
@@ -40,6 +40,7 @@ export default defineConfig({
"@repowise-dev/types/modules": path.resolve(__dirname, "../types/src/modules.ts"),
"@repowise-dev/types/overview": path.resolve(__dirname, "../types/src/overview.ts"),
"@repowise-dev/types/actions": path.resolve(__dirname, "../types/src/actions.ts"),
+ "@repowise-dev/types/fix-first": path.resolve(__dirname, "../types/src/fix-first.ts"),
"@repowise-dev/types/files": path.resolve(__dirname, "../types/src/files.ts"),
"@repowise-dev/types/external-systems": path.resolve(
__dirname,
diff --git a/plugins/claude-code/skills/code-health/SKILL.md b/plugins/claude-code/skills/code-health/SKILL.md
index 03d753182..0ed8bcba0 100644
--- a/plugins/claude-code/skills/code-health/SKILL.md
+++ b/plugins/claude-code/skills/code-health/SKILL.md
@@ -19,8 +19,8 @@ not just *bigger*.
## Pick the mode by what you pass
-- **Dashboard** — `get_health()` (no targets): a `directive` naming what to fix
- first, then repo-level KPIs and the lowest-scoring files. Start here for "how
+- **Dashboard**: `get_health()` (no targets): `fix_first`, the ranked list of
+ what to fix first, then repo-level KPIs and the lowest-scoring files. Start here for "how
healthy is this codebase?" or "what should we clean up?".
- **Targeted** — `get_health(targets=["src/x.py", "src/y.py"])`: per-file score
and the specific marker findings driving it. Use before/after a refactor,
@@ -38,9 +38,9 @@ not just *bigger*.
## How to use the results
-1. For "what should I refactor?" → dashboard mode, lead with `directive`, then
- `get_health(targets=[worst files], include=["refactoring"])` and present the
- ranked plans, not just the scores.
+1. For "what should I refactor?" → dashboard mode, lead with `fix_first`; open
+ an item with `get_health(fix_id=...)` for its steps and the tests to run,
+ and present the plan, not just the scores.
2. Rank by `weighted_deficit`, not `score` — the score floors at 1.0.
3. For a specific file → report the score, the top 2–3 marker findings, and
what each one means in plain language. Avoid dumping the raw payload.
diff --git a/tests/fixtures/mcp/token_calibration_responses.json b/tests/fixtures/mcp/token_calibration_responses.json
index 55737a810..918692a19 100644
--- a/tests/fixtures/mcp/token_calibration_responses.json
+++ b/tests/fixtures/mcp/token_calibration_responses.json
@@ -1 +1 @@
-{"get_answer:how-question":{"_meta":{"cached":true,"completeness":{"capped":true,"reason":"confidence_projection_and_deduplication","shown":1,"total":15},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","projection":{"recovery":{"arguments":{"include":["evidence"],"question":"How does index the repository work?"},"tool":"get_answer"}},"response_budget":{"limit_chars":24000,"serialized_chars":4391,"tier":"default"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","timing_ms":11.19},"answer":"## What \u201cindexing\u201d means here\n\nThe retrieved code describes the **read side of an already-created repository index**, rather than the process that parses a repository from scratch. Ingestion writes each repository\u2019s `.repowise/wiki.db`; `RepoIndex` opens that database and exposes convenient lookup APIs over its contents (`packages/core/src/repowise/core/workspace/repo_index.py`).\n\n## Opening an index\n\nFor one repository, callers use:\n\n```python\nawait open_repo_index(alias, repo_path) -> RepoIndex | None\n```\n\n`open_repo_index` opens the repository\u2019s `wiki.db` read side and returns `None` when the repository has not been indexed (`packages/core/src/repowise/core/workspace/repo_index.py`).\n\nFor a workspace, `open_workspace_index(...)` opens the indexed repositories and returns a `WorkspaceIndex`. The workspace object maps repository aliases to `RepoIndex` instances; callers retrieve one with `get(alias)`. Repositories that fail to open are skipped, and an optional alias filter can restrict which repositories are opened.\n\nEach `RepoIndex` owns one database session/connection. The implementation stores:\n\n- the repository alias, path, and `repo_id`;\n- an in-memory index by file (`_by_file`);\n- an in-memory index by symbol name (`_by_name`);\n- external-import records (`_externals`).\n\nIts `_load` method queries `WikiSymbol` rows and graph-edge data from the database. After loading, accessors are pure in-memory reads, so worker-thread dialects can call them without issuing additional database queries. The `repo_id` is required so repository-scoped queries cannot accidentally return unrelated rows.\n\n## Lookup capabilities\n\nThe exposed API supports:\n\n- `symbols_for_file(rel_path)` \u2014 symbols declared in a POSIX, repo-relative file, outermost first;\n- `symbol_at(rel_path, line)` \u2014 symbol covering a line;\n- `declared_symbol_at(...)` \u2014 declaration-specific lookup;\n- `symbol_named(expression)` \u2014 resolve qualified or unqualified symbol expressions;\n- access to external imports and the underlying session.\n\nThe index stores source locations from ingestion. Those spans can become stale if files change afterward, so callers extracting source must bound or validate spans against the current content; `extractors.from_index` provides the related safety behavior. The connection is closed explicitly through `RepoIndex.close()` or `WorkspaceIndex.close()`.","candidates_emitted":0,"candidates_reduced_reason":"confidence_projection_and_deduplication","candidates_total":5,"citations":["packages/core/src/repowise/core/workspace/repo_index.py"],"confidence":"high","fallback_targets_emitted":0,"fallback_targets_reduced_reason":"confidence_projection_and_deduplication","fallback_targets_total":5,"flow_path":["packages/core/src/repowise/core/persistence/crud/repository.py -> packages/core/src/repowise/core/workspace/repo_index.py","packages/server/src/repowise/server/schemas/repository.py -> packages/core/src/repowise/core/ingestion/languages/specs/json.py -> packages/core/src/repowise/core/persistence/crud/repository.py"],"next_action_hint":"Use the answer and citations directly.","note":"High confidence: the top retrieval result clearly dominates, by 0.83 points over the runner-up (top score 5.27). Both scores are strong, so the gap is the measure here and not the ratio. Cite this answer; do not re-read the source unless a specific detail is missing.","quotes":[{"lines":[79,81],"path":"packages/core/src/repowise/core/workspace/repo_index.py","quote":"class RepoIndex:\n \"\"\"Read-only accessor over one repo's ``wiki.db``.\n"}],"quotes_emitted":1,"quotes_reduced_reason":"confidence_projection_and_deduplication","quotes_total":5,"retrieval_quality":"high"},"get_architecture:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":295,"tier":"default"},"runtime_breakage_proven":false},"error":"get_architecture is only available in workspace mode."},"get_blast_radius:one-target":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":295,"tier":"default"},"runtime_breakage_proven":false},"error":"get_blast_radius is only available in workspace mode."},"get_change_risk:head":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#fede8a95b801"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":275},"response_budget":{"limit_chars":24000,"serialized_chars":6116,"tier":"default"},"source":"live_git","state":{"truncated":true},"timing_ms":1412.0},"branch_overlap":{"base":"origin/main","branches":[{"ahead":2,"behind":2,"branch":"perf/mcp-startup-floor","files":[{"basis":"same file","file":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py"},{"basis":"same file","file":"packages/core/src/repowise/core/workspace/__init__.py"},{"basis":"same file","file":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"basis":"same file","file":"tests/unit/workspace/test_lazy_workspace_exports.py"}],"last_commit":"2026-09-09"},{"ahead":12,"behind":2,"branch":"origin/feat/index-freshness-hook","files":[{"basis":"same file","file":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"basis":"co-change pair, 3 of 6 commits","file":"packages/server/src/repowise/server/mcp_server/_meta.py","partner":"packages/core/src/repowise/core/workspace/__init__.py"}],"last_commit":"2026-09-09"}],"current":"fix/mcp-budget-accounting","scanned":50,"summary":"2 of 50 open branches (1068 exist) edit files this change also edits.","total":1068,"truncated":true},"change_shape":{"classification":"Typical","diagnostics_via":"get_change_risk(include=['diagnostics'])","fallback_band":null,"independent_changes":{"basis":"no import, call, type reference or co-change pair in the index links one group to another","count":3,"groups":[{"bridging_files":[],"files":["packages/cli/src/repowise/cli/commands/mcp_cmd.py"]},{"bridging_files":[],"files":["packages/cli/src/repowise/cli/editor_integrations/claude_config.py"]},{"bridging_files":[],"files":["packages/core/src/repowise/core/workspace/__init__.py"]}],"summary":"This diff is 3 independent changes: 1 file, 1 file and 1 file. 1 changed file is left out of the grouping: docs, config, tests, files not in the index, or files it has never linked.","ungrouped_files":["tests/unit/workspace/test_lazy_workspace_exports.py"]},"is_fix":false,"measures":"diff size and spread, not danger","review_priority":"moderate","risk_percentile":40.9,"score":8.2},"classification":"Typical","directive":{"headline":"No supported new findings surfaced in the analyzed scope.","next_actions":["Run: tests/unit/workspace/test_lazy_workspace_exports.py tests/unit/cli/test_agent_target_baseline.py tests/unit/cli/test_agent_targets.py"],"reasons":[],"status":"clear_in_analyzed_scope"},"exclude_patterns":[],"fallback_band":null,"fix_history":{"available":true,"density":0.768,"files":[{"churn":9,"fix_pressure":4.35,"path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py"},{"churn":5,"fix_pressure":1.94,"path":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"churn":226,"fix_pressure":0.88,"path":"packages/core/src/repowise/core/workspace/__init__.py"}],"percentile":21.2},"health_delta":{"analyzer":{"analyzer_version":10,"performance_model_version":2,"rules_fingerprint":"3e9c9fe763b725f9bb1d493656de4afd4ee75e189f42c98e96b0e4233630fe47"},"base":{"kind":"commit","ref":"HEAD^","sha":"7791e6401fa9da72b285bd224a6cf3257121e3da"},"basis":"both_sides_analyzed","by_dimension":{},"by_severity":{},"explanation":"No supported new findings surfaced in the analyzed scope.","findings_emitted":0,"findings_total":0,"head":{"kind":"commit","ref":"HEAD","sha":"920d1c973d647a5df41165225dae38b514b03ae1"},"introduced":0,"limits":["Both sides are analysed over the changed files only, so cross-file detectors (duplication, cross-function performance) see no wider context."],"resolved":1,"scope":{"analyzed":4,"changed":4,"eligible":4,"failed":0,"skipped":0},"status":"available","top_findings":[],"worsened":0},"impacted_tests":{"basis":"inferred","line_coverage":{"covered":[],"no_coverage_data":[],"stale_test_candidates":[],"untested_changes":[]},"map_present":false,"status":"inferred","summary":"29 test file(s) reach the changed files in the graph; showing first 10. Inferred from the dependency graph, not measured. For the line-precise answer build the map with `coverage run --contexts=test` then `repowise coverage add`.","tests_to_run":["tests/unit/workspace/test_lazy_workspace_exports.py","tests/unit/cli/test_agent_target_baseline.py","tests/unit/cli/test_agent_targets.py","tests/unit/cli/test_commands.py","tests/unit/cli/test_doctor_embed_recipe.py","tests/unit/cli/test_doctor_fts_drift.py","tests/unit/cli/test_doctor_honours_exclusions.py","tests/unit/cli/test_doctor_information_floor.py","tests/unit/cli/test_doctor_mcp_smoke.py","tests/unit/cli/test_doctor_page_cap.py"],"total":29,"truncated":true},"is_fix":false,"omission_marker":"[repowise#fede8a95b801: 25 lines omitted (~275 tokens); restore: repowise expand fede8a95b801]","prior_fixes":{"changed_lines_in_fixed_files":98,"concentration":"packages/core/src/repowise/core/workspace/__init__.py carries 50% of the changed lines and 1 past bug fix(es).","files":[{"changed_lines":4,"file_path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py","fix_count":5,"last_fix_days_ago":32,"overlapping_lines":0,"share_of_change":0.022},{"changed_lines":4,"file_path":"packages/cli/src/repowise/cli/commands/mcp_cmd.py","fix_count":2,"last_fix_days_ago":3,"overlapping_lines":0,"share_of_change":0.022},{"changed_lines":90,"file_path":"packages/core/src/repowise/core/workspace/__init__.py","fix_count":1,"last_fix_days_ago":68,"overlapping_lines":0,"share_of_change":0.5}],"files_with_fixes":3,"line_overlap":"approximate","summary":"8 past bug-fix commit(s) touched 3 of the changed file(s). Line overlap is approximate (past ranges are numbered on their own parent commit); the per-file counts are not.","total_fixes":8,"truncated":false},"ref":"HEAD","review_priority":"moderate","risk_percentile":40.9,"score":8.2,"working_tree":false},"get_conformance:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":294,"tier":"default"},"runtime_breakage_proven":false},"error":"get_conformance is only available in workspace mode."},"get_context:many-targets":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#6c9c3e123777"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":4507},"replaced_tokens":48638,"response_budget":{"limit_chars":32000,"serialized_chars":14278,"tier":"expanded"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","state":{"truncated":true},"timing_ms":62.24,"tokens_saved":45004},"dropped_symbols":{},"dropped_targets":[],"targets":{"packages/cli/src/repowise/cli/commands/update_cmd/command.py":{"_call_graph_note":"File-level rollup: importing files plus inbound cross-file call counts. For symbol-precise callers pass 'file.py::Symbol'.","architectural_layer":{"description":"Contains the command-line application runtime, command definitions, platform clients, agent targets, helpers, and telemetry handling.","name":"Contributor 15","role":"edge_connector"},"callers":[{"file":"tests/integration/test_cli.py","imports":true,"inbound_calls":2},{"file":"tests/unit/cli/test_update_reindex_notice.py","imports":true,"inbound_calls":2},{"file":"tests/unit/cli/test_update_renderer_gate.py","imports":true,"inbound_calls":2},{"file":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/workspace.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/watch_cmd.py","imports":true,"inbound_calls":1},{"file":"tests/unit/cli/test_update_full_dry_run.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/__init__.py","imports":true},{"file":"tests/unit/cli/test_docs_pointer.py","imports":true},{"file":"tests/unit/cli/test_editor_setup.py","imports":true},{"file":"tests/unit/cli/test_update_up_to_date_lock.py","imports":true},{"file":"tests/unit/cli/test_workspace_docs_pointer.py","imports":true}],"docs":{"summary":"`repowise update` \u2014 incremental wiki regeneration for changed files.","title":"File: packages/cli/src/repowise/cli/commands/update_cmd/command.py"},"episodes":26,"fix_history":{"bug_magnet":true,"fix_count":27,"last_fix_days_ago":1},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"14.2.2","target_path":"packages/cli/src/repowise/cli/commands/health_cmd","title":"Code Health Commands"},"path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","skeleton":{"bodies_kept":["run_update","_current_renderer_fingerprint","_renderer_inputs","_surface_reindex_recommendation","_docs_provider_prompt_allowed"],"full_tokens":23489,"mode":"smart","pct_of_full":8.9,"text":"\"\"\"``repowise update`` \u2014 incremental wiki regeneration for changed files.\n\nThis module holds the Click command + single-repo orchestration. The standalone\nhelpers it relies on live in sibling modules: mode resolution (:mod:`.mode`),\ncore delegators (:mod:`.incremental`), persistence + re-score\n(:mod:`.persistence`), the workspace flow (:mod:`.workspace`), and report\nrendering (:mod:`.reporting`).\n\"\"\"\nfrom __future__ import annotations\nimport sys\nimport time\nfrom enum import StrEnum\nfrom pathlib import Path\nfrom typing import Any\nimport click\nimport structlog\nfrom repowise.cli._setup import configure_cli_logging\nfrom repowise.cli.helpers import (\n ... 19 lines (23-41)\nfrom repowise.core.docs_mode import docs_mode_state_fields, resolve_docs_mode\nfrom repowise.core.pipeline import PhaseTimings, timed\nfrom repowise.core.reasoning import REASONING_MODES\nfrom .incremental import (\n ... 8 lines (47-54)\nfrom .mode import _resolve_index_only_mode\nfrom .persistence import (\n ... 6 lines (57-62)\nfrom .reporting import (\n ... 7 lines (64-70)\nfrom .workspace import _workspace_update\nlog = structlog.get_logger(__name__)\n... 6 lines (74-79)\n_EFFICACY_LOOKBACK_SECONDS = 7 * 86400.0\n\n\ndef _docs_provider_prompt_allowed(emitter: Any) -> bool:\n \"\"\"Whether a docs run may block on an interactive provider prompt.\n\n Requires a real terminal on *both* ends: a terminal stdout (so the table\n renders) and a tty stdin (so the answer can actually be read). The stdin\n check is what keeps a background post-commit hook or CI run from hanging\n even when it inherits a ``FORCE_COLOR`` that makes ``console.is_terminal``\n report True. ``--progress json`` (emitter set) is always non-interactive.\n \"\"\"\n return console.is_terminal and sys.stdin.isatty() and emitter is None\n\n\ndef _record_update_outcome(\n *,\n index_only: bool,\n changed_count: int,\n provider: Any = None,\n generated_pages: list | None = None,\n docs_mode: str | None = None,\n) -> None:\n \"\"\"Attach an anonymous update-shape outcome to the ``command_run`` event.\n... 30 lines (104-133)\n\n\ndef _refresh_editor_stamp(\n repo_path: Any, agents_md: bool | None, degraded: list[str] | None = None\n) -> None:\n \"\"\"Re-stamp managed editor files (CLAUDE.md / AGENTS.md), best-effort.\n... 21 lines (140-160)\n\n\ndef _surface_release_news(*, written_by: str | None) -> None:\n \"\"\"Show a post-upgrade \"what's new\" panel and a cached PyPI advisory.\n... 23 lines (165-187)\n\n\ndef _surface_reindex_recommendation(repo_path, verdict, *, emitter: Any, dry_run: bool) -> None:\n \"\"\"Show the once-per-store reindex recommendation for *verdict*, if any.\n\n Read-only except for the shown-notice ledger, so it is safe to call on the\n no-op (\"already up to date\") path as well as the main assessment path. It\n never runs the verdict's auto actions \u2014 those stay behind the single-flight\n lock in the main path. Interactive-terminal only, so a background post-commit\n update never burns the one-shot into a log the user never reads; `doctor`\n reports the recommendation on demand regardless.\n \"\"\"\n from repowise.cli.upgrade import (\n record_reindex_notice_shown,\n reindex_notice_already_shown,\n )\n\n if not (verdict.reindex_recommended and verdict.reindex_command):\n return\n ... 139 lines (207-345)\ndef update_command(\n ... 49 lines (347-395)\n\n\nclass UpdateOutcome(StrEnum):\n \"\"\"What a single-repo :func:`run_update` actually did.\n... 11 lines (400-410)\n\n\ndef _render_full_upgrade_dry_run(\n repo_path: Path,\n *,\n provider_name: str | None,\n model: str | None,\n) -> None:\n \"\"\"Describe a full upgrade without resolving providers or touching the store.\"\"\"\n ... 20 lines (420-439)\n\n\ndef _renderer_inputs(repo_path):\n \"\"\"The (language, style fingerprint, style template dir) a file page uses.\n\n Read from the persisted config so the fingerprint computed at the \"up to\n date\" gate matches the one the pages actually store. A wrong triple here\n would make every page look stale on every run (or none ever), so all three\n come from the same place generation reads them. The template dir is a\n custom style's own ``templates/`` (``None`` for a built-in style), tried\n ahead of the shipped template exactly as the generator's Jinja loader does.\n \"\"\"\n from repowise.cli.helpers import load_config\n from repowise.core.generation.styles import resolve_style\n\n cfg = load_config(repo_path)\n style = resolve_style(cfg.get(\"wiki_style\", \"comprehensive\"), repo_path=repo_path)\n return cfg.get(\"language\", \"en\"), style.fingerprint, style.template_dir\n\n\ndef _head_commit_ts(repo_path) -> float | None:\n \"\"\"Committer timestamp of the repo's HEAD, or None when git is unavailable.\n... 9 lines (462-470)\n\n\ndef _current_renderer_fingerprint(repo_path) -> str:\n \"\"\"This release's fingerprint for the structural renderers, or '' on failure.\n\n Covers every template with no model path behind it, because this value is\n what decides whether a repository with no new commits is \"already up to\n date\". Fingerprinting only the file page meant a release that improved the\n spotlight template alone returned before doing anything, and the change\n never reached an existing wiki.\n\n Cheap: reads the templates and a few constants, no parse. An empty result\n disables the renderer-staleness gate for this run rather than risking a\n spurious full re-render, which is the safe direction.\n \"\"\"\n try:\n from repowise.core.generation.page_generator.structural import (\n FILE_PAGE_TEMPLATE,\n SYMBOL_SPOTLIGHT_TEMPLATE,\n structural_fingerprint,\n )\n\n language, style_fp, template_dir = _renderer_inputs(repo_path)\n return \":\".join(\n structural_fingerprint(\n template,\n language=language,\n style_fingerprint=style_fp,\n template_dir=template_dir,\n ... 6 lines (500-505)\n\n\ndef _stale_renderer_paths(repo_path, parsed_files) -> list[str]:\n \"\"\"File paths whose stored pages predate the current structural renderers.\n... 37 lines (510-546)\n\n\ndef run_update(\n path: str | None,\n provider_name: str | None,\n model: str | None,\n since: str | None,\n reasoning: str | None,\n cascade_budget: int | None,\n dry_run: bool,\n workspace: bool,\n no_workspace: bool,\n repo_alias: str | None,\n index_only: bool = False,\n docs_flag: bool | None = None,\n full: bool = False,\n yes: bool = False,\n agents_md: bool | None = None,\n concurrency: int = 10,\n no_cost_tracking: bool = False,\n verbose: bool = False,\n progress: str = \"rich\",\n skip_cross_repo_hooks: bool = False,\n include_working_tree: bool = False,\n) -> UpdateOutcome:\n \"\"\"Incrementally update wiki pages for files changed since last sync.\n\n If `since` is None, the base commit is read from state.json's last_sync_commit.\n\n ``skip_cross_repo_hooks`` is set only by the workspace docs flow, which\n calls this per repo and then runs the cross-repo hooks once over every\n updated repo instead of once per repo.\n\n ``include_working_tree`` folds uncommitted work (staged, unstaged and\n untracked) into the change set on top of the commit range. Off by default,\n because every other caller is anchored to a commit \u2014 the post-commit hook,\n a webhook, a manual sync \u2014 and indexing a half-finished edit under those is\n not what the user asked for. ``repowise watch`` sets it: watching for file\n saves and then only ever diffing commit-to-commit is what made the watcher\n a no-op until you committed.\n \"\"\"\n start = time.monotonic()\n # Per-stage wall clock for this run, written to ``state.json`` as\n # ``phase_timings`` by the paths that rebuild the index. ``run`` is the\n # denominator; stages nest and overlap, so compare each against it and\n # never against their sum. The fast paths (already up to date, no changed\n # files, config-only re-score) do not record: they do no stage work and\n # would overwrite the last real run's numbers with nothing.\n timings = PhaseTimings()\n timings.start(\"run\")\n\n # --- Machine-readable progress (--progress json) --------------------\n # Silence structlog/stdlib logging and redirect the shared Rich console\n ... 1530 lines (600-2129)\n","tokens":2095,"verified":true},"target":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","type":"file"},"packages/core/src/repowise/core/ingestion/call_resolver.py":{"_call_graph_note":"File-level rollup: importing files plus inbound cross-file call counts. For symbol-precise callers pass 'file.py::Symbol'.","architectural_layer":{"description":"Implements repository ingestion, language parsing, code analysis, health evaluation, domain modeling, and supporting application utilities across the codebase.","name":"Contributor 4","role":"edge_connector"},"callers":[{"file":"tests/unit/ingestion/test_return_type_chain_resolution.py","imports":true,"inbound_calls":20},{"file":"tests/unit/ingestion/test_bare_name_index_kinds.py","imports":true,"inbound_calls":4},{"file":"tests/unit/ingestion/test_call_resolver_strategies.py","imports":true,"inbound_calls":3},{"file":"packages/core/src/repowise/core/ingestion/graph/_resolvers.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_elixir_bare_name_scope.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_enclosing_class_calls.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_jvm_calls.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_overload_set_uniqueness.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_php_luau_receivers.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_resolver_merged_index.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_self_call_resolution.py","imports":true,"inbound_calls":2}],"docs":{"summary":"Three-tier call resolution engine for the symbol-level dependency graph.","title":"File: packages/core/src/repowise/core/ingestion/call_resolver.py"},"episodes":21,"fix_history":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"17.4","target_path":"packages/core/src/repowise/core/ingestion","title":"Ingestion Overview"},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","skeleton":{"bodies_kept":[],"full_tokens":25149,"mode":"smart","omitted":true,"pct_of_full":17.9,"text":"[repowise#6c9c3e123777: 508 lines omitted (~4507 tokens); restore: repowise expand 6c9c3e123777]","tokens":4507,"verified":true},"target":"packages/core/src/repowise/core/ingestion/call_resolver.py","type":"file"}},"truncated":true},"get_context:one-file":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","response_budget":{"limit_chars":24000,"serialized_chars":11328,"tier":"default"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","timing_ms":22.87},"targets":{"packages/core/src/repowise/core/ingestion/call_resolver.py":{"architectural_layer":{"description":"Implements repository ingestion, language parsing, code analysis, health evaluation, domain modeling, and supporting application utilities across the codebase.","name":"Contributor 4","role":"edge_connector"},"docs":{"summary":"Three-tier call resolution engine for the symbol-level dependency graph.","symbols":[{"kind":"variable","line":64,"name":"log","signature":"log = structlog.get_logger(__name__)","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::log"},{"kind":"constant","line":69,"name":"_IMPLICIT_RECEIVER_LANGUAGES","signature":"_IMPLICIT_RECEIVER_LANGUAGES = frozenset({\"java\", \"csharp\", \"cpp\", \"kotlin\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_IMPLICIT_RECEIVER_LANGUAGES"},{"kind":"constant","line":87,"name":"_INHERITED_LANGUAGES","signature":"_INHERITED_LANGUAGES = frozenset({\"kotlin\", \"python\", \"typescript\", \"swift\", \"csharp\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_INHERITED_LANGUAGES"},{"kind":"constant","line":103,"name":"_MAX_ANCESTOR_EXPAND_DEPTH","signature":"_MAX_ANCESTOR_EXPAND_DEPTH = 3","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_MAX_ANCESTOR_EXPAND_DEPTH"},{"kind":"class","line":107,"name":"_LanguageCallStrategies","signature":"class _LanguageCallStrategies","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_LanguageCallStrategies"},{"kind":"constant","line":122,"name":"_NO_LANGUAGE_STRATEGIES","signature":"_NO_LANGUAGE_STRATEGIES = _LanguageCallStrategies()","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_NO_LANGUAGE_STRATEGIES"},{"kind":"constant","line":124,"name":"_TYPED_RECEIVER","signature":"_TYPED_RECEIVER = (\"_resolve_typed_receiver\",)","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_TYPED_RECEIVER"},{"kind":"constant","line":129,"name":"_TYPE_KINDS","signature":"_TYPE_KINDS = frozenset({\"class\", \"struct\", \"interface\", \"enum\", \"trait\", \"impl\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_TYPE_KINDS"},{"kind":"constant","line":130,"name":"_FUNCTION_KINDS","signature":"_FUNCTION_KINDS = frozenset({\"function\", \"method\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_FUNCTION_KINDS"},{"kind":"constant","line":148,"name":"_NON_CALLABLE_KINDS","signature":"_NON_CALLABLE_KINDS = frozenset({\"property\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_NON_CALLABLE_KINDS"},{"kind":"constant","line":163,"name":"_JVM_STRATEGIES","signature":"_JVM_STRATEGIES = _LanguageCallStrategies(","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_JVM_STRATEGIES"},{"kind":"constant","line":173,"name":"_CPP_STRATEGIES","signature":"_CPP_STRATEGIES = _LanguageCallStrategies(","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_CPP_STRATEGIES"},{"kind":"constant","line":180,"name":"_LANGUAGE_CALL_STRATEGIES","signature":"_LANGUAGE_CALL_STRATEGIES: dict[str, _LanguageCallStrategies] = {","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_LANGUAGE_CALL_STRATEGIES"},{"kind":"constant","line":212,"name":"_SOURCE_CACHE_FILES","signature":"_SOURCE_CACHE_FILES = 4","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_SOURCE_CACHE_FILES"},{"kind":"constant","line":213,"name":"_BODY_TYPE_CACHE_ENTRIES","signature":"_BODY_TYPE_CACHE_ENTRIES = 2048","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_BODY_TYPE_CACHE_ENTRIES"},{"kind":"constant","line":217,"name":"PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES","signature":"PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES: frozenset[str] = frozenset({\"cpp\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES"},{"kind":"class","line":221,"name":"ResolvedCall","signature":"class ResolvedCall","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::ResolvedCall"},{"kind":"class","line":247,"name":"CallResolver","signature":"class CallResolver","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver"},{"kind":"method","line":260,"name":"__init__","signature":"def __init__( self, parsed_files: dict[str, ParsedFile], import_targets: dict[str, set[str]], *, repo_path: str | None = None, import_maps: Any | None = None, heritage_parents: dict[str, set[str]] | None = None, return_type_chain_languages: frozenset[str] | None = None, ) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::__init__"},{"kind":"method","line":409,"name":"_follow_barrel_exports","signature":"def _follow_barrel_exports(self) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_follow_barrel_exports"},{"kind":"method","line":511,"name":"_get_rust_crate_src","signature":"def _get_rust_crate_src(self) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_rust_crate_src"},{"kind":"method","line":533,"name":"_get_go_index","signature":"def _get_go_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_go_index"},{"kind":"method","line":562,"name":"_strategies_for","signature":"def _strategies_for(self, file_path: str) -> _LanguageCallStrategies","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_strategies_for"},{"kind":"method","line":568,"name":"_get_cpp_index","signature":"def _get_cpp_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_cpp_index"},{"kind":"method","line":640,"name":"_resolve_cpp_same_target","signature":"def _resolve_cpp_same_target( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_cpp_same_target"},{"kind":"method","line":663,"name":"_get_jvm_index","signature":"def _get_jvm_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_jvm_index"},{"kind":"method","line":684,"name":"_resolve_jvm_same_package","signature":"def _resolve_jvm_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_jvm_same_package"},{"kind":"method","line":744,"name":"_resolve_jvm_receiver_same_package","signature":"def _resolve_jvm_receiver_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_jvm_receiver_same_package"},{"kind":"method","line":767,"name":"_resolve_go_package_call","signature":"def _resolve_go_package_call( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_go_package_call"},{"kind":"method","line":796,"name":"_resolve_go_same_package","signature":"def _resolve_go_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_go_same_package"},{"kind":"method","line":824,"name":"_build_indices","signature":"def _build_indices(self, parsed_files: dict[str, ParsedFile]) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_build_indices"},{"kind":"method","line":879,"name":"_link_declarations","signature":"def _link_declarations( self, declarations: list[tuple[str, str, tuple[str | None, str]]], definitions: dict[tuple[str | None, str], list[tuple[str, str]]], ) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_link_declarations"},{"kind":"method","line":930,"name":"declaration_definitions","signature":"def declaration_definitions(self) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::declaration_definitions"},{"kind":"method","line":939,"name":"_redirect_to_definition","signature":"def _redirect_to_definition(self, resolved: ResolvedCall) -> ResolvedCall","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_redirect_to_definition"},{"kind":"method","line":961,"name":"_published","signature":"def _published(self, file_path: str, name: str) -> str | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_published"},{"kind":"method","line":978,"name":"_merged_symbols_for","signature":"def _merged_symbols_for(self, file_path: str) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_merged_symbols_for"},{"kind":"method","line":1017,"name":"_merged_methods_for","signature":"def _merged_methods_for(self, file_path: str) -> dict[tuple[str, str], str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_merged_methods_for"},{"kind":"method","line":1030,"name":"resolve_file","signature":"def resolve_file(self, file_path: str, calls: list[CallSite]) -> list[ResolvedCall]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::resolve_file"},{"kind":"method","line":1052,"name":"_resolve_one","signature":"def _resolve_one(self, file_path: str, call: CallSite) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_one"},{"kind":"method","line":1083,"name":"_resolve_return_typed_chain","signature":"def _resolve_return_typed_chain( self, file_path: str, call: CallSite, caller_id: str, language: str, ) -> tuple[bool, ResolvedCall | None]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_return_typed_chain"}],"symbols_truncated":{"hint":"Call with compact=False or include=['full_doc'] for the full list.","shown":40,"total":89},"title":"File: packages/core/src/repowise/core/ingestion/call_resolver.py"},"episodes":21,"fix_history":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"17.4","target_path":"packages/core/src/repowise/core/ingestion","title":"Ingestion Overview"},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","target":"packages/core/src/repowise/core/ingestion/call_resolver.py","type":"file"}}},"get_dead_code:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#b20f4f25756c"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":4031},"response_budget":{"limit_chars":24000,"serialized_chars":13223,"tier":"default"},"state":{"truncated":true}},"impact":{"recommendation":"Start with the 'high' tier \u2014 these have no references in the graph and are the strongest cleanup candidates. Confirm each (runtime-loaded config/bootstrap/database files are flagged but never auto-marked safe), then review 'medium' tier with your team.","safe_lines_reclaimable":0,"total_lines_reclaimable":2013},"omission_marker":"[repowise#b20f4f25756c: 35 lines omitted (~4031 tokens); restore: repowise expand b20f4f25756c]","summary":{"by_kind":{"unreachable_file":25,"unused_export":27,"unused_internal":508},"call_resolution_basis":[{"guessed_share":0.0,"language":"javascript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":2,"unresolved_call_sites":null},{"guessed_share":0.03,"language":"python","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":49295,"unresolved_call_sites":null},{"guessed_share":0.04,"language":"typescript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":5364,"unresolved_call_sites":null}],"deletable_lines":0,"filtered_findings":52,"safe_to_delete_count":1,"total_findings":560},"tiers":{"high":{"count":1,"description":"High confidence (>=0.8): No references found in the codebase. Strong cleanup candidates \u2014 review (especially runtime-loaded files) before deleting.","findings":[{"age_days":100,"commit_count_90d":0,"confidence":0.8,"end_line":null,"file_path":"packages/core/src/repowise/core/analysis/decision_gate.py","id":"finding_a6c9a04ac7c39bae9231","kind":"unreachable_file","last_commit_at":"2026-05-27T10:27:47","last_meaningful_change":"2026-05-27T10:27:47+00:00","lines":0,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":true,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":0,"safe_count":1,"truncated":false},"low":{"count":51,"description":"Low confidence (<0.5): Potentially used via dynamic imports or reflection. Investigate first.","findings":[{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_readme_hero.py","id":"finding_0f040cd55166f823bccf","kind":"unreachable_file","last_commit_at":"2026-08-12T15:52:24","last_meaningful_change":"2026-08-12T15:52:24+00:00","lines":350,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_plugin_content.py","id":"finding_29369eff6365a1b0293f","kind":"unreachable_file","last_commit_at":"2026-08-12T14:19:38","last_meaningful_change":"2026-08-12T14:19:38+00:00","lines":190,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_agent_matrix.py","id":"finding_4e063ba4bc6f9980ff00","kind":"unreachable_file","last_commit_at":"2026-08-24T11:59:28","last_meaningful_change":"2026-08-24T11:59:28+00:00","lines":180,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":18,"commit_count_90d":4,"confidence":0.4,"end_line":352,"file_path":"packages/server/src/repowise/server/mcp_server/_graph_utils.py","id":"finding_7866e0a83040cdca646e","kind":"unused_export","last_commit_at":"2026-09-04T06:25:06","last_meaningful_change":"2026-09-04T06:25:06+00:00","lines":138,"primary_owner":"Contributor 19","reason":"Public symbol 'build_visual_context' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":214,"symbol_kind":"function","symbol_name":"build_visual_context"},{"age_days":4,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/generate_http_types.py","id":"finding_c1cedf34ddebe7d261cb","kind":"unreachable_file","last_commit_at":"2026-08-31T03:51:20","last_meaningful_change":"2026-08-31T03:51:20+00:00","lines":130,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":87,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/ui/scripts/contrast-check.py","id":"finding_1b9b8063b93def0ff331","kind":"unreachable_file","last_commit_at":"2026-06-08T15:01:45","last_meaningful_change":"2026-06-08T15:01:45+00:00","lines":120,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":21,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/uninstall_cmd.py","id":"finding_4d056697ef3263430455","kind":"unreachable_file","last_commit_at":"2026-08-13T06:48:25","last_meaningful_change":"2026-08-13T06:48:25+00:00","lines":100,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":13,"commit_count_90d":4,"confidence":0.4,"end_line":117,"file_path":"packages/server/src/repowise/server/mcp_server/tool_refactoring.py","id":"finding_4368b4710bdc7ab05fcc","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Public symbol 'generate_refactoring_code' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":31,"symbol_kind":"function","symbol_name":"generate_refactoring_code"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_3393e63b818004f15f8d","kind":"unreachable_file","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":3,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/measure_mcp_response_sizes.py","id":"finding_16a533bd7dba51d593b6","kind":"unreachable_file","last_commit_at":"2026-08-31T09:13:01","last_meaningful_change":"2026-08-31T09:13:01+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":100,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_63e9ee35b2c0edb37176","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Public symbol 'get_architecture' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":32,"symbol_kind":"function","symbol_name":"get_architecture"},{"age_days":73,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/telemetry_cmd.py","id":"finding_f6e27d31e8b93df85fd9","kind":"unreachable_file","last_commit_at":"2026-06-22T11:35:27","last_meaningful_change":"2026-06-22T11:35:27+00:00","lines":50,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":24,"commit_count_90d":2,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/ui/result_panels.py","id":"finding_2f1914812c29533dd062","kind":"unreachable_file","last_commit_at":"2026-08-14T17:16:16","last_meaningful_change":"2026-08-14T17:16:16+00:00","lines":50,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":63,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"packages/vscode/src/extension.ts","id":"finding_e900c8cb8978cb1bd8ee","kind":"unreachable_file","last_commit_at":"2026-07-04T17:35:07","last_meaningful_change":"2026-07-04T17:35:07+00:00","lines":40,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":102,"commit_count_90d":0,"confidence":0.4,"end_line":null,"file_path":"scripts/benchmark_upgrade.py","id":"finding_2a035f9742fa48fd2731","kind":"unreachable_file","last_commit_at":"2026-05-24T06:00:26","last_meaningful_change":"2026-05-24T06:00:26+00:00","lines":40,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":3,"confidence":0.4,"end_line":103,"file_path":"packages/server/src/repowise/server/mcp_server/tool_repos.py","id":"finding_9849407bdffedca12fbb","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":35,"primary_owner":"joptimus","reason":"Public symbol 'list_repos' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":68,"symbol_kind":"function","symbol_name":"list_repos"},{"age_days":10,"commit_count_90d":3,"confidence":0.4,"end_line":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_repos.py","id":"finding_237d674ac8ed2dae134d","kind":"unreachable_file","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":30,"primary_owner":"joptimus","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":57,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_fda1711f7fc7dbcba35e","kind":"unused_export","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":22,"primary_owner":"Contributor 19","reason":"Public symbol 'useC4DocsPathSet' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":35,"symbol_kind":"function","symbol_name":"useC4DocsPathSet"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":87,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_f0e29b2242ddf3a75783","kind":"unused_export","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":22,"primary_owner":"Contributor 19","reason":"Public symbol 'useC4SelectionContext' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":65,"symbol_kind":"function","symbol_name":"useC4SelectionContext"},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_de52d15beb2b3cbcbf97","kind":"unreachable_file","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":20,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":2013,"safe_count":0,"truncated":true},"medium":{"count":0,"description":"Medium confidence (0.5-0.8): Likely unused but may have indirect references. Review before deleting.","findings":[],"lines":0,"safe_count":0,"truncated":false}}},"get_dead_code:limit-200":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":36,"total":50},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#1ee5d92d3242","repowise#31ab8534db9e"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":69631},"reductions":[],"response_budget":{"limit_chars":24000,"serialized_chars":22533,"tier":"default"},"state":{"truncated":true}},"limit_note":"Requested limit=200 exceeded the MCP transport budget and was clamped to 25. Use tier/directory/owner filters or paginate to see more findings.","omission_marker":"[repowise#31ab8534db9e: 299 lines omitted (~2233 tokens); restore: repowise expand 31ab8534db9e]","summary":{"by_kind":{"unreachable_file":25,"unused_export":27,"unused_internal":508},"call_resolution_basis":[{"guessed_share":0.0,"language":"javascript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":2,"unresolved_call_sites":null},{"guessed_share":0.03,"language":"python","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":49295,"unresolved_call_sites":null},{"guessed_share":0.04,"language":"typescript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":5364,"unresolved_call_sites":null}],"deletable_lines":0,"filtered_findings":560,"safe_to_delete_count":1,"total_findings":560},"tiers":{"high":{"count":1,"description":"High confidence (>=0.8): No references found in the codebase. Strong cleanup candidates \u2014 review (especially runtime-loaded files) before deleting.","findings":[{"age_days":100,"commit_count_90d":0,"confidence":0.8,"end_line":null,"file_path":"packages/core/src/repowise/core/analysis/decision_gate.py","id":"finding_a6c9a04ac7c39bae9231","kind":"unreachable_file","last_commit_at":"2026-05-27T10:27:47","last_meaningful_change":"2026-05-27T10:27:47+00:00","lines":0,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":true,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":0,"safe_count":1,"truncated":false},"low":{"count":51,"description":"Low confidence (<0.5): Potentially used via dynamic imports or reflection. Investigate first.","findings":[{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_readme_hero.py","id":"finding_0f040cd55166f823bccf","kind":"unreachable_file","last_commit_at":"2026-08-12T15:52:24","last_meaningful_change":"2026-08-12T15:52:24+00:00","lines":350,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_plugin_content.py","id":"finding_29369eff6365a1b0293f","kind":"unreachable_file","last_commit_at":"2026-08-12T14:19:38","last_meaningful_change":"2026-08-12T14:19:38+00:00","lines":190,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_agent_matrix.py","id":"finding_4e063ba4bc6f9980ff00","kind":"unreachable_file","last_commit_at":"2026-08-24T11:59:28","last_meaningful_change":"2026-08-24T11:59:28+00:00","lines":180,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":18,"commit_count_90d":4,"confidence":0.4,"end_line":352,"file_path":"packages/server/src/repowise/server/mcp_server/_graph_utils.py","id":"finding_7866e0a83040cdca646e","kind":"unused_export","last_commit_at":"2026-09-04T06:25:06","last_meaningful_change":"2026-09-04T06:25:06+00:00","lines":138,"primary_owner":"Contributor 19","reason":"Public symbol 'build_visual_context' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":214,"symbol_kind":"function","symbol_name":"build_visual_context"},{"age_days":4,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/generate_http_types.py","id":"finding_c1cedf34ddebe7d261cb","kind":"unreachable_file","last_commit_at":"2026-08-31T03:51:20","last_meaningful_change":"2026-08-31T03:51:20+00:00","lines":130,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":87,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/ui/scripts/contrast-check.py","id":"finding_1b9b8063b93def0ff331","kind":"unreachable_file","last_commit_at":"2026-06-08T15:01:45","last_meaningful_change":"2026-06-08T15:01:45+00:00","lines":120,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":21,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/uninstall_cmd.py","id":"finding_4d056697ef3263430455","kind":"unreachable_file","last_commit_at":"2026-08-13T06:48:25","last_meaningful_change":"2026-08-13T06:48:25+00:00","lines":100,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":13,"commit_count_90d":4,"confidence":0.4,"end_line":117,"file_path":"packages/server/src/repowise/server/mcp_server/tool_refactoring.py","id":"finding_4368b4710bdc7ab05fcc","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Public symbol 'generate_refactoring_code' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":31,"symbol_kind":"function","symbol_name":"generate_refactoring_code"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_3393e63b818004f15f8d","kind":"unreachable_file","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":3,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/measure_mcp_response_sizes.py","id":"finding_16a533bd7dba51d593b6","kind":"unreachable_file","last_commit_at":"2026-08-31T09:13:01","last_meaningful_change":"2026-08-31T09:13:01+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":100,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_63e9ee35b2c0edb37176","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Public symbol 'get_architecture' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":32,"symbol_kind":"function","symbol_name":"get_architecture"},{"age_days":73,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/telemetry_cmd.py","id":"finding_f6e27d31e8b93df85fd9","kind":"unreachable_file","last_commit_at":"2026-06-22T11:35:27","last_meaningful_change":"2026-06-22T11:35:27+00:00","lines":50,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null}],"findings_emitted":12,"findings_omitted":13,"findings_reduced_reason":"response_budget","findings_total":25,"findings_truncated":true,"lines":2013,"safe_count":0,"truncated":true},"medium":{"count":508,"description":"Medium confidence (0.5-0.8): Likely unused but may have indirect references. Review before deleting.","findings":[{"age_days":19,"commit_count_90d":1,"confidence":0.65,"end_line":224,"file_path":"packages/vscode/webview/src/views/settings/App.tsx","id":"finding_b075fd8305a7974411b7","kind":"unused_internal","last_commit_at":"2026-08-15T04:52:49","last_meaningful_change":"2026-08-15T04:52:49+00:00","lines":175,"primary_owner":"Contributor 19","reason":"Private symbol 'GROUPS' is not used anywhere","repository":"default","risk_factors":["config"],"safe_to_delete":false,"start_line":49,"symbol_kind":"constant","symbol_name":"GROUPS"},{"age_days":21,"commit_count_90d":4,"confidence":0.65,"end_line":638,"file_path":"packages/core/src/repowise/core/generation/onboarding/subkinds/key_concepts.py","id":"finding_be86c5b82740d8059283","kind":"unused_internal","last_commit_at":"2026-08-17T08:07:51","last_meaningful_change":"2026-08-17T08:07:51+00:00","lines":159,"primary_owner":"Contributor 19","reason":"Private symbol '_build' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":479,"symbol_kind":"function","symbol_name":"_build"},{"age_days":101,"commit_count_90d":2,"confidence":0.65,"end_line":173,"file_path":"packages/ui/src/c4/nodes/LayerClusterNode.tsx","id":"finding_c6ddde3060cf14ca3310","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":147,"primary_owner":"Contributor 22","reason":"Private symbol 'LayerClusterNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":26,"symbol_kind":"function","symbol_name":"LayerClusterNodeImpl"},{"age_days":22,"commit_count_90d":3,"confidence":0.65,"end_line":589,"file_path":"packages/core/src/repowise/core/ingestion/sfc_source.py","id":"finding_27b06007ec3b456791b8","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":144,"primary_owner":"Contributor 19","reason":"Private symbol '_razor_byte_scan' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":445,"symbol_kind":"function","symbol_name":"_razor_byte_scan"},{"age_days":101,"commit_count_90d":1,"confidence":0.65,"end_line":148,"file_path":"packages/ui/src/c4/nodes/ArchFileNode.tsx","id":"finding_7897e8b0e5b192dc04f3","kind":"unused_internal","last_commit_at":"2026-06-06T13:25:45","last_meaningful_change":"2026-06-06T13:25:45+00:00","lines":125,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchFileNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":23,"symbol_kind":"function","symbol_name":"ArchFileNodeImpl"},{"age_days":22,"commit_count_90d":3,"confidence":0.65,"end_line":484,"file_path":"packages/core/src/repowise/core/persistence/database.py","id":"finding_f8da2bf875ed65e153ee","kind":"unused_internal","last_commit_at":"2026-09-05T13:30:40","last_meaningful_change":"2026-09-05T13:30:40+00:00","lines":118,"primary_owner":"Contributor 19","reason":"Private symbol '_reconcile_schema' is not used anywhere","repository":"default","risk_factors":["database"],"safe_to_delete":false,"start_line":366,"symbol_kind":"function","symbol_name":"_reconcile_schema"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":508,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_97db30e3d8a29e1f728f","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":96,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_c_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":412,"symbol_kind":"function","symbol_name":"_resolve_c_type_refs"},{"age_days":101,"commit_count_90d":2,"confidence":0.65,"end_line":115,"file_path":"packages/ui/src/c4/nodes/ArchContainerNode.tsx","id":"finding_4cf23634a04a6a87e7f8","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":95,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchContainerNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":20,"symbol_kind":"function","symbol_name":"ArchContainerNodeImpl"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":638,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_3494eba7bab882eb59ec","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":91,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_ts_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":547,"symbol_kind":"function","symbol_name":"_resolve_ts_type_refs"},{"age_days":19,"commit_count_90d":1,"confidence":0.65,"end_line":151,"file_path":"packages/core/src/repowise/core/generation/onboarding/subkinds/active_landscape.py","id":"finding_de7b2aff5fc207d79981","kind":"unused_internal","last_commit_at":"2026-08-15T09:40:34","last_meaningful_change":"2026-08-15T09:40:34+00:00","lines":87,"primary_owner":"Contributor 19","reason":"Private symbol '_build' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":64,"symbol_kind":"function","symbol_name":"_build"},{"age_days":101,"commit_count_90d":1,"confidence":0.65,"end_line":142,"file_path":"packages/ui/src/graph-primitives/edge-renderer.tsx","id":"finding_eade40e87507df4bdae7","kind":"unused_internal","last_commit_at":"2026-06-06T13:25:45","last_meaningful_change":"2026-06-06T13:25:45+00:00","lines":87,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchEdgeRendererImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":55,"symbol_kind":"function","symbol_name":"ArchEdgeRendererImpl"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1208,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_798475db14d41278d3f8","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Private symbol '_ts_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":1122,"symbol_kind":"function","symbol_name":"_ts_head_type_identifier"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":366,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_0320a6bd2eeb4c7b9686","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":83,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_go_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":283,"symbol_kind":"function","symbol_name":"_resolve_go_type_refs"},{"age_days":76,"commit_count_90d":1,"confidence":0.65,"end_line":94,"file_path":"packages/ui/src/workspace/system-map/system-map-edge.tsx","id":"finding_cde5d1605847ffe10cd1","kind":"unused_internal","last_commit_at":"2026-06-19T07:53:16","last_meaningful_change":"2026-06-19T07:53:16+00:00","lines":74,"primary_owner":"Contributor 19","reason":"Private symbol 'SystemMapEdgeInner' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":20,"symbol_kind":"function","symbol_name":"SystemMapEdgeInner"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":213,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_a72b31224fbeb674507a","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":72,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_dockerfile' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":141,"symbol_kind":"function","symbol_name":"_parse_dockerfile"},{"age_days":109,"commit_count_90d":2,"confidence":0.65,"end_line":90,"file_path":"packages/ui/src/c4/edges/RelationEdge.tsx","id":"finding_d11a1aeaa4becb88db2c","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":72,"primary_owner":"Contributor 19","reason":"Private symbol 'RelationEdgeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":18,"symbol_kind":"function","symbol_name":"RelationEdgeImpl"},{"age_days":9,"commit_count_90d":4,"confidence":0.65,"end_line":831,"file_path":"packages/server/src/repowise/server/job_executor.py","id":"finding_ea3a8bb0f7e7024be0d4","kind":"unused_internal","last_commit_at":"2026-09-07T11:41:26","last_meaningful_change":"2026-09-07T11:41:26+00:00","lines":71,"primary_owner":"Contributor 19","reason":"Private symbol '_persist_initial_index_state' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":760,"symbol_kind":"function","symbol_name":"_persist_initial_index_state"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":125,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_4c6222d665b3595e0493","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":70,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_openapi' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":55,"symbol_kind":"function","symbol_name":"_parse_openapi"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":741,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_60313f5eee105a75790e","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_jvm_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":673,"symbol_kind":"function","symbol_name":"_resolve_jvm_type_refs"},{"age_days":20,"commit_count_90d":3,"confidence":0.65,"end_line":112,"file_path":"packages/core/src/repowise/core/ingestion/graph_warmups.py","id":"finding_56627b474c7331f636f9","kind":"unused_internal","last_commit_at":"2026-09-04T13:27:00","last_meaningful_change":"2026-09-04T13:27:00+00:00","lines":62,"primary_owner":"Contributor 19","reason":"Private symbol '_warmup_jvm' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":50,"symbol_kind":"function","symbol_name":"_warmup_jvm"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1060,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_f2ff92755f90a64d9b11","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":62,"primary_owner":"Contributor 19","reason":"Private symbol '_go_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":998,"symbol_kind":"function","symbol_name":"_go_head_type_identifier"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1276,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_391c43bb421d142b8094","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":61,"primary_owner":"Contributor 19","reason":"Private symbol '_java_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":1215,"symbol_kind":"function","symbol_name":"_java_head_type_identifier"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":285,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_f3d3afff206d3be963cf","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":59,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_makefile' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":226,"symbol_kind":"function","symbol_name":"_parse_makefile"},{"age_days":20,"commit_count_90d":3,"confidence":0.65,"end_line":173,"file_path":"packages/core/src/repowise/core/ingestion/graph_warmups.py","id":"finding_d645a649dd73cd608107","kind":"unused_internal","last_commit_at":"2026-09-04T13:27:00","last_meaningful_change":"2026-09-04T13:27:00+00:00","lines":58,"primary_owner":"Contributor 19","reason":"Private symbol '_warmup_cpp' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":115,"symbol_kind":"function","symbol_name":"_warmup_cpp"}],"findings_emitted":24,"findings_omitted":1,"findings_reduced_reason":"response_budget","findings_total":25,"findings_truncated":true,"lines":5444,"safe_count":0,"truncated":true}},"truncated":true},"get_dependency_path:two-files":{"_meta":{"completeness":{"capped":false},"contract_version":1,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":2005,"tier":"default"},"runtime_breakage_proven":false},"distance":-1,"explanation":"No direct dependency path found","path":[],"visual_context":{"bridge_suggestions":[{"node":"external:typing","pagerank":0.02358},{"node":"external:dataclasses","pagerank":0.02038},{"node":"tests/conftest.py","pagerank":0.02011},{"node":"external:pathlib","pagerank":0.01869},{"node":"external:collections.abc","pagerank":0.01618}],"community":{"same_community":false,"source_community":3,"target_community":2},"disconnected":false,"nearest_common_ancestors":[{"distance_from_source":1,"distance_from_target":1,"node":"external:typing"},{"distance_from_source":1,"distance_from_target":1,"node":"external:structlog"},{"distance_from_source":1,"distance_from_target":1,"node":"external:pathlib"},{"distance_from_source":2,"distance_from_target":1,"node":"packages/core/src/repowise/core/docs_mode.py"},{"distance_from_source":2,"distance_from_target":1,"node":"packages/cli/src/repowise/cli/commands/upgrade_flow.py"}],"reverse_path":{"distance":5,"exists":true,"note":"A path exists in the reverse direction (packages/cli/src/repowise/cli/commands/update_cmd/command.py -> packages/core/src/repowise/core/ingestion/call_resolver.py). The dependency flows the other way.","path":["packages/cli/src/repowise/cli/commands/update_cmd/command.py","packages/core/src/repowise/core/ingestion/__init__.py","packages/core/src/repowise/core/ingestion/graph/__init__.py","packages/core/src/repowise/core/ingestion/graph/builder.py","packages/core/src/repowise/core/ingestion/graph/_resolvers.py","packages/core/src/repowise/core/ingestion/call_resolver.py"]},"shared_neighbors":["external:pathlib","external:structlog","external:typing"],"suggestion":"No direct path, but both nodes connect through 'external:typing'. This shared dependency may be the architectural bridge point."}},"get_execution_flows:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","hint":"Use get_context(include=['callers','callees']) on any trace node for detail.","index_age_days":0,"indexed_commit":"920d1c973d64","replaced_tokens":2160,"response_budget":{"limit_chars":24000,"serialized_chars":4969,"tier":"default"},"runtime_breakage_proven":false,"timing_ms":1155.0,"tokens_saved":870},"flows":[{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/vscode/webview/src/views/graph/App.tsx::App","entry_point_name":"App","entry_point_score":0.95,"termination":"no_callees","trace":["packages/vscode/webview/src/views/graph/App.tsx::App","packages/vscode/webview/src/views/graph/App.tsx::CommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::GraphCommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::FactGrid","packages/ui/src/graph/graph-community-panel.tsx::FactValue"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","entry_point_name":"execute","entry_point_score":0.928,"termination":"no_callees","trace":["packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::_announce_total","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_announce_paid"],"trace_via":["self_scope","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/git.py::get_risk_range","entry_point_name":"get_risk_range","entry_point_score":0.843,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/git.py::get_risk_range","packages/server/src/repowise/server/routers/git.py::_revision_exists"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","entry_point_name":"HealthOverviewCard","entry_point_score":0.838,"termination":"no_callees","trace":["packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","packages/ui/src/dashboard/health-overview-card.tsx::AccuracyStrip"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/costs.py::get_distill_savings","entry_point_name":"get_distill_savings","entry_point_score":0.831,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/costs.py::get_distill_savings","packages/server/src/repowise/server/routers/costs.py::_parse_since"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/ownership-table.tsx::OwnershipTable","entry_point_name":"OwnershipTable","entry_point_score":0.83,"termination":"no_callees","trace":["packages/ui/src/git/ownership-table.tsx::OwnershipTable","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","entry_point_name":"DecisionsTimeline","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","entry_point_name":"HotspotsMini","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","packages/ui/src/dashboard/hotspots-mini.tsx::getChurnColor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","entry_point_name":"ModuleMinimap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","entry_point_name":"OwnershipTreemap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]}],"total_entry_points":10},"get_execution_flows:top-100-depth-20":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":45,"total":50},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","hint":"Use get_context(include=['callers','callees']) on any trace node for detail.","index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#54b10477a47c","repowise#94e97218a71a"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":761},"replaced_tokens":6000,"response_budget":{"limit_chars":24000,"serialized_chars":22639,"tier":"default"},"runtime_breakage_proven":false,"state":{"truncated":true},"timing_ms":1286.0,"tokens_saved":102},"flows":[{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/vscode/webview/src/views/graph/App.tsx::App","entry_point_name":"App","entry_point_score":0.95,"termination":"no_callees","trace":["packages/vscode/webview/src/views/graph/App.tsx::App","packages/vscode/webview/src/views/graph/App.tsx::CommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::GraphCommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::FactGrid","packages/ui/src/graph/graph-community-panel.tsx::FactValue"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","entry_point_name":"execute","entry_point_score":0.928,"termination":"no_callees","trace":["packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::_announce_total","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_announce_paid"],"trace_via":["self_scope","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/git.py::get_risk_range","entry_point_name":"get_risk_range","entry_point_score":0.843,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/git.py::get_risk_range","packages/server/src/repowise/server/routers/git.py::_revision_exists"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","entry_point_name":"HealthOverviewCard","entry_point_score":0.838,"termination":"no_callees","trace":["packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","packages/ui/src/dashboard/health-overview-card.tsx::AccuracyStrip"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/costs.py::get_distill_savings","entry_point_name":"get_distill_savings","entry_point_score":0.831,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/costs.py::get_distill_savings","packages/server/src/repowise/server/routers/costs.py::_parse_since"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/ownership-table.tsx::OwnershipTable","entry_point_name":"OwnershipTable","entry_point_score":0.83,"termination":"no_callees","trace":["packages/ui/src/git/ownership-table.tsx::OwnershipTable","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","entry_point_name":"DecisionsTimeline","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","entry_point_name":"HotspotsMini","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","packages/ui/src/dashboard/hotspots-mini.tsx::getChurnColor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","entry_point_name":"ModuleMinimap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","entry_point_name":"OwnershipTreemap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/graph/community.py::get_community_detail","entry_point_name":"get_community_detail","entry_point_score":0.825,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/graph/community.py::get_community_detail","packages/server/src/repowise/server/mcp_server/_graph_utils.py::community_cohesion","packages/server/src/repowise/server/mcp_server/_graph_utils.py::parse_community_meta"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/health/kpi-cards.tsx::HealthKpiCards","entry_point_name":"HealthKpiCards","entry_point_score":0.821,"termination":"no_callees","trace":["packages/ui/src/health/kpi-cards.tsx::HealthKpiCards","packages/ui/src/health/kpi-cards.tsx::InlineStat","packages/ui/src/health/sparkline.tsx::Sparkline"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":0,"entry_point":"packages/ui/src/health/ai-prompt-builder.ts::buildGalaxyMapAiPrompt","entry_point_name":"buildGalaxyMapAiPrompt","entry_point_score":0.821,"termination":"no_callees","trace":["packages/ui/src/health/ai-prompt-builder.ts::buildGalaxyMapAiPrompt"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/modules.py::get_module_health","entry_point_name":"get_module_health","entry_point_score":0.821,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/modules.py::get_module_health","packages/server/src/repowise/server/routers/modules.py::_decision_refs","packages/server/src/repowise/server/schemas/ownership.py::GoverningDecisionRef"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_plan_page","entry_point_name":"get_refactoring_plan_page","entry_point_score":0.821,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_plan_page","packages/server/src/repowise/server/routers/refactoring.py::RefactoringPlanPageResponse"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_mermaid","entry_point_name":"get_c4_mermaid","entry_point_score":0.816,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_mermaid","packages/server/src/repowise/server/services/c4_builder/mermaid.py::to_mermaid_l1","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_emit_externals","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_external_line","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_ext_kind"],"trace_via":["import_scoped","same_file","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_workspace_graph","entry_point_name":"get_workspace_graph","entry_point_score":0.816,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_workspace_graph","packages/server/src/repowise/server/routers/workspace.py::_query_repo_stats","packages/core/src/repowise/core/docs_mode.py::resolve_docs_mode"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/commits-mini.tsx::CommitsMini","entry_point_name":"CommitsMini","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/commits-mini.tsx::CommitsMini","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/module-overview-grid.tsx::ModuleOverviewGrid","entry_point_name":"ModuleOverviewGrid","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-overview-grid.tsx::ModuleOverviewGrid","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/savings-mini.tsx::SavingsMini","entry_point_name":"SavingsMini","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/savings-mini.tsx::SavingsMini","packages/ui/src/lib/format.ts::formatCost"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/contributors-strip.tsx::ContributorsStrip","entry_point_name":"ContributorsStrip","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/git/contributors-strip.tsx::ContributorsStrip","packages/ui/src/git/contributors-strip.tsx::firstName"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/graph/graph-context-drawer.tsx::GraphContextDrawer","entry_point_name":"GraphContextDrawer","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/graph/graph-context-drawer.tsx::GraphContextDrawer","packages/ui/src/graph/node-badges.tsx::NodeBadges","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l1","entry_point_name":"get_c4_l1","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l1","packages/server/src/repowise/server/routers/c4.py::_person","packages/server/src/repowise/server/schemas/c4.py::C4PersonResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l3","entry_point_name":"get_c4_l3","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l3","packages/server/src/repowise/server/routers/c4.py::_component","packages/server/src/repowise/server/schemas/c4.py::C4ComponentResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/decisions.py::get_decision_graph","entry_point_name":"get_decision_graph","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/decisions.py::get_decision_graph","packages/server/src/repowise/server/schemas/decisions.py::DecisionCodeEdge"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/cli/src/repowise/cli/commands/init_cmd/command.py::init_command","entry_point_name":"init_command","entry_point_score":0.809,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/init_cmd/command.py::init_command","packages/cli/src/repowise/cli/commands/init_cmd/command.py::_print_structural_plan","packages/cli/src/repowise/cli/commands/init_cmd/generation.py::page_type_label"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/graph/centrality-leaderboard.tsx::CentralityLeaderboard","entry_point_name":"CentralityLeaderboard","entry_point_score":0.807,"termination":"no_callees","trace":["packages/ui/src/graph/centrality-leaderboard.tsx::CentralityLeaderboard","packages/ui/src/graph/centrality-leaderboard.tsx::score"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/cli/src/repowise/cli/commands/health_cmd/command.py::health_command","entry_point_name":"health_command","entry_point_score":0.805,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/health_cmd/command.py::health_command","packages/cli/src/repowise/cli/_setup.py::configure_cli_logging"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/vscode/webview/src/views/decisions/App.tsx::App","entry_point_name":"App","entry_point_score":0.805,"termination":"confidence_filtered","termination_detail":{"global_unique":1},"trace":["packages/vscode/webview/src/views/decisions/App.tsx::App","packages/vscode/webview/src/views/decisions/App.tsx::DecisionsSkeleton"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/web/src/app/repos/[id]/overview/page.tsx::OverviewPage","entry_point_name":"OverviewPage","entry_point_score":0.804,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/overview/page.tsx::OverviewPage","packages/web/src/app/repos/[id]/overview/page.tsx::safeFetch"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/web/src/app/repos/[id]/costs/page.tsx::CostsPage","entry_point_name":"CostsPage","entry_point_score":0.803,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/costs/page.tsx::CostsPage","packages/api-client/src/costs.ts::getCostSummary","packages/api-client/src/client.ts::apiGet","packages/api-client/src/client.ts::buildHeaders","packages/api-client/src/client.ts::resolveToken"],"trace_via":["import_scoped","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/vscode/src/extension.ts::activate","entry_point_name":"activate","entry_point_score":0.802,"termination":"confidence_filtered","termination_detail":{"global_unique":1},"trace":["packages/vscode/src/extension.ts::activate","packages/vscode/src/extension.ts::checkSetup"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l2","entry_point_name":"get_c4_l2","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l2","packages/server/src/repowise/server/routers/c4.py::_container","packages/server/src/repowise/server/schemas/c4.py::C4ContainerResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/knowledge_map.py::get_knowledge_map","entry_point_name":"get_knowledge_map","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/knowledge_map.py::get_knowledge_map","packages/server/src/repowise/server/schemas/ownership.py::KnowledgeMapOwner"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_targets","entry_point_name":"get_refactoring_targets","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_targets","packages/server/src/repowise/server/routers/refactoring.py::RefactoringSummary"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/server/src/repowise/server/routers/repos.py::create_repo","entry_point_name":"create_repo","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/repos.py::create_repo","packages/server/src/repowise/server/routers/repos.py::_enqueue_index_job","packages/server/src/repowise/server/routers/repos.py::_launch_job_task","packages/server/src/repowise/server/routers/repos.py::_resolve_repo_session_factory","packages/server/src/repowise/server/deps.py::resolve_session_factory"],"trace_via":["same_file","same_file","same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_workspace","entry_point_name":"get_workspace","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_workspace","packages/server/src/repowise/server/routers/workspace.py::_query_repo_stats","packages/core/src/repowise/core/docs_mode.py::resolve_docs_mode"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":3,"entry_point":"packages/server/src/repowise/server/routers/graph/intelligence.py::get_execution_flows","entry_point_name":"get_execution_flows","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/graph/intelligence.py::get_execution_flows","packages/server/src/repowise/server/mcp_server/_graph_utils.py::bfs_trace","packages/server/src/repowise/server/mcp_server/_graph_utils.py::_node_id_is_excluded","packages/core/src/repowise/core/analysis/execution_graph.py::is_excluded_execution_path"],"trace_via":["import_scoped","same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_contract_detail","entry_point_name":"get_contract_detail","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_contract_detail","packages/server/src/repowise/server/routers/workspace.py::_contract_entry","packages/server/src/repowise/server/schemas/workspace.py::WorkspaceContractEntry"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/cli/src/repowise/cli/commands/saved_cmd.py::saved_command","entry_point_name":"saved_command","entry_point_score":0.799,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/saved_cmd.py::saved_command","packages/cli/src/repowise/cli/commands/saved_cmd.py::_estimate_usd","packages/core/src/repowise/core/generation/cost_tracker.py::get_model_pricing","packages/core/src/repowise/core/generation/cost_tracker.py::_get_pricing","packages/core/src/repowise/core/generation/cost_tracker.py::_family_pricing"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/web/src/app/repos/[id]/code-health/page.tsx::CodeHealthPage","entry_point_name":"CodeHealthPage","entry_point_score":0.799,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/code-health/page.tsx::CodeHealthPage","packages/web/src/app/repos/[id]/code-health/page.tsx::ViewSelect","packages/ui/src/ui/select.tsx::Select"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/cli/src/repowise/cli/commands/dead_code_cmd.py::dead_code_command","entry_point_name":"dead_code_command","entry_point_score":0.798,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/dead_code_cmd.py::dead_code_command","packages/cli/src/repowise/cli/helpers.py::load_state","packages/cli/src/repowise/cli/helpers.py::get_repowise_dir"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/cli/src/repowise/cli/commands/restyle_cmd.py::restyle_command","entry_point_name":"restyle_command","entry_point_score":0.798,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/restyle_cmd.py::restyle_command","packages/cli/src/repowise/cli/commands/restyle_cmd.py::_print_styles","packages/core/src/repowise/core/generation/styles/registry.py::list_styles","packages/core/src/repowise/core/generation/styles/registry.py::_load_custom_style","packages/core/src/repowise/core/generation/styles/registry.py::_clip"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/web/src/app/repos/[id]/refactoring/page.tsx::RefactoringPage","entry_point_name":"RefactoringPage","entry_point_score":0.797,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/refactoring/page.tsx::RefactoringPage","packages/web/src/app/repos/[id]/refactoring/page.tsx::leadTypeFor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/vscode/webview/src/views/risk/App.tsx::App","entry_point_name":"App","entry_point_score":0.797,"termination":"no_callees","trace":["packages/vscode/webview/src/views/risk/App.tsx::App","packages/vscode/webview/src/views/risk/App.tsx::ChangeImpact","packages/vscode/webview/src/views/risk/App.tsx::DirectRiskRow"],"trace_via":["same_file","same_file"]}],"flows_emitted":45,"flows_omitted":5,"flows_reduced_reason":"response_budget","flows_total":50,"flows_truncated":true,"omission_marker":"[repowise#94e97218a71a: 26 lines omitted (~201 tokens); restore: repowise expand 94e97218a71a]","total_entry_points":50,"truncated":true},"get_health:all-includes":{"_meta":{"completeness":{"capped":true,"reason":"collection_cap_and_response_budget","shown":64,"total":4465},"contract_version":1,"embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-09T10:32:48.965510","analyzed_commit":"920d1c973d64","live_verification":{"basis":"unavailable","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-09T10:32:48.965510","health_analyzed_commit":"920d1c973d64","health_semantics":{"percentiles":{"direction":"higher means ranked above more files in the eligible stored population","freshness":"stored analysis; not recomputed by get_health","population":"the eligible repository files used by the stored analysis for that signal","public_raw_scale":"percentile_rank_0_to_100","stored_scale":"ratio_0_to_1"},"weighted_deficit_points":{"denominator":"gap_analysis.weighted_gross_gap_points","direction":"higher means the file contributes more to the eligible population's gross deficit from the Healthy threshold","interpretation":"a deterministic triage weight, not a probability, percentage, normalized score, or guaranteed improvement","numerator":"max(8.0 - file_score, 0.0) * max(nloc, 1)","scale":{"maximum":null,"minimum":0,"normalized":false},"unit":"health_score_points_x_nloc"}},"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#bc0f64f88aed"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":26041},"reductions":[{"emitted":0,"field":"performance_summary.facets.context","reason":"response_budget","total":3},{"emitted":0,"field":"performance_summary.facets.boundary","reason":"response_budget","total":5},{"emitted":0,"field":"performance_summary.facets.confidence","reason":"response_budget","total":1},{"emitted":0,"field":"performance_summary.facets.actionability","reason":"response_budget","total":3},{"emitted":0,"field":"performance_summary.facets.plan_state","reason":"response_budget","total":2}],"response_budget":{"limit_chars":32000,"serialized_chars":20421,"tier":"expanded"},"state":{"truncated":true},"timing_ms":1761.0},"directive":{"fix_first":"packages/server/src/repowise/server/mcp_server/tool_health.py","next_action":"inspect matching plan via plan_via","plan_addresses_reason":true,"plan_via":"get_health(include=['refactoring'], only=['refactoring_plans'])","reason":"Brain Method: get_health is 975 lines, CCN 193, in a file imported by 105 others","recovers_points":15688,"recovers_points_compatibility":{"deprecated":true,"equivalent_value":true,"replacement":"recovers_weighted_deficit_points"},"recovers_weighted_deficit_points":15688,"share_of_repo_gap_pct":1.5,"then":["packages/ui/src/health/ai-prompt-builder.ts","packages/core/src/repowise/core/pipeline/persist.py"],"then_emitted":2,"then_total":2,"watch":{"biomarker":"change_entropy","note":"History-derived. Read it as context; there is nothing here to fix.","reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor"}},"distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"gap_analysis":{"files_below_target":1115,"files_for_half_gap":48,"files_to_reach_target":166,"target_score":8.0,"weighted_gap_points":667877,"weighted_gross_gap_points":1066540},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_health.py","has_test_file":true,"is_test":false,"line_coverage_pct":74.71,"maintainability_score":3.1,"max_ccn":193,"max_nesting":4,"module":"packages/server","nloc":2254,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.04,"share_of_repo_gap_pct":1.5,"total_deduction":8.965,"weighted_deficit":15688},{"branch_coverage_pct":null,"file_path":"packages/ui/src/health/ai-prompt-builder.ts","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":56,"max_nesting":3,"module":"packages/ui","nloc":1911,"performance_score":10.0,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.9,"share_of_repo_gap_pct":1.1,"total_deduction":8.097,"weighted_deficit":11657},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":29,"max_nesting":5,"module":"packages/core","nloc":1570,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.07,"share_of_repo_gap_pct":1.0,"total_deduction":8.928,"weighted_deficit":10880},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_why.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.27,"maintainability_score":3.7,"max_ccn":19,"max_nesting":3,"module":"packages/server","nloc":1695,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.7% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.6,"share_of_repo_gap_pct":1.0,"total_deduction":8.399,"weighted_deficit":10848}],"high_leverage_files_emitted":4,"high_leverage_files_omitted":1111,"high_leverage_files_reduced_reason":"limit_and_response_budget","high_leverage_files_total":1115,"high_leverage_files_truncated":true,"kpis":{"average_health":6.94,"average_health_unweighted":8.35,"average_health_weighting":"nloc","band":"warning","file_count":3793,"history_average":1.43,"hotspot_health":4.35,"maintainability_average":7.94,"performance_analyzed_files":3791,"performance_average":9.73,"performance_coverage_pct":100.0,"performance_covered_files":3787,"performance_findings":974,"performance_findings_density_per_10k_loc":15.45,"performance_skipped_files":4,"performance_unsupported_languages":[["shell",4]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.67,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"mode":"dashboard","omission_marker":"[repowise#bc0f64f88aed: 3475 lines omitted (~26041 tokens); restore: repowise expand bc0f64f88aed]","performance_directive":{"advisory_total":272,"affected_call_sites_total":1,"boundary_kind":"db","execution_context":"production","file_path":"packages/core/src/repowise/core/persistence/crud/external_systems.py","investigate_total":539,"next_action":{"arguments":{"opportunity_id":"perf2_034ee9eced0e382bb3ea"},"tool":"get_health"},"observations_total":1,"opportunities_total":845,"opportunity_id":"perf2_034ee9eced0e382bb3ea","performance_model_version":2,"plan_ready_total":34,"plan_reason":"A stored performance plan addresses this exact opportunity.","plan_state":"available","prerequisites":[],"prerequisites_emitted":0,"prerequisites_total":0,"status":"plan_ready","title":"serial_await_in_loop reaching packages/core/src/repowise/core/persistence/crud/external_systems.py","why_ranked":[{"factor":"boundary_kind","points":4,"value":"db"},{"factor":"multiplier_shape","points":4,"value":"serial_await_in_loop"},{"factor":"execution_context","points":3,"value":"production"}],"why_ranked_emitted":3,"why_ranked_total":3},"performance_opportunities":[{"actionability_reason":"proven_strategy","actionability_state":"plan_ready","affected_call_sites_total":1,"affected_files_total":1,"biomarker_type":"serial_await_in_loop","biomarker_types":["serial_await_in_loop"],"biomarker_types_emitted":1,"biomarker_types_total":1,"boundary_kind":"db","confidence":"high","evidence":[{"biomarker_type":"serial_await_in_loop","file_path":"packages/core/src/repowise/core/persistence/crud/external_systems.py","finding_id":"finding_99ea6677d915fceab5f7","function_name":"reconcile_symbols_for_files","line_end":294,"line_start":294,"path":[],"path_emitted":0,"path_total":0,"provenance":"direct","reason":"a database call is awaited serially in a loop whose iterations carry no data dependence; fan out with gather / Promise.all"}],"evidence_emitted":1,"evidence_total":1,"evidence_truncated":false,"execution_context":"production","facets":{"actionability_confidence":"high","amplification":"per_iteration","change_risk":"contained","exposure":"unknown","leverage":"isolated"},"file_path":"packages/core/src/repowise/core/persistence/crud/external_systems.py","fix":{"rationale":"Dataflow proves that every observed loop carries no cross-iteration dependence.","safety":"proven","strategy":"parallelize_independent_awaits"},"intervention_symbol":null,"observations_total":1,"opportunity_id":"perf2_034ee9eced0e382bb3ea","performance_model_version":2,"plan_id":"1b813b8813c24565bd009be544baaedf","plan_reason":"A stored performance plan addresses this exact opportunity.","plan_reference":"refac2_7606d680b10cc557b5e7","plan_status":"available","prerequisites":[],"prerequisites_emitted":0,"prerequisites_total":0,"provenance":"direct","rank_factors":{"affected_call_sites":2,"boundary_kind":4,"entry_reachability":0,"execution_context":3,"multiplier_shape":4,"provenance":3},"rank_position":0,"rank_score":16,"reliable_entry_reachability":null,"resource_fingerprints":[],"resource_fingerprints_emitted":0,"resource_fingerprints_total":0,"shared_path_suffix":[],"shared_path_suffix_emitted":0,"shared_path_suffix_total":0,"terminal_sink":null,"why_ranked":[{"factor":"boundary_kind","points":4,"value":"db"},{"factor":"multiplier_shape","points":4,"value":"serial_await_in_loop"},{"factor":"execution_context","points":3,"value":"production"}],"why_ranked_emitted":3,"why_ranked_total":3}],"performance_opportunities_emitted":1,"performance_opportunities_omitted":455,"performance_opportunities_reduced_reason":"collection_cap_and_response_budget","performance_opportunities_total":456,"performance_opportunities_truncated":true,"recommendation_lede":{"next_call":"get_health(targets=[], repo=None, include=['performance','refactoring'], limit=3, only=['performance_opportunities','refactoring_plans'], refactoring_view='diversified')","performance_lead":{"affected_call_sites_total":1,"boundary_kind":"db","execution_context":"production","intervention_symbol":null,"opportunity_id":"perf2_034ee9eced0e382bb3ea","rank_score":16},"performance_opportunities_total":456,"performance_plan_id":"refac2_7606d680b10cc557b5e7","performance_plan_reason":"A stored performance plan addresses this exact opportunity.","recommendation_lead":{"benefit":1.452,"cost":1.0,"file_path":"packages/core/src/repowise/core/co_change.py","id":"refac2_d95bd5e229aa99f1bdaf","leverage":5.853,"rank_score":3.618,"refactoring_type":"extract_method","risk":0.75,"target_symbol":"parse_partners"},"refactoring_plans_total":2146},"recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=100)","remaining":1015},"performance_opportunities":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=6, only=['performance_opportunities'], refactoring_view='diversified', cursor=6)","remaining":450},"refactoring_opportunities":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=6, only=['refactoring_opportunities'], refactoring_view='diversified', cursor=6)","remaining":622},"refactoring_plans":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=6, only=['refactoring_plans'], refactoring_view='diversified', cursor=6)","remaining":2140}},"refactoring_directive":{"addresses_primary_problem":true,"confidence":"medium","effort_bucket":"M","fix_first":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","judgment_steps":3,"lead_refactoring_type":"extract_method","mechanical_steps":2,"next_action":{"arguments":{"opportunity_id":"refop2_02242668954622a5d496"},"tool":"get_health"},"opportunities_total":628,"opportunity_id":"refop2_02242668954622a5d496","reason":"complex_method","recovers_health_points":1.5,"status":"available","steps":5},"refactoring_opportunities":[{"addresses_primary_problem":true,"affected_files_total":2,"confidence":"medium","dependents":1,"effort_bucket":"M","evidence_total":1,"file_nloc":738,"file_path":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","judgment_steps":3,"lead_biomarker":"complex_method","lead_refactoring_type":"extract_method","mechanical_steps":2,"opportunity_id":"refop2_02242668954622a5d496","queue_position":0,"rank_factors":{"benefit":7.678,"cost":6.0,"mechanical_share":0.2,"primary_problem":0.5,"risk":1.193},"rank_position":0,"rank_score":1.593,"recoverable_health":1.5,"refactoring_model_version":2,"status":"open","step_count":5,"steps":[{"applicability":{"classification":"judgment","facts":{"affected_file_count":2,"blast_size":2,"callers":1,"confidence":"medium","cross_file":true,"framework_registration":null},"reasons":["changes_symbol_home"],"reasons_emitted":1,"reasons_total":1,"unknowns":["framework_registration"],"unknowns_emitted":1,"unknowns_total":1},"confidence":"medium","effort_bucket":"M","file_path":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","finding_ids":[],"finding_ids_emitted":0,"finding_ids_total":0,"impact_delta":0.0,"line_end":895,"line_start":853,"plan_id":"refac2_6cde1e96425eff562cdc","refactoring_type":"move_method","relocated_by":null,"source_biomarker":"","target_symbol":"HermesTarget._install_user","validation_profile_id":"validation_7930504470d6557f"},{"applicability":{"classification":"judgment","facts":{"affected_file_count":2,"blast_size":2,"callers":1,"confidence":"medium","cross_file":true,"framework_registration":null},"reasons":["changes_symbol_home"],"reasons_emitted":1,"reasons_total":1,"unknowns":["framework_registration"],"unknowns_emitted":1,"unknowns_total":1},"confidence":"medium","effort_bucket":"S","file_path":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","finding_ids":[],"finding_ids_emitted":0,"finding_ids_total":0,"impact_delta":0.0,"line_end":945,"line_start":921,"plan_id":"refac2_065b2171c336d19cf156","refactoring_type":"move_method","relocated_by":"refac2_6cde1e96425eff562cdc","source_biomarker":"","target_symbol":"HermesTarget._install_project","validation_profile_id":"validation_fdd06b95856e574b"},{"applicability":{"classification":"judgment","facts":{"affected_file_count":2,"blast_size":2,"callers":0,"confidence":"high","cross_file":true,"framework_registration":null},"reasons":["changes_symbol_home"],"reasons_emitted":1,"reasons_total":1,"unknowns":["framework_registration"],"unknowns_emitted":1,"unknowns_total":1},"confidence":"high","effort_bucket":"S","file_path":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","finding_ids":[],"finding_ids_emitted":0,"finding_ids_total":0,"impact_delta":0.0,"line_end":968,"line_start":947,"plan_id":"refac2_77f1f6f5c207a1f6e0c3","refactoring_type":"move_method","relocated_by":"refac2_065b2171c336d19cf156","source_biomarker":"","target_symbol":"HermesTarget.uninstall","validation_profile_id":"validation_34374d7940731da7"}],"steps_emitted":3,"steps_reduced_reason":"limit","steps_total":5,"why_ranked":[{"factor":"benefit","value":7.678},{"factor":"cost","value":6.0},{"factor":"risk","value":1.193}],"why_ranked_emitted":3,"why_ranked_total":3}],"refactoring_opportunities_emitted":1,"refactoring_opportunities_omitted":627,"refactoring_opportunities_reduced_reason":"collection_cap_and_response_budget","refactoring_opportunities_total":628,"refactoring_opportunities_truncated":true,"refactoring_plans":[{"benefit":1.452,"blast_radius":{"scope":"local"},"confidence":"high","cost":1.0,"dependents":24,"effort_bucket":"S","evidence":{"ccn_removed":3,"slice_nloc":16},"file_nloc":120,"file_path":"packages/core/src/repowise/core/co_change.py","file_weighted_deficit":193,"id":"refac2_d95bd5e229aa99f1bdaf","impact_delta":1.452,"leverage":5.853,"line_end":154,"line_start":104,"plan":{"params":["out","path","record","weight"],"params_emitted":4,"params_total":4,"returns":[],"returns_emitted":0,"returns_total":0,"span":{"end":152,"start":137},"suggested_name":null},"rank_score":3.618,"refactoring_type":"extract_method","repository":"default","risk":0.75,"source_biomarker":"complex_method","target_symbol":"parse_partners","validation_profile_id":"validation_196eb44587dd5d6d"}],"refactoring_plans_emitted":1,"refactoring_plans_omitted":2145,"refactoring_plans_reduced_reason":"collection_cap_and_response_budget","refactoring_plans_status":{"reason":null,"state":"available"},"refactoring_plans_total":2146,"refactoring_plans_truncated":true,"scope":"all","secondary_rankings":{"modules":{"call":"get_health(repo=None, only=['modules'], limit=50)","total":12},"test_findings":{"call":"get_health(repo=None, only=['test_findings'], limit=50)","total":364},"top_findings":{"call":"get_health(repo=None, only=['top_findings'], limit=50)","total":610},"worst_files":{"call":"get_health(repo=None, only=['worst_files'], limit=50)","total":3793}},"truncated":true,"unknown_include_keys":["files"],"unknown_include_keys_emitted":1,"unknown_include_keys_total":1,"validation_profiles":[{"affected_files":["packages/core/src/repowise/core/co_change.py"],"affected_files_emitted":1,"affected_files_total":1,"affected_symbols":["parse_partners"],"affected_symbols_emitted":1,"affected_symbols_total":1,"basis":"inferred","commands":["pytest tests/integration/test_cli.py tests/integration/test_pipeline_fast_checkpoint.py tests/integration/test_pipeline_resume.py tests/integration/test_upgrade_fast_to_full.py tests/unit/analysis/test_branch_overlap.py tests/unit/analysis/test_independent_changes.py tests/unit/cli/test_augment_decision_inject.py tests/unit/cli/test_augment_session_start.py tests/unit/cli/test_augment_wrong_path.py tests/unit/cli/test_docs_pointer.py tests/unit/cli/test_update_e2e.py tests/unit/cli/test_update_forgets_deleted_files.py"],"commands_emitted":1,"commands_total":1,"id":"validation_196eb44587dd5d6d","targets":[{"basis":"inferred","file_path":"packages/core/src/repowise/core/co_change.py","tests":["tests/integration/test_cli.py","tests/integration/test_pipeline_fast_checkpoint.py","tests/integration/test_pipeline_resume.py","tests/integration/test_upgrade_fast_to_full.py","tests/unit/analysis/test_branch_overlap.py","tests/unit/analysis/test_independent_changes.py","tests/unit/cli/test_augment_decision_inject.py","tests/unit/cli/test_augment_session_start.py","tests/unit/cli/test_augment_wrong_path.py","tests/unit/cli/test_docs_pointer.py","tests/unit/cli/test_update_e2e.py","tests/unit/cli/test_update_forgets_deleted_files.py"],"tests_emitted":12,"tests_total":12,"total":54,"truncated":true,"via":"call-graph"}],"targets_emitted":1,"targets_total":1,"tests":["tests/integration/test_cli.py","tests/integration/test_pipeline_fast_checkpoint.py","tests/integration/test_pipeline_resume.py","tests/integration/test_upgrade_fast_to_full.py","tests/unit/analysis/test_branch_overlap.py","tests/unit/analysis/test_independent_changes.py","tests/unit/cli/test_augment_decision_inject.py","tests/unit/cli/test_augment_session_start.py","tests/unit/cli/test_augment_wrong_path.py","tests/unit/cli/test_docs_pointer.py","tests/unit/cli/test_update_e2e.py","tests/unit/cli/test_update_forgets_deleted_files.py"],"tests_emitted":12,"tests_reduced_reason":"analysis_source_cap","tests_total":54,"total":54,"via":"call-graph"}],"validation_profiles_emitted":1,"validation_profiles_reduced_reason":"response_budget","validation_profiles_total":6},"get_health:default":{"_meta":{"completeness":{"capped":true,"reason":"limit","shown":26,"total":1121},"contract_version":1,"embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-09T10:32:48.965510","analyzed_commit":"920d1c973d64","live_verification":{"basis":"unavailable","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-09T10:32:48.965510","health_analyzed_commit":"920d1c973d64","health_semantics":{"percentiles":{"direction":"higher means ranked above more files in the eligible stored population","freshness":"stored analysis; not recomputed by get_health","population":"the eligible repository files used by the stored analysis for that signal","public_raw_scale":"percentile_rank_0_to_100","stored_scale":"ratio_0_to_1"},"weighted_deficit_points":{"denominator":"gap_analysis.weighted_gross_gap_points","direction":"higher means the file contributes more to the eligible population's gross deficit from the Healthy threshold","interpretation":"a deterministic triage weight, not a probability, percentage, normalized score, or guaranteed improvement","numerator":"max(8.0 - file_score, 0.0) * max(nloc, 1)","scale":{"maximum":null,"minimum":0,"normalized":false},"unit":"health_score_points_x_nloc"}},"index_age_days":0,"indexed_commit":"920d1c973d64","response_budget":{"limit_chars":24000,"serialized_chars":17265,"tier":"default"},"timing_ms":324.1},"directive":{"fix_first":"packages/server/src/repowise/server/mcp_server/tool_health.py","next_action":"inspect matching plan via plan_via","plan_addresses_reason":true,"plan_via":"get_health(include=['refactoring'], only=['refactoring_plans'])","reason":"Brain Method: get_health is 975 lines, CCN 193, in a file imported by 105 others","recovers_points":15688,"recovers_points_compatibility":{"deprecated":true,"equivalent_value":true,"replacement":"recovers_weighted_deficit_points"},"recovers_weighted_deficit_points":15688,"share_of_repo_gap_pct":1.5,"then":["packages/ui/src/health/ai-prompt-builder.ts","packages/core/src/repowise/core/pipeline/persist.py"],"then_emitted":2,"then_total":2,"watch":{"biomarker":"change_entropy","note":"History-derived. Read it as context; there is nothing here to fix.","reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor"}},"distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"gap_analysis":{"files_below_target":1115,"files_for_half_gap":48,"files_to_reach_target":166,"target_score":8.0,"weighted_gap_points":667877,"weighted_gross_gap_points":1066540},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_health.py","has_test_file":true,"is_test":false,"line_coverage_pct":74.71,"maintainability_score":3.1,"max_ccn":193,"max_nesting":4,"module":"packages/server","nloc":2254,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.04,"share_of_repo_gap_pct":1.5,"total_deduction":8.965,"weighted_deficit":15688},{"branch_coverage_pct":null,"file_path":"packages/ui/src/health/ai-prompt-builder.ts","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":56,"max_nesting":3,"module":"packages/ui","nloc":1911,"performance_score":10.0,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.9,"share_of_repo_gap_pct":1.1,"total_deduction":8.097,"weighted_deficit":11657},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":29,"max_nesting":5,"module":"packages/core","nloc":1570,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.07,"share_of_repo_gap_pct":1.0,"total_deduction":8.928,"weighted_deficit":10880},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_why.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.27,"maintainability_score":3.7,"max_ccn":19,"max_nesting":3,"module":"packages/server","nloc":1695,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.7% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.6,"share_of_repo_gap_pct":1.0,"total_deduction":8.399,"weighted_deficit":10848},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/incremental.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.35,"maintainability_score":1.3,"max_ccn":41,"max_nesting":4,"module":"packages/core","nloc":1555,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.06,"share_of_repo_gap_pct":1.0,"total_deduction":8.925,"weighted_deficit":10792},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":69.6,"maintainability_score":1.3,"max_ccn":188,"max_nesting":5,"module":"packages/cli","nloc":1517,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":1.0,"total_deduction":9.574,"weighted_deficit":10619},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_test_file":true,"is_test":false,"line_coverage_pct":92.35,"maintainability_score":3.1,"max_ccn":134,"max_nesting":7,"module":"packages/core","nloc":1650,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.74,"share_of_repo_gap_pct":1.0,"total_deduction":8.252,"weighted_deficit":10329},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":75.35,"maintainability_score":2.4,"max_ccn":140,"max_nesting":4,"module":"packages/cli","nloc":1404,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.9,"total_deduction":9.288,"weighted_deficit":9828},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/call_resolver.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":3.3,"max_ccn":34,"max_nesting":5,"module":"packages/core","nloc":1558,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.81,"share_of_repo_gap_pct":0.9,"total_deduction":8.189,"weighted_deficit":9644},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/workspace_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.45,"maintainability_score":1.3,"max_ccn":29,"max_nesting":4,"module":"packages/cli","nloc":1340,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.9,"total_deduction":9.451,"weighted_deficit":9380},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":73.03,"maintainability_score":3.4,"max_ccn":20,"max_nesting":5,"module":"packages/core","nloc":1330,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.8% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.12,"share_of_repo_gap_pct":0.9,"total_deduction":8.88,"weighted_deficit":9150},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/decisions/extractor.py","has_test_file":true,"is_test":false,"line_coverage_pct":59.51,"maintainability_score":2.2,"max_ccn":24,"max_nesting":6,"module":"packages/core","nloc":1267,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 2.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.8,"total_deduction":9.92,"weighted_deficit":8869},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/kg_curation.py","has_test_file":true,"is_test":false,"line_coverage_pct":93.19,"maintainability_score":2.0,"max_ccn":90,"max_nesting":4,"module":"packages/core","nloc":1411,"performance_score":9.58,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.73,"share_of_repo_gap_pct":0.8,"total_deduction":8.263,"weighted_deficit":8847},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/persistence/crud/decisions.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.39,"maintainability_score":3.7,"max_ccn":73,"max_nesting":4,"module":"packages/core","nloc":1309,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 3.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.25,"share_of_repo_gap_pct":0.8,"total_deduction":8.754,"weighted_deficit":8836},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_answer/symbols.py","has_test_file":true,"is_test":false,"line_coverage_pct":80.2,"maintainability_score":4.0,"max_ccn":44,"max_nesting":5,"module":"packages/server","nloc":1243,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.71,"share_of_repo_gap_pct":0.7,"total_deduction":8.3,"weighted_deficit":7818},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/dead_code/analyzer.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":3.1,"max_ccn":85,"max_nesting":5,"module":"packages/core","nloc":1198,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.71,"share_of_repo_gap_pct":0.7,"total_deduction":8.287,"weighted_deficit":7535},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":78.67,"maintainability_score":2.0,"max_ccn":24,"max_nesting":4,"module":"packages/cli","nloc":1082,"performance_score":9.3,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.15,"share_of_repo_gap_pct":0.7,"total_deduction":8.857,"weighted_deficit":7412},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/routers/repos.py","has_test_file":true,"is_test":false,"line_coverage_pct":30.21,"maintainability_score":1.3,"max_ccn":22,"max_nesting":4,"module":"packages/server","nloc":1047,"performance_score":8.0,"primary_biomarker":"prior_defect","primary_reason":"6 bug-fixes touched this file in the last ~6 months; recent defect history is the strongest cost-effective predictor of further defects","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":12.12,"weighted_deficit":7329},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":1.3,"max_ccn":44,"max_nesting":4,"module":"packages/cli","nloc":1054,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.5% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.11,"share_of_repo_gap_pct":0.7,"total_deduction":8.885,"weighted_deficit":7262},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/job_executor.py","has_test_file":true,"is_test":false,"line_coverage_pct":65.04,"maintainability_score":2.0,"max_ccn":48,"max_nesting":5,"module":"packages/server","nloc":1017,"performance_score":9.79,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":9.39,"weighted_deficit":7119}],"high_leverage_files_emitted":20,"high_leverage_files_reduced_reason":"limit","high_leverage_files_total":1115,"kpis":{"average_health":6.94,"average_health_unweighted":8.35,"average_health_weighting":"nloc","band":"warning","file_count":3793,"history_average":1.43,"hotspot_health":4.35,"maintainability_average":7.94,"performance_analyzed_files":3791,"performance_average":9.73,"performance_coverage_pct":100.0,"performance_covered_files":3787,"performance_findings":974,"performance_findings_density_per_10k_loc":15.45,"performance_skipped_files":4,"performance_unsupported_languages":[["shell",4]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.67,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"mode":"dashboard","performance_directive":{"advisory_total":272,"affected_call_sites_total":1,"boundary_kind":"db","execution_context":"production","file_path":"packages/core/src/repowise/core/persistence/crud/external_systems.py","investigate_total":539,"next_action":{"arguments":{"opportunity_id":"perf2_034ee9eced0e382bb3ea"},"tool":"get_health"},"observations_total":1,"opportunities_total":845,"opportunity_id":"perf2_034ee9eced0e382bb3ea","performance_model_version":2,"plan_ready_total":34,"plan_reason":"A stored performance plan addresses this exact opportunity.","plan_state":"available","prerequisites":[],"prerequisites_emitted":0,"prerequisites_total":0,"status":"plan_ready","title":"serial_await_in_loop reaching packages/core/src/repowise/core/persistence/crud/external_systems.py","why_ranked":[{"factor":"boundary_kind","points":4,"value":"db"},{"factor":"multiplier_shape","points":4,"value":"serial_await_in_loop"},{"factor":"execution_context","points":3,"value":"production"}],"why_ranked_emitted":3,"why_ranked_total":3},"recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=[], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=20)","remaining":1095}},"refactoring_directive":{"addresses_primary_problem":true,"confidence":"medium","effort_bucket":"M","fix_first":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","judgment_steps":3,"lead_refactoring_type":"extract_method","mechanical_steps":2,"next_action":{"arguments":{"opportunity_id":"refop2_02242668954622a5d496"},"tool":"get_health"},"opportunities_total":628,"opportunity_id":"refop2_02242668954622a5d496","reason":"complex_method","recovers_health_points":1.5,"status":"available","steps":5},"scope":"all","secondary_rankings":{"modules":{"call":"get_health(repo=None, only=['modules'], limit=50)","total":12},"test_findings":{"call":"get_health(repo=None, only=['test_findings'], limit=50)","total":3063},"top_findings":{"call":"get_health(repo=None, only=['top_findings'], limit=50)","total":10202},"worst_files":{"call":"get_health(repo=None, only=['worst_files'], limit=50)","total":3793}}},"get_health:limit-100":{"_meta":{"completeness":{"capped":true,"reason":"limit_and_response_budget","shown":35,"total":1121},"contract_version":1,"embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-09T10:32:48.965510","analyzed_commit":"920d1c973d64","live_verification":{"basis":"unavailable","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-09T10:32:48.965510","health_analyzed_commit":"920d1c973d64","health_semantics":{"percentiles":{"direction":"higher means ranked above more files in the eligible stored population","freshness":"stored analysis; not recomputed by get_health","population":"the eligible repository files used by the stored analysis for that signal","public_raw_scale":"percentile_rank_0_to_100","stored_scale":"ratio_0_to_1"},"weighted_deficit_points":{"denominator":"gap_analysis.weighted_gross_gap_points","direction":"higher means the file contributes more to the eligible population's gross deficit from the Healthy threshold","interpretation":"a deterministic triage weight, not a probability, percentage, normalized score, or guaranteed improvement","numerator":"max(8.0 - file_score, 0.0) * max(nloc, 1)","scale":{"maximum":null,"minimum":0,"normalized":false},"unit":"health_score_points_x_nloc"}},"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#d097411d1691","repowise#c561ee268912"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":10963},"reductions":[],"response_budget":{"limit_chars":24000,"serialized_chars":22424,"tier":"default"},"state":{"truncated":true},"timing_ms":487.5},"directive":{"fix_first":"packages/server/src/repowise/server/mcp_server/tool_health.py","next_action":"inspect matching plan via plan_via","plan_addresses_reason":true,"plan_via":"get_health(include=['refactoring'], only=['refactoring_plans'])","reason":"Brain Method: get_health is 975 lines, CCN 193, in a file imported by 105 others","recovers_points":15688,"recovers_points_compatibility":{"deprecated":true,"equivalent_value":true,"replacement":"recovers_weighted_deficit_points"},"recovers_weighted_deficit_points":15688,"share_of_repo_gap_pct":1.5,"then":["packages/ui/src/health/ai-prompt-builder.ts","packages/core/src/repowise/core/pipeline/persist.py"],"then_emitted":2,"then_total":2,"watch":{"biomarker":"change_entropy","note":"History-derived. Read it as context; there is nothing here to fix.","reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor"}},"distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"gap_analysis":{"files_below_target":1115,"files_for_half_gap":48,"files_to_reach_target":166,"target_score":8.0,"weighted_gap_points":667877,"weighted_gross_gap_points":1066540},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_health.py","has_test_file":true,"is_test":false,"line_coverage_pct":74.71,"maintainability_score":3.1,"max_ccn":193,"max_nesting":4,"module":"packages/server","nloc":2254,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.6% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.04,"share_of_repo_gap_pct":1.5,"total_deduction":8.965,"weighted_deficit":15688},{"branch_coverage_pct":null,"file_path":"packages/ui/src/health/ai-prompt-builder.ts","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":56,"max_nesting":3,"module":"packages/ui","nloc":1911,"performance_score":10.0,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.9,"share_of_repo_gap_pct":1.1,"total_deduction":8.097,"weighted_deficit":11657},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":29,"max_nesting":5,"module":"packages/core","nloc":1570,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.07,"share_of_repo_gap_pct":1.0,"total_deduction":8.928,"weighted_deficit":10880},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_why.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.27,"maintainability_score":3.7,"max_ccn":19,"max_nesting":3,"module":"packages/server","nloc":1695,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.7% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.6,"share_of_repo_gap_pct":1.0,"total_deduction":8.399,"weighted_deficit":10848},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/incremental.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.35,"maintainability_score":1.3,"max_ccn":41,"max_nesting":4,"module":"packages/core","nloc":1555,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.06,"share_of_repo_gap_pct":1.0,"total_deduction":8.925,"weighted_deficit":10792},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":69.6,"maintainability_score":1.3,"max_ccn":188,"max_nesting":5,"module":"packages/cli","nloc":1517,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":1.0,"total_deduction":9.574,"weighted_deficit":10619},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_test_file":true,"is_test":false,"line_coverage_pct":92.35,"maintainability_score":3.1,"max_ccn":134,"max_nesting":7,"module":"packages/core","nloc":1650,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.74,"share_of_repo_gap_pct":1.0,"total_deduction":8.252,"weighted_deficit":10329},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":75.35,"maintainability_score":2.4,"max_ccn":140,"max_nesting":4,"module":"packages/cli","nloc":1404,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.9,"total_deduction":9.288,"weighted_deficit":9828},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/call_resolver.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":3.3,"max_ccn":34,"max_nesting":5,"module":"packages/core","nloc":1558,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.81,"share_of_repo_gap_pct":0.9,"total_deduction":8.189,"weighted_deficit":9644},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/workspace_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.45,"maintainability_score":1.3,"max_ccn":29,"max_nesting":4,"module":"packages/cli","nloc":1340,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.9,"total_deduction":9.451,"weighted_deficit":9380},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":73.03,"maintainability_score":3.4,"max_ccn":20,"max_nesting":5,"module":"packages/core","nloc":1330,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.8% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.12,"share_of_repo_gap_pct":0.9,"total_deduction":8.88,"weighted_deficit":9150},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/decisions/extractor.py","has_test_file":true,"is_test":false,"line_coverage_pct":59.51,"maintainability_score":2.2,"max_ccn":24,"max_nesting":6,"module":"packages/core","nloc":1267,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 2.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.8,"total_deduction":9.92,"weighted_deficit":8869},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/kg_curation.py","has_test_file":true,"is_test":false,"line_coverage_pct":93.19,"maintainability_score":2.0,"max_ccn":90,"max_nesting":4,"module":"packages/core","nloc":1411,"performance_score":9.58,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.73,"share_of_repo_gap_pct":0.8,"total_deduction":8.263,"weighted_deficit":8847},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/persistence/crud/decisions.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.39,"maintainability_score":3.7,"max_ccn":73,"max_nesting":4,"module":"packages/core","nloc":1309,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 3.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.25,"share_of_repo_gap_pct":0.8,"total_deduction":8.754,"weighted_deficit":8836},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_answer/symbols.py","has_test_file":true,"is_test":false,"line_coverage_pct":80.2,"maintainability_score":4.0,"max_ccn":44,"max_nesting":5,"module":"packages/server","nloc":1243,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.71,"share_of_repo_gap_pct":0.7,"total_deduction":8.3,"weighted_deficit":7818},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/dead_code/analyzer.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":3.1,"max_ccn":85,"max_nesting":5,"module":"packages/core","nloc":1198,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.2% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.71,"share_of_repo_gap_pct":0.7,"total_deduction":8.287,"weighted_deficit":7535},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":78.67,"maintainability_score":2.0,"max_ccn":24,"max_nesting":4,"module":"packages/cli","nloc":1082,"performance_score":9.3,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.4% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.15,"share_of_repo_gap_pct":0.7,"total_deduction":8.857,"weighted_deficit":7412},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/routers/repos.py","has_test_file":true,"is_test":false,"line_coverage_pct":30.21,"maintainability_score":1.3,"max_ccn":22,"max_nesting":4,"module":"packages/server","nloc":1047,"performance_score":8.0,"primary_biomarker":"prior_defect","primary_reason":"6 bug-fixes touched this file in the last ~6 months; recent defect history is the strongest cost-effective predictor of further defects","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":12.12,"weighted_deficit":7329},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":1.3,"max_ccn":44,"max_nesting":4,"module":"packages/cli","nloc":1054,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.5% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.11,"share_of_repo_gap_pct":0.7,"total_deduction":8.885,"weighted_deficit":7262},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/job_executor.py","has_test_file":true,"is_test":false,"line_coverage_pct":65.04,"maintainability_score":2.0,"max_ccn":48,"max_nesting":5,"module":"packages/server","nloc":1017,"performance_score":9.79,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":9.39,"weighted_deficit":7119},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/traverser.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.54,"maintainability_score":2.8,"max_ccn":21,"max_nesting":5,"module":"packages/core","nloc":1020,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.8% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.66,"share_of_repo_gap_pct":0.6,"total_deduction":8.337,"weighted_deficit":6467},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/engine.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.77,"maintainability_score":1.3,"max_ccn":30,"max_nesting":4,"module":"packages/core","nloc":922,"performance_score":9.58,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.3% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.076,"weighted_deficit":6454},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/decision_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":16.05,"maintainability_score":3.4,"max_ccn":19,"max_nesting":4,"module":"packages/cli","nloc":852,"performance_score":9.3,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":11.8,"weighted_deficit":5964},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/ui/provider_selection.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.2,"maintainability_score":3.1,"max_ccn":22,"max_nesting":4,"module":"packages/cli","nloc":851,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 3.5% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.919,"weighted_deficit":5957},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/hook_cmd.py","has_test_file":false,"is_test":false,"line_coverage_pct":74.29,"maintainability_score":3.3,"max_ccn":26,"max_nesting":4,"module":"packages/cli","nloc":847,"performance_score":8.0,"primary_biomarker":"prior_defect","primary_reason":"7 bug-fixes touched this file in the last ~6 months; recent defect history is the strongest cost-effective predictor of further defects","score":1.12,"share_of_repo_gap_pct":0.5,"total_deduction":8.879,"weighted_deficit":5827},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/workspace/cross_repo.py","has_test_file":true,"is_test":false,"line_coverage_pct":84.36,"maintainability_score":1.3,"max_ccn":33,"max_nesting":7,"module":"packages/core","nloc":832,"performance_score":8.0,"primary_biomarker":"co_change_scatter","primary_reason":"co-changes with 25 distinct files \u2014 editing this file tends to ripple across the codebase (shotgun surgery)","score":1.02,"share_of_repo_gap_pct":0.5,"total_deduction":8.976,"weighted_deficit":5807},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/workspace/update.py","has_test_file":true,"is_test":false,"line_coverage_pct":87.58,"maintainability_score":2.0,"max_ccn":26,"max_nesting":6,"module":"packages/core","nloc":891,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.8% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.5,"share_of_repo_gap_pct":0.5,"total_deduction":8.502,"weighted_deficit":5792},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_overview.py","has_test_file":true,"is_test":false,"line_coverage_pct":90.23,"maintainability_score":3.1,"max_ccn":21,"max_nesting":4,"module":"packages/server","nloc":912,"performance_score":8.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 0.9% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.66,"share_of_repo_gap_pct":0.5,"total_deduction":8.34,"weighted_deficit":5782},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/git_indexer/indexer.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.98,"maintainability_score":2.0,"max_ccn":28,"max_nesting":4,"module":"packages/core","nloc":861,"performance_score":10.0,"primary_biomarker":"change_entropy","primary_reason":"changes are scattered across noisy commits (top 1.6% among files eligible for change-entropy ranking); a strong history-based fault predictor","score":1.44,"share_of_repo_gap_pct":0.5,"total_deduction":8.555,"weighted_deficit":5648}],"high_leverage_files_emitted":29,"high_leverage_files_omitted":1086,"high_leverage_files_reduced_reason":"limit_and_response_budget","high_leverage_files_total":1115,"high_leverage_files_truncated":true,"kpis":{"average_health":6.94,"average_health_unweighted":8.35,"average_health_weighting":"nloc","band":"warning","file_count":3793,"history_average":1.43,"hotspot_health":4.35,"maintainability_average":7.94,"performance_analyzed_files":3791,"performance_average":9.73,"performance_coverage_pct":100.0,"performance_covered_files":3787,"performance_findings":974,"performance_findings_density_per_10k_loc":15.45,"performance_skipped_files":4,"performance_unsupported_languages":[["shell",4]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.67,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"mode":"dashboard","omission_marker":"[repowise#c561ee268912: 25 lines omitted (~176 tokens); restore: repowise expand c561ee268912]","performance_directive":{"advisory_total":272,"affected_call_sites_total":1,"boundary_kind":"db","execution_context":"production","file_path":"packages/core/src/repowise/core/persistence/crud/external_systems.py","investigate_total":539,"next_action":{"arguments":{"opportunity_id":"perf2_034ee9eced0e382bb3ea"},"tool":"get_health"},"observations_total":1,"opportunities_total":845,"opportunity_id":"perf2_034ee9eced0e382bb3ea","performance_model_version":2,"plan_ready_total":34,"plan_reason":"A stored performance plan addresses this exact opportunity.","plan_state":"available","prerequisites":[],"prerequisites_emitted":0,"prerequisites_total":0,"status":"plan_ready","title":"serial_await_in_loop reaching packages/core/src/repowise/core/persistence/crud/external_systems.py","why_ranked":[{"factor":"boundary_kind","points":4,"value":"db"},{"factor":"multiplier_shape","points":4,"value":"serial_await_in_loop"},{"factor":"execution_context","points":3,"value":"production"}],"why_ranked_emitted":3,"why_ranked_total":3},"recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=[], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=100)","remaining":1015}},"refactoring_directive":{"addresses_primary_problem":true,"confidence":"medium","effort_bucket":"M","fix_first":"packages/cli/src/repowise/cli/agent_targets/targets/hermes.py","judgment_steps":3,"lead_refactoring_type":"extract_method","mechanical_steps":2,"next_action":{"arguments":{"opportunity_id":"refop2_02242668954622a5d496"},"tool":"get_health"},"opportunities_total":628,"opportunity_id":"refop2_02242668954622a5d496","reason":"complex_method","recovers_health_points":1.5,"status":"available","steps":5},"scope":"all","truncated":true},"get_overview:all-includes":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#4e8f0bb0e304"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1376},"response_budget":{"limit_chars":32000,"serialized_chars":7934,"tier":"expanded"},"state":{"truncated":true}},"architecture":{"layer_order":["UI","CLI","Application","API","Config","Utility","Data","Types","Service","Docs & Tooling","Test"],"layers":[{"file_count":641,"name":"Contributor 2"},{"file_count":261,"name":"Contributor 6"},{"file_count":191,"name":"Contributor 15"},{"file_count":92,"name":"Contributor 12"},{"file_count":28,"name":"Contributor 10"},{"file_count":52,"name":"Contributor 17"},{"file_count":60,"name":"Contributor 13"},{"file_count":81,"name":"Contributor 18"},{"file_count":981,"name":"Contributor 4"},{"file_count":220,"name":"Contributor 8"},{"file_count":1478,"name":"Contributor 11"}],"tour_available":true,"tour_step_count":12},"code_health":{"average_health":6.94,"band":"warning","distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"file_count":3793,"hotspot_health":4.35,"open_findings":14239,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"content_hint":"Overview essay trimmed to its summary section. Call get_overview(include=[\"content\"]) for the full walkthrough.","content_md":"## Project Summary\n\nRepowise consumes source repositories and configuration files, walks and parses them through language-specific ingestion, persists and analyzes the resulting code graph, and generates documentation, health insights, and interactive views exposed through CLI, MCP/server APIs, web apps, and VS Code.\n\nIt is a Python/TypeScript monorepo organized around a shared analysis engine and several presentation surfaces. The repository contains 3,659 files and approximately 740k lines of code; dependency analysis reports 18 circular dependencies. Recent hotspots include dead-code analysis, MCP answer generation, and the web sidebar.","entry_points":["packages/server/src/repowise/server/app.py","packages/cli/src/repowise/cli/main.py","packages/vscode/webview/src/views/risk/App.tsx","packages/vscode/webview/src/views/decisions/App.tsx","packages/vscode/webview/src/views/settings/App.tsx","packages/vscode/webview/src/views/architecture/App.tsx","packages/vscode/webview/src/views/home/App.tsx","packages/vscode/webview/src/views/refactoring/App.tsx"],"git_health":{"avg_bus_factor":1.2,"churn_trend":"increasing","files_git_attributed":4136,"files_with_bus_factor_1":3339,"hotspot_count":419,"top_churn_modules":["packages/core","tests/unit","packages/ui","packages/server","packages/web"]},"key_modules":[{"name":"Contributor 3","path":"packages/api-client","section":"6"},{"name":"Contributor 14","path":"packages/api-client/src","section":"7"},{"name":"Contributor 5","path":"packages/vscode/src/features","section":"8"},{"name":"Contributor 9","path":"packages/vscode/webview/src/runtime","section":"9"},{"name":"Contributor 7","path":"packages/web","section":"10"},{"name":"Contributor 21","path":"packages/web/src/app/repos/[id]","section":"11"},{"name":"Contributor 1","path":"packages/web/src/app/repos/[id]/docs","section":"11.1"},{"name":"Contributor 16","path":"packages/web/src/app/repos/[id]/settings","section":"11.2"}],"more":"get_overview(include=[...]) also serves: \"outline\" (the wiki page tree), \"tour\" (guided_tour + reading_order), \"decisions\", \"graph\" (code communities), \"ownership\" (top owners, silos), \"content\" (the full essay).","omission_marker":"[repowise#4e8f0bb0e304: 90 lines omitted (~1376 tokens); restore: repowise expand 4e8f0bb0e304]","title":"Repository Overview: repowise","tool_surface":{"counts":{"default":10,"eligible":13,"enabled":10,"opt_in_available":3,"tiers":{"canonical":10}},"enabled":["get_answer","get_context","get_symbol","search_codebase","get_risk","get_change_risk","get_why","get_overview","get_health","get_dead_code"],"mode":"single_repo","opt_in":[{"description":"Find how two files/modules are connected in the dependency graph.","enabled":false,"name":"get_dependency_path"},{"description":"Show how the codebase executes: top entry points and their call traces.","enabled":false,"name":"get_execution_flows"},{"description":"Generate refactored code + a unified diff for one refactoring plan.","enabled":false,"name":"generate_refactoring_code"}],"recipes":[{"call":"get_answer(question=\"how does X work?\")","name":"answer_question"},{"call":"get_context(targets=[\"path\"], include=[\"skeleton\"])","name":"read_file_shape"},{"call":"search_codebase(query=\"identifier or path\", mode=\"auto\")","name":"find_raw_hits"},{"call":"get_risk(targets=[\"path\"])","name":"assess_hotspot"},{"call":"get_risk(targets=[\"path\"], changed_files=[\"path\"])","name":"review_change"},{"call":"get_why(targets=[\"path\"])","name":"read_rationale"},{"call":"get_health(only=[\"directive\"])","name":"health_directive"},{"call":"get_health(targets=[\"path\"], include=[\"refactoring\"])","name":"health_file_self_check"},{"call":"get_health(targets=[\"module:path\"], only=[\"modules\",\"metrics\"])","name":"health_module_triage"},{"call":"get_health(include=[\"trend\"], only=[\"trend\"])","name":"health_trend"},{"call":"get_health(include=[\"accuracy\"], only=[\"accuracy\"])","name":"health_accuracy"},{"call":"get_health(include=[\"coverage\"], only=[\"coverage\"])","name":"health_coverage"},{"call":"get_health(include=[\"performance\",\"refactoring\"], only=[\"performance_opportunities\",\"refactoring_plans\"])","name":"health_performance_refactoring"},{"call":"get_health(include=[\"performance\"], only=[\"performance_summary\"])","name":"health_performance_summary"},{"call":"get_health(opportunity_id=\"perf...\")","name":"health_performance_opportunity"},{"call":"get_health(opportunity_id=\"perf...\", only=[\"performance_evidence\"], cursor=0)","name":"health_performance_evidence"}],"tools":[{"default":true,"description":"Answer a how, where, or why question in one evidence-grounded call.","name":"get_answer","tier":"canonical"},{"default":true,"description":"Triage card for files / modules / symbols \u2014 relationships, not source bytes.","name":"get_context","tier":"canonical"},{"default":true,"description":"Follow-up read of one symbol whose id another response already gave you.","name":"get_symbol","tier":"canonical"},{"default":true,"description":"Find code by concept, symbol, or path \u2014 hybrid codebase search.","name":"search_codebase","tier":"canonical"},{"default":true,"description":"What history says about touching these files \u2014 bug fixes, churn, owners.","name":"get_risk","tier":"canonical"},{"default":true,"description":"Review a commit, ``base..head`` range, or uncommitted work.","name":"get_change_risk","tier":"canonical"},{"default":true,"description":"Why this code is shaped this way \u2014 decision records + evidence commits.","name":"get_why","tier":"canonical"},{"default":true,"description":"Architecture map for an unfamiliar repo \u2014 first call when you don't know your way around.","name":"get_overview","tier":"canonical"},{"default":true,"description":"Code-health scores and findings from stored analysis.","name":"get_health","tier":"canonical"},{"default":true,"description":"Unused exports, unreachable files, zombie packages \u2014 tiered by confidence.","name":"get_dead_code","tier":"canonical"}]}},"get_overview:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#4e8f0bb0e304"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1376},"response_budget":{"limit_chars":24000,"serialized_chars":7933,"tier":"default"},"state":{"truncated":true}},"architecture":{"layer_order":["UI","CLI","Application","API","Config","Utility","Data","Types","Service","Docs & Tooling","Test"],"layers":[{"file_count":641,"name":"Contributor 2"},{"file_count":261,"name":"Contributor 6"},{"file_count":191,"name":"Contributor 15"},{"file_count":92,"name":"Contributor 12"},{"file_count":28,"name":"Contributor 10"},{"file_count":52,"name":"Contributor 17"},{"file_count":60,"name":"Contributor 13"},{"file_count":81,"name":"Contributor 18"},{"file_count":981,"name":"Contributor 4"},{"file_count":220,"name":"Contributor 8"},{"file_count":1478,"name":"Contributor 11"}],"tour_available":true,"tour_step_count":12},"code_health":{"average_health":6.94,"band":"warning","distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"file_count":3793,"hotspot_health":4.35,"open_findings":14239,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"content_hint":"Overview essay trimmed to its summary section. Call get_overview(include=[\"content\"]) for the full walkthrough.","content_md":"## Project Summary\n\nRepowise consumes source repositories and configuration files, walks and parses them through language-specific ingestion, persists and analyzes the resulting code graph, and generates documentation, health insights, and interactive views exposed through CLI, MCP/server APIs, web apps, and VS Code.\n\nIt is a Python/TypeScript monorepo organized around a shared analysis engine and several presentation surfaces. The repository contains 3,659 files and approximately 740k lines of code; dependency analysis reports 18 circular dependencies. Recent hotspots include dead-code analysis, MCP answer generation, and the web sidebar.","entry_points":["packages/server/src/repowise/server/app.py","packages/cli/src/repowise/cli/main.py","packages/vscode/webview/src/views/risk/App.tsx","packages/vscode/webview/src/views/decisions/App.tsx","packages/vscode/webview/src/views/settings/App.tsx","packages/vscode/webview/src/views/architecture/App.tsx","packages/vscode/webview/src/views/home/App.tsx","packages/vscode/webview/src/views/refactoring/App.tsx"],"git_health":{"avg_bus_factor":1.2,"churn_trend":"increasing","files_git_attributed":4136,"files_with_bus_factor_1":3339,"hotspot_count":419,"top_churn_modules":["packages/core","tests/unit","packages/ui","packages/server","packages/web"]},"key_modules":[{"name":"Contributor 3","path":"packages/api-client","section":"6"},{"name":"Contributor 14","path":"packages/api-client/src","section":"7"},{"name":"Contributor 5","path":"packages/vscode/src/features","section":"8"},{"name":"Contributor 9","path":"packages/vscode/webview/src/runtime","section":"9"},{"name":"Contributor 7","path":"packages/web","section":"10"},{"name":"Contributor 21","path":"packages/web/src/app/repos/[id]","section":"11"},{"name":"Contributor 1","path":"packages/web/src/app/repos/[id]/docs","section":"11.1"},{"name":"Contributor 16","path":"packages/web/src/app/repos/[id]/settings","section":"11.2"}],"more":"get_overview(include=[...]) also serves: \"outline\" (the wiki page tree), \"tour\" (guided_tour + reading_order), \"decisions\", \"graph\" (code communities), \"ownership\" (top owners, silos), \"content\" (the full essay).","omission_marker":"[repowise#4e8f0bb0e304: 90 lines omitted (~1376 tokens); restore: repowise expand 4e8f0bb0e304]","title":"Repository Overview: repowise","tool_surface":{"counts":{"default":10,"eligible":13,"enabled":10,"opt_in_available":3,"tiers":{"canonical":10}},"enabled":["get_answer","get_context","get_symbol","search_codebase","get_risk","get_change_risk","get_why","get_overview","get_health","get_dead_code"],"mode":"single_repo","opt_in":[{"description":"Find how two files/modules are connected in the dependency graph.","enabled":false,"name":"get_dependency_path"},{"description":"Show how the codebase executes: top entry points and their call traces.","enabled":false,"name":"get_execution_flows"},{"description":"Generate refactored code + a unified diff for one refactoring plan.","enabled":false,"name":"generate_refactoring_code"}],"recipes":[{"call":"get_answer(question=\"how does X work?\")","name":"answer_question"},{"call":"get_context(targets=[\"path\"], include=[\"skeleton\"])","name":"read_file_shape"},{"call":"search_codebase(query=\"identifier or path\", mode=\"auto\")","name":"find_raw_hits"},{"call":"get_risk(targets=[\"path\"])","name":"assess_hotspot"},{"call":"get_risk(targets=[\"path\"], changed_files=[\"path\"])","name":"review_change"},{"call":"get_why(targets=[\"path\"])","name":"read_rationale"},{"call":"get_health(only=[\"directive\"])","name":"health_directive"},{"call":"get_health(targets=[\"path\"], include=[\"refactoring\"])","name":"health_file_self_check"},{"call":"get_health(targets=[\"module:path\"], only=[\"modules\",\"metrics\"])","name":"health_module_triage"},{"call":"get_health(include=[\"trend\"], only=[\"trend\"])","name":"health_trend"},{"call":"get_health(include=[\"accuracy\"], only=[\"accuracy\"])","name":"health_accuracy"},{"call":"get_health(include=[\"coverage\"], only=[\"coverage\"])","name":"health_coverage"},{"call":"get_health(include=[\"performance\",\"refactoring\"], only=[\"performance_opportunities\",\"refactoring_plans\"])","name":"health_performance_refactoring"},{"call":"get_health(include=[\"performance\"], only=[\"performance_summary\"])","name":"health_performance_summary"},{"call":"get_health(opportunity_id=\"perf...\")","name":"health_performance_opportunity"},{"call":"get_health(opportunity_id=\"perf...\", only=[\"performance_evidence\"], cursor=0)","name":"health_performance_evidence"}],"tools":[{"default":true,"description":"Answer a how, where, or why question in one evidence-grounded call.","name":"get_answer","tier":"canonical"},{"default":true,"description":"Triage card for files / modules / symbols \u2014 relationships, not source bytes.","name":"get_context","tier":"canonical"},{"default":true,"description":"Follow-up read of one symbol whose id another response already gave you.","name":"get_symbol","tier":"canonical"},{"default":true,"description":"Find code by concept, symbol, or path \u2014 hybrid codebase search.","name":"search_codebase","tier":"canonical"},{"default":true,"description":"What history says about touching these files \u2014 bug fixes, churn, owners.","name":"get_risk","tier":"canonical"},{"default":true,"description":"Review a commit, ``base..head`` range, or uncommitted work.","name":"get_change_risk","tier":"canonical"},{"default":true,"description":"Why this code is shaped this way \u2014 decision records + evidence commits.","name":"get_why","tier":"canonical"},{"default":true,"description":"Architecture map for an unfamiliar repo \u2014 first call when you don't know your way around.","name":"get_overview","tier":"canonical"},{"default":true,"description":"Code-health scores and findings from stored analysis.","name":"get_health","tier":"canonical"},{"default":true,"description":"Unused exports, unreachable files, zombie packages \u2014 tiered by confidence.","name":"get_dead_code","tier":"canonical"}]}},"get_risk:one-target":{"_meta":{"completeness":{"capped":true,"reason":"construction_cap","shown":5,"total":25},"contract_version":1,"embedder_degraded":false,"floor":["co_change_partners_total","dependents_count"],"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#160ca2a7eeeb"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1810},"response_budget":{"limit_chars":24000,"serialized_chars":3742,"tier":"default"},"state":{"truncated":true}},"omission_marker":"[repowise#160ca2a7eeeb: 258 lines omitted (~1810 tokens); restore: repowise expand 160ca2a7eeeb]","targets":{"packages/core/src/repowise/core/ingestion/call_resolver.py":{"bus_factor":1,"co_change_partners":[{"direction":"undirected","evidence_kind":"historical","file_path":"tests/unit/ingestion/test_call_resolver_strategies.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-23","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":6,"weight":2.906},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/languages/receiver_types.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-25","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":9,"weight":2.799},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/models.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-30","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":20,"weight":2.578},{"direction":"undirected","evidence_kind":"historical","file_path":"tests/unit/ingestion/test_receiver_types.py","has_import_link":false,"has_structural_link":false,"last_co_change":"2026-08-25","provenance":"git_history","relationship_type":"co_change","support":7,"weight":2.315},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_import_link":false,"has_structural_link":false,"last_co_change":"2026-09-04","provenance":"git_history","relationship_type":"co_change","support":17,"weight":1.567}],"co_change_partners_emitted":5,"co_change_partners_omitted":20,"co_change_partners_reduced_reason":"construction_cap","co_change_partners_total":25,"co_change_partners_truncated":true,"commit_count_capped":false,"contributor_count":3,"coverage_pct":91.47,"defect_profile":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10,"top_symbols":{"__init__":5,"_link_declarations":4,"_published":3},"window":"6 months"},"dependents_count":11,"episodes":21,"health_score":1.81,"hotspot_score":0.9995,"is_hotspot":true,"owner_pct":0.9412,"primary_owner":"Contributor 19","recent_owner":"Contributor 19","recent_owner_pct":0.9412,"risk_summary":"packages/core/src/repowise/core/ingestion/call_resolver.py \u2014 22 bug fixes in 6mo, last 10d ago (bug magnet), hotspot score 100% (increasing), 11 direct dependents, bug-prone, feature-active, 25 co-change partners, owned 94% by Contributor 19, bus factor risk (sole maintainer: Contributor 19)","security_signals":[],"target":"packages/core/src/repowise/core/ingestion/call_resolver.py","test_gap":false,"top_biomarkers":[{"biomarker_type":"change_entropy","function_name":null,"impact":1.18,"severity":"critical"},{"biomarker_type":"co_change_scatter","function_name":null,"impact":0.85,"severity":"high"},{"biomarker_type":"prior_defect","function_name":null,"impact":0.78,"severity":"critical"}],"trend":"increasing"}}},"get_symbol:largest-depth-3":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#63171fe88e36","repowise#bb943f58f05d"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":8087},"replaced_tokens":25149,"response_budget":{"limit_chars":24000,"serialized_chars":22623,"tier":"default"},"state":{"truncated":true},"timing_ms":6.7,"tokens_saved":19480},"continuation":"packages/core/src/repowise/core/ingestion/call_resolver.py:797-2117","continuation_reference":{"id":"packages/core/src/repowise/core/ingestion/call_resolver.py:797-2117","kind":"file_range","path":"packages/core/src/repowise/core/ingestion/call_resolver.py","range":[797,2117],"repository":"default","source_kind":"source","verification_basis":"live"},"end_line":796,"file":"packages/core/src/repowise/core/ingestion/call_resolver.py","kind":"class","name":"CallResolver","omission_marker":"[repowise#bb943f58f05d: 11 lines omitted (~136 tokens); restore: repowise expand bb943f58f05d]","qualified_name":"packages.core.src.repowise.core.ingestion.call_resolver.CallResolver","signature":"class CallResolver","source":" 197\t _JVM_STRATEGIES,\n 198\t free=(\"_resolve_java_same_package_unique\",),\n 199\t member_fallback=_TYPED_RECEIVER,\n 200\t ),\n 201\t \"kotlin\": replace(_JVM_STRATEGIES, member_fallback=_TYPED_RECEIVER),\n 202\t \"csharp\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 203\t \"python\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 204\t # Swift registers the fallback and nothing else: it has no package\n 205\t # tier of its own, so a typed receiver is looked for in the caller's\n 206\t # file, in what the file imports, and then in the global pair index.\n 207\t \"swift\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 208\t \"cpp\": _CPP_STRATEGIES,\n 209\t \"c\": _CPP_STRATEGIES,\n 210\t}\n 211\t\n 212\t_SOURCE_CACHE_FILES = 4\n 213\t_BODY_TYPE_CACHE_ENTRIES = 2048\n 214\t\n 215\t# Phase admission is intentionally explicit. P16 lands the behavior-preserving\n 216\t# substrate with no language enabled; later phases add only measured lanes.\n 217\tPRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES: frozenset[str] = frozenset({\"cpp\"})\n 218\t\n 219\t\n 220\t@dataclass(frozen=True, slots=True)\n 221\tclass ResolvedCall:\n 222\t \"\"\"A call resolved to concrete symbol IDs with a confidence score.\"\"\"\n 223\t\n 224\t caller_id: str # symbol node ID of the calling function/method\n 225\t callee_id: str # symbol node ID of the called function/method\n 226\t confidence: float # 0.0\u20131.0\n 227\t line: int # call site line number (for diagnostics)\n 228\t origin: ResolutionOrigin # which strategy below produced it\n 229\t edge_type: CallSiteEdgeType = \"calls\" # carried through from the CallSite\n 230\t supplied_props: frozenset[str] | None = None # prop names supplied in JSX element (None if unknown/spread)\n 231\t\n 232\t\n 233\tdef _same_translation_unit(decl_file: str, def_file: str) -> bool:\n 234\t \"\"\"Are these two paths the same C++ translation unit?\n 235\t\n 236\t Compared on the base name, because a public header rarely sits beside its\n 237\t implementation (``include/pkg/thing.h`` against ``src/thing.cc``). The\n 238\t include relation would be the better test, but a C++ include binds to the\n 239\t path as written and usually is not a file key.\n 240\t \"\"\"\n 241\t return (\n 242\t decl_file == def_file\n 243\t or PurePosixPath(decl_file).stem == PurePosixPath(def_file).stem\n 244\t )\n 245\t\n 246\t\n 247\tclass CallResolver:\n 248\t \"\"\"Resolve raw CallSites to symbol-level edges.\n 249\t\n 250\t Constructed once per ``GraphBuilder.build()`` call with the full set of\n 251\t parsed files and import edges, then driven one file at a time.\n 252\t\n 253\t ``resolve_file()`` is **not** safe to call concurrently. Several lazy\n 254\t caches are filled during resolution, and the capped ones evict wholesale.\n 255\t Every cached value is a pure function of state fixed at construction, so a\n 256\t race would cost recomputation rather than a wrong answer, but the eviction\n 257\t makes concurrent use pointless as well as unsupported.\n 258\t \"\"\"\n 259\t\n 260\t def __init__(\n 261\t self,\n 262\t parsed_files: dict[str, ParsedFile],\n 263\t import_targets: dict[str, set[str]],\n 264\t *,\n 265\t repo_path: str | None = None,\n 266\t import_maps: Any | None = None,\n 267\t heritage_parents: dict[str, set[str]] | None = None,\n 268\t return_type_chain_languages: frozenset[str] | None = None,\n 269\t ) -> None:\n 270\t # {type symbol id: parent type symbol ids}, from the caller's already\n 271\t # resolved heritage. Absent when the resolver is built standalone, in\n 272\t # which case the inherited tier simply never fires.\n 273\t self._heritage_parents: dict[str, set[str]] = heritage_parents or {}\n 274\t self._return_type_chain_languages = (\n 275\t PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES\n 276\t if return_type_chain_languages is None\n 277\t else return_type_chain_languages\n 278\t )\n 279\t self._ancestors: dict[str, tuple[str, ...]] = {}\n 280\t # Per-file symbol index: {file_path: {symbol_name: symbol_id}}\n 281\t self._file_symbols: dict[str, dict[str, str]] = {}\n 282\t\n 283\t # Per-file method index: {file_path: {(class_name, method_name): symbol_id}}\n 284\t self._file_methods: dict[str, dict[tuple[str, str], str]] = {}\n 285\t\n 286\t # Global method index: {(class_name, method_name): [(file_path, symbol_id)]}\n 287\t # in file-insertion order \u2014 replaces the trait-dispatch scan over\n 288\t # every file's method dict with one short-list lookup.\n 289\t self._global_methods: dict[tuple[str, str], list[tuple[str, str]]] = defaultdict(list)\n 290\t\n 291\t # Global symbol index: {name: [symbol_ids]} \u2014 for Tier 3\n 292\t self._global_symbols: dict[str, list[str]] = defaultdict(list)\n 293\t self._symbols_by_id = {\n 294\t symbol.id: symbol for parsed in parsed_files.values() for symbol in parsed.symbols\n 295\t }\n 296\t self._symbol_paths_by_id = {\n 297\t symbol.id: path\n 298\t for path, parsed in parsed_files.items()\n 299\t for symbol in parsed.symbols\n 300\t }\n 301\t self._overload_return_types: dict[tuple[str, str | None, str, int | None], set[str]] = (\n 302\t defaultdict(set)\n 303\t )\n 304\t for path, parsed in parsed_files.items():\n 305\t for symbol in parsed.symbols:\n 306\t raw_return = declared_return_type(symbol.signature or \"\")\n 307\t normalized = (\n 308\t normalize_return_type(raw_return, symbol.language) if raw_return else None\n 309\t )\n 310\t if normalized is not None:\n 311\t key = (\n 312\t path,\n 313\t symbol.parent_name,\n 314\t symbol.name,\n 315\t signature_parameter_count(symbol.signature or \"\"),\n 316\t )\n 317\t self._overload_return_types[key].add(normalized)\n 318\t self._known_type_names = frozenset(\n 319\t symbol.name for symbol in self._symbols_by_id.values() if symbol.kind in _TYPE_KINDS\n 320\t )\n 321\t\n 322\t # Symbols in the index above that are data members, not callables\n 323\t # Held as an id set rather than a full id->kind map: it is the only\n 324\t # kind question asked of it and the set is small.\n 325\t self._non_callable_ids: set[str] = set()\n 326\t self._property_accessor_ids: set[str] = set()\n 327\t\n 328\t # C/C++ forward declaration \u2192 the definition it declares. Populated by\n 329\t # ``_build_indices``; applied to every resolved call so the edge lands\n 330\t # on the body rather than the header line that announced it.\n 331\t self._decl_to_def: dict[str, str] = {}\n 332\t\n 333\t # Import graph: {file_path: set of imported file paths}\n 334\t self._import_targets = import_targets\n 335\t\n 336\t # Shared import-name maps (built once per GraphBuilder.build() and\n 337\t # injected; standalone construction builds them locally).\n 338\t if import_maps is None:\n 339\t from .import_index import build_import_name_maps\n 340\t\n 341\t import_maps = build_import_name_maps(parsed_files)\n 342\t # Import name mapping: {file_path: {local_name: source_file}}\n 343\t self._import_names: dict[str, dict[str, str]] = import_maps.import_names\n 344\t # Full binding data: {file_path: {local_name: NamedBinding}}\n 345\t self._import_bindings: dict[str, dict[str, NamedBinding]] = import_maps.import_bindings\n 346\t # Module alias mapping: {file_path: {alias: source_file}}\n 347\t self._module_aliases: dict[str, dict[str, str]] = import_maps.module_aliases\n 348\t\n 349\t # Lazy per-file merged views of every imported file's symbol /\n 350\t # method tables \u2014 turns the Tier-2b \"scan each imported file\"\n 351\t # loops into single dict lookups. Built on first miss per file;\n 352\t # merge order is sorted(import paths) with first-wins so shadowed\n 353\t # names resolve deterministically (the old set-iteration order was\n 354\t # hash-randomized per process).\n 355\t self._merged_import_symbols: dict[str, dict[str, str]] = {}\n 356\t self._merged_import_methods: dict[str, dict[tuple[str, str], str]] = {}\n 357\t\n 358\t # Lazy per-file set of (line, target) that also carry a receiver.\n 359\t self._member_shaped: dict[str, set[tuple[int, str]]] = {}\n 360\t\n 361\t # Receiver typing reads source text, so both caches are capped rather\n 362\t # than per-repo: files resolve one at a time, so a few slots always\n 363\t # hit, and the cap is what keeps a whole repo's source out of memory.\n 364\t # Scanning is memoised per *function*, not per reference \u2014 one scan\n 365\t # answers every unresolved receiver in a body.\n 366\t self._source_text: dict[str, str] = {}\n 367\t self._declarations: dict[str, tuple[Declaration, ...]] = {}\n 368\t self._symbol_spans: dict[str, dict[str, tuple[int, int]]] = {}\n 369\t self._body_types: dict[tuple[str, str], dict[str, str | None]] = {}\n 370\t self._field_types: dict[str, dict[str, dict[str, str | None]]] = {}\n 371\t self._bindings: dict[str, tuple[tuple[int, str], ...]] = {}\n 372\t self._bound_names: dict[tuple[str, str], frozenset[str]] = {}\n 373\t # {file: {name: type}} \u2014 module-level defs a framework decorator retyped.\n 374\t self._framework_types: dict[str, dict[str, str]] = {}\n 375\t self._external_names: dict[str, frozenset[str]] = {}\n 376\t self._repo_rebound_names: dict[str, frozenset[str]] = {}\n 377\t self._method_name_set: frozenset[str] | None = None\n 378\t self._framework_name_set: frozenset[str] | None = None\n 379\t\n 380\t # Barrel re-export origins: {barrel_file: {name: origin_file}}\n 381\t self._barrel_origins: dict[str, dict[str, str]] = defaultdict(dict)\n 382\t\n 383\t # Keep reference for cross-language checks in Tier 3\n 384\t self._parsed_files = parsed_files\n 385\t\n 386\t # Rust cross-crate resolution\n 387\t self._repo_path = repo_path\n 388\t self._rust_crate_src: dict[str, str] | None = None # lazy\n 389\t\n 390\t # Go package-scoped resolution (lazy GoPackageIndex). ``_go_index``\n 391\t # holds the built index; ``_go_index_built`` distinguishes \"not yet\n 392\t # built\" from \"built but unavailable\" (no repo_path / no go files).\n 393\t self._go_index: Any = None\n 394\t self._go_index_built = False\n 395\t\n 396\t # JVM same-package resolution (lazy JvmWorkspaceIndex)\n 397\t self._jvm_index: Any = None\n 398\t self._jvm_index_built = False\n 399\t\n 400\t # C/C++ same-target resolution (lazy CppWorkspaceIndex)\n 401\t self._cpp_index: Any = None\n 402\t self._cpp_index_built = False\n 403\t\n 404\t self._strategies_by_file: dict[str, _LanguageCallStrategies] = {}\n 405\t\n 406\t self._build_indices(parsed_files)\n 407\t self._follow_barrel_exports()\n 408\t\n 409\t def _follow_barrel_exports(self) -> None:\n 410\t \"\"\"Detect barrel/re-export files and record origin mappings.\n 411\t\n 412\t A barrel file imports a name and re-exports it without defining it\n 413\t locally (e.g., ``__init__.py`` with ``from .calculator import Calculator``).\n 414\t When downstream code imports from the barrel, we follow chains to\n 415\t find the actual defining file.\n 416\t \"\"\"\n 417\t # First pass: identify direct barrel origins\n 418\t for path, name_to_file in self._import_names.items():\n 419\t file_syms = self._file_symbols.get(path, {})\n 420\t for name, source_file in name_to_file.items():\n 421\t # An origin outside the repo names no file any reader of this\n 422\t # map can look up, and the wildcard pass below already refuses\n 423\t # one. Holding the invariant in one pass and not its twin is\n 424\t # what makes a later reader look safe when it is not.\n 425\t if name not in file_syms and not source_file.startswith(\"external:\"):\n 426\t self._barrel_origins[path][name] = source_file\n 427\t\n 428\t # Track wildcard re-exports, which forward every symbol of the imported\n 429\t # module under this file's namespace. Two shapes qualify: Rust\n 430\t # `pub use foo::*` (is_reexport) and Python/JS `from foo import *` (a\n 431\t # \"*\" imported name). The latter is how package ``__init__.py`` barrels\n 432\t # commonly re-export a subpackage \u2014 ``build_import_name_maps`` skips the\n 433\t # \"*\" name (it is not a binding), so without this pass the barrel chain\n 434\t # dead-ends one hop short of the real definition and a call through the\n 435\t # barrel resolves to nothing.\n 436\t wildcard_sources: dict[str, list[str]] = defaultdict(list)\n 437\t for path, parsed in self._parsed_files.items():\n 438\t file_syms = self._file_symbols.get(path, {})\n 439\t for imp in parsed.imports:\n 440\t is_wildcard = imp.is_reexport or \"*\" in imp.imported_names\n 441\t if not is_wildcard or not imp.resolved_file:\n 442\t continue\n 443\t if imp.resolved_file.startswith(\"external:\"):\n 444\t continue\n 445\t # ``export * as ns from \"x\"`` forwards the module under ``ns``,\n 446\t # so x's names are reachable as ``ns.name`` and are NOT this\n 447\t # file's own exports. Flattening them makes a bare ``name``\n 448\t # resolve into a nested namespace it was never in.\n 449\t if any(b.local_name == \"*\" and b.exported_name for b in imp.bindings):\n 450\t continue\n 451\t resolved = imp.resolved_file\n 452\t if resolved != path:\n 453\t wildcard_sources[path].append(resolved)\n 454\t source_syms = self._file_symbols.get(resolved, {})\n 455\t source_parsed = self._parsed_files.get(resolved)\n 456\t published = (\n 457\t (*source_syms, *source_parsed.export_aliases)\n 458\t if source_parsed\n 459\t else tuple(source_syms)\n 460\t )\n 461\t for sym_name in published:\n 462\t if sym_name not in file_syms:\n 463\t self._barrel_origins[path][sym_name] = resolved\n 464\t\n 465\t # The pass above forwards only what the source file DECLARES, so a\n 466\t # barrel over a barrel forwards nothing and the chain breaks at its\n 467\t # first link rather than its last. Forward what the source file\n 468\t # re-exports too, to a fixpoint. The multi-hop pass below cannot do\n 469\t # this job \u2014 it deepens entries that exist, and here none do.\n 470\t #\n 471\t # Sorted so that a name two of this file's barrels both forward lands on\n 472\t # the same origin whatever order the repository was walked in.\n 473\t for _ in range(4):\n 474\t changed = False\n 475\t for path, sources in sorted(wildcard_sources.items()):\n 476\t file_syms = self._file_symbols.get(path, {})\n 477\t origins = self._barrel_origins[path]\n 478\t for source in sorted(sources):\n 479\t source_bindings = self._import_bindings.get(source, {})\n 480\t for name, declaring in sorted(self._barrel_origins.get(source, {}).items()):\n 481\t if name in file_syms or name in origins or declaring == path:\n 482\t continue\n 483\t # The map keys a name as the source file spells it and\n 484\t # records only the declaring file, never the name the\n 485\t # symbol has there. A hop that renames therefore hands\n 486\t # on a key the declaring file may coincidentally\n 487\t # declare as something unrelated, and the receiving\n 488\t # file carries no binding to undo it with. Refuse those\n 489\t # rather than forward a name that means something else\n 490\t # at the far end; it costs reach, never correctness.\n 491\t binding = source_bindings.get(name)\n 492\t if binding is not None and (binding.exported_name or name) != name:\n 493\t continue\n 494\t origins[name] = declaring\n 495\t changed = True\n 496\t if not changed:\n 497\t break\n 498\t\n 499\t # Multi-hop: follow chains up to 5 hops\n 500\t for _ in range(4):\n 501\t changed = False\n 502\t for _path, origins in list(self._barrel_origins.items()):\n 503\t for name, source in list(origins.items()):\n 504\t deeper = self._barrel_origins.get(source, {}).get(name)\n 505\t if deeper and deeper != source:\n 506\t origins[name] = deeper\n 507\t changed = True\n 508\t if not changed:\n 509\t break\n 510\t\n 511\t def _get_rust_crate_src(self) -> dict[str, str]:\n 512\t \"\"\"Lazily build a mapping from normalised crate name to src/ dir.\"\"\"\n 513\t if self._rust_crate_src is not None:\n 514\t return self._rust_crate_src\n 515\t self._rust_crate_src = {}\n 516\t if not self._repo_path:\n 517\t return self._rust_crate_src\n 518\t from .resolvers.rust_workspace import get_or_build_cargo_workspace_index\n 519\t\n 520\t class _Ctx:\n 521\t def __init__(self, rp, pf):\n 522\t self.repo_path = rp\n 523\t self.parsed_files = pf\n 524\t\n 525\t ctx = _Ctx(self._repo_path, self._parsed_files)\n 526\t ws = get_or_build_cargo_workspace_index(ctx)\n 527\t if ws:\n 528\t for crate in ws.crates:\n 529\t normalized = crate.name.replace(\"-\", \"_\")\n 530\t self._rust_crate_src[normalized] = crate.src_dir\n 531\t return self._rust_crate_src\n 532\t\n 533\t def _get_go_index(self) -> Any:\n 534\t \"\"\"Lazily build the GoPackageIndex (or None if unavailable).\n 535\t\n 536\t Mirrors ``_get_rust_crate_src``: the resolver runs without a\n 537\t ``ResolverContext``, so it constructs a minimal stand-in and rebuilds\n 538\t the package index. The build is one walk over the ``.go`` files; the\n 539\t result is cached for the lifetime of the resolver.\n 540\t \"\"\"\n 541\t if self._go_index_built:\n 542\t return self._go_index\n 543\t self._go_index_built = True\n 544\t if not self._repo_path:\n 545\t return None\n 546\t from pathlib import Path\n 547\t\n 548\t from .resolvers.go_workspace import build_go_package_index\n 549\t\n 550\t class _Ctx:\n 551\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 552\t self.repo_path = Path(rp)\n 553\t self.path_set = set(pf.keys())\n 554\t self.sorted_paths = tuple(sorted(self.path_set))\n 555\t self.parsed_files = pf\n 556\t self.go_modules: tuple[\n[repowise#63171fe88e36: 600 lines omitted (~7951 tokens); restore: repowise expand 63171fe88e36]","start_line":197,"symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver","truncated":true,"verified":true},"get_symbol:largest-symbol":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#c07e342c9b4c","repowise#6abe1e1bba89"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":8114},"replaced_tokens":25149,"response_budget":{"limit_chars":24000,"serialized_chars":22619,"tier":"default"},"state":{"truncated":true},"timing_ms":7.41,"tokens_saved":19481},"continuation":"packages/core/src/repowise/core/ingestion/call_resolver.py:847-2117","continuation_reference":{"id":"packages/core/src/repowise/core/ingestion/call_resolver.py:847-2117","kind":"file_range","path":"packages/core/src/repowise/core/ingestion/call_resolver.py","range":[847,2117],"repository":"default","source_kind":"source","verification_basis":"live"},"end_line":846,"file":"packages/core/src/repowise/core/ingestion/call_resolver.py","kind":"class","name":"CallResolver","omission_marker":"[repowise#6abe1e1bba89: 11 lines omitted (~136 tokens); restore: repowise expand 6abe1e1bba89]","qualified_name":"packages.core.src.repowise.core.ingestion.call_resolver.CallResolver","signature":"class CallResolver","source":" 247\tclass CallResolver:\n 248\t \"\"\"Resolve raw CallSites to symbol-level edges.\n 249\t\n 250\t Constructed once per ``GraphBuilder.build()`` call with the full set of\n 251\t parsed files and import edges, then driven one file at a time.\n 252\t\n 253\t ``resolve_file()`` is **not** safe to call concurrently. Several lazy\n 254\t caches are filled during resolution, and the capped ones evict wholesale.\n 255\t Every cached value is a pure function of state fixed at construction, so a\n 256\t race would cost recomputation rather than a wrong answer, but the eviction\n 257\t makes concurrent use pointless as well as unsupported.\n 258\t \"\"\"\n 259\t\n 260\t def __init__(\n 261\t self,\n 262\t parsed_files: dict[str, ParsedFile],\n 263\t import_targets: dict[str, set[str]],\n 264\t *,\n 265\t repo_path: str | None = None,\n 266\t import_maps: Any | None = None,\n 267\t heritage_parents: dict[str, set[str]] | None = None,\n 268\t return_type_chain_languages: frozenset[str] | None = None,\n 269\t ) -> None:\n 270\t # {type symbol id: parent type symbol ids}, from the caller's already\n 271\t # resolved heritage. Absent when the resolver is built standalone, in\n 272\t # which case the inherited tier simply never fires.\n 273\t self._heritage_parents: dict[str, set[str]] = heritage_parents or {}\n 274\t self._return_type_chain_languages = (\n 275\t PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES\n 276\t if return_type_chain_languages is None\n 277\t else return_type_chain_languages\n 278\t )\n 279\t self._ancestors: dict[str, tuple[str, ...]] = {}\n 280\t # Per-file symbol index: {file_path: {symbol_name: symbol_id}}\n 281\t self._file_symbols: dict[str, dict[str, str]] = {}\n 282\t\n 283\t # Per-file method index: {file_path: {(class_name, method_name): symbol_id}}\n 284\t self._file_methods: dict[str, dict[tuple[str, str], str]] = {}\n 285\t\n 286\t # Global method index: {(class_name, method_name): [(file_path, symbol_id)]}\n 287\t # in file-insertion order \u2014 replaces the trait-dispatch scan over\n 288\t # every file's method dict with one short-list lookup.\n 289\t self._global_methods: dict[tuple[str, str], list[tuple[str, str]]] = defaultdict(list)\n 290\t\n 291\t # Global symbol index: {name: [symbol_ids]} \u2014 for Tier 3\n 292\t self._global_symbols: dict[str, list[str]] = defaultdict(list)\n 293\t self._symbols_by_id = {\n 294\t symbol.id: symbol for parsed in parsed_files.values() for symbol in parsed.symbols\n 295\t }\n 296\t self._symbol_paths_by_id = {\n 297\t symbol.id: path\n 298\t for path, parsed in parsed_files.items()\n 299\t for symbol in parsed.symbols\n 300\t }\n 301\t self._overload_return_types: dict[tuple[str, str | None, str, int | None], set[str]] = (\n 302\t defaultdict(set)\n 303\t )\n 304\t for path, parsed in parsed_files.items():\n 305\t for symbol in parsed.symbols:\n 306\t raw_return = declared_return_type(symbol.signature or \"\")\n 307\t normalized = (\n 308\t normalize_return_type(raw_return, symbol.language) if raw_return else None\n 309\t )\n 310\t if normalized is not None:\n 311\t key = (\n 312\t path,\n 313\t symbol.parent_name,\n 314\t symbol.name,\n 315\t signature_parameter_count(symbol.signature or \"\"),\n 316\t )\n 317\t self._overload_return_types[key].add(normalized)\n 318\t self._known_type_names = frozenset(\n 319\t symbol.name for symbol in self._symbols_by_id.values() if symbol.kind in _TYPE_KINDS\n 320\t )\n 321\t\n 322\t # Symbols in the index above that are data members, not callables\n 323\t # Held as an id set rather than a full id->kind map: it is the only\n 324\t # kind question asked of it and the set is small.\n 325\t self._non_callable_ids: set[str] = set()\n 326\t self._property_accessor_ids: set[str] = set()\n 327\t\n 328\t # C/C++ forward declaration \u2192 the definition it declares. Populated by\n 329\t # ``_build_indices``; applied to every resolved call so the edge lands\n 330\t # on the body rather than the header line that announced it.\n 331\t self._decl_to_def: dict[str, str] = {}\n 332\t\n 333\t # Import graph: {file_path: set of imported file paths}\n 334\t self._import_targets = import_targets\n 335\t\n 336\t # Shared import-name maps (built once per GraphBuilder.build() and\n 337\t # injected; standalone construction builds them locally).\n 338\t if import_maps is None:\n 339\t from .import_index import build_import_name_maps\n 340\t\n 341\t import_maps = build_import_name_maps(parsed_files)\n 342\t # Import name mapping: {file_path: {local_name: source_file}}\n 343\t self._import_names: dict[str, dict[str, str]] = import_maps.import_names\n 344\t # Full binding data: {file_path: {local_name: NamedBinding}}\n 345\t self._import_bindings: dict[str, dict[str, NamedBinding]] = import_maps.import_bindings\n 346\t # Module alias mapping: {file_path: {alias: source_file}}\n 347\t self._module_aliases: dict[str, dict[str, str]] = import_maps.module_aliases\n 348\t\n 349\t # Lazy per-file merged views of every imported file's symbol /\n 350\t # method tables \u2014 turns the Tier-2b \"scan each imported file\"\n 351\t # loops into single dict lookups. Built on first miss per file;\n 352\t # merge order is sorted(import paths) with first-wins so shadowed\n 353\t # names resolve deterministically (the old set-iteration order was\n 354\t # hash-randomized per process).\n 355\t self._merged_import_symbols: dict[str, dict[str, str]] = {}\n 356\t self._merged_import_methods: dict[str, dict[tuple[str, str], str]] = {}\n 357\t\n 358\t # Lazy per-file set of (line, target) that also carry a receiver.\n 359\t self._member_shaped: dict[str, set[tuple[int, str]]] = {}\n 360\t\n 361\t # Receiver typing reads source text, so both caches are capped rather\n 362\t # than per-repo: files resolve one at a time, so a few slots always\n 363\t # hit, and the cap is what keeps a whole repo's source out of memory.\n 364\t # Scanning is memoised per *function*, not per reference \u2014 one scan\n 365\t # answers every unresolved receiver in a body.\n 366\t self._source_text: dict[str, str] = {}\n 367\t self._declarations: dict[str, tuple[Declaration, ...]] = {}\n 368\t self._symbol_spans: dict[str, dict[str, tuple[int, int]]] = {}\n 369\t self._body_types: dict[tuple[str, str], dict[str, str | None]] = {}\n 370\t self._field_types: dict[str, dict[str, dict[str, str | None]]] = {}\n 371\t self._bindings: dict[str, tuple[tuple[int, str], ...]] = {}\n 372\t self._bound_names: dict[tuple[str, str], frozenset[str]] = {}\n 373\t # {file: {name: type}} \u2014 module-level defs a framework decorator retyped.\n 374\t self._framework_types: dict[str, dict[str, str]] = {}\n 375\t self._external_names: dict[str, frozenset[str]] = {}\n 376\t self._repo_rebound_names: dict[str, frozenset[str]] = {}\n 377\t self._method_name_set: frozenset[str] | None = None\n 378\t self._framework_name_set: frozenset[str] | None = None\n 379\t\n 380\t # Barrel re-export origins: {barrel_file: {name: origin_file}}\n 381\t self._barrel_origins: dict[str, dict[str, str]] = defaultdict(dict)\n 382\t\n 383\t # Keep reference for cross-language checks in Tier 3\n 384\t self._parsed_files = parsed_files\n 385\t\n 386\t # Rust cross-crate resolution\n 387\t self._repo_path = repo_path\n 388\t self._rust_crate_src: dict[str, str] | None = None # lazy\n 389\t\n 390\t # Go package-scoped resolution (lazy GoPackageIndex). ``_go_index``\n 391\t # holds the built index; ``_go_index_built`` distinguishes \"not yet\n 392\t # built\" from \"built but unavailable\" (no repo_path / no go files).\n 393\t self._go_index: Any = None\n 394\t self._go_index_built = False\n 395\t\n 396\t # JVM same-package resolution (lazy JvmWorkspaceIndex)\n 397\t self._jvm_index: Any = None\n 398\t self._jvm_index_built = False\n 399\t\n 400\t # C/C++ same-target resolution (lazy CppWorkspaceIndex)\n 401\t self._cpp_index: Any = None\n 402\t self._cpp_index_built = False\n 403\t\n 404\t self._strategies_by_file: dict[str, _LanguageCallStrategies] = {}\n 405\t\n 406\t self._build_indices(parsed_files)\n 407\t self._follow_barrel_exports()\n 408\t\n 409\t def _follow_barrel_exports(self) -> None:\n 410\t \"\"\"Detect barrel/re-export files and record origin mappings.\n 411\t\n 412\t A barrel file imports a name and re-exports it without defining it\n 413\t locally (e.g., ``__init__.py`` with ``from .calculator import Calculator``).\n 414\t When downstream code imports from the barrel, we follow chains to\n 415\t find the actual defining file.\n 416\t \"\"\"\n 417\t # First pass: identify direct barrel origins\n 418\t for path, name_to_file in self._import_names.items():\n 419\t file_syms = self._file_symbols.get(path, {})\n 420\t for name, source_file in name_to_file.items():\n 421\t # An origin outside the repo names no file any reader of this\n 422\t # map can look up, and the wildcard pass below already refuses\n 423\t # one. Holding the invariant in one pass and not its twin is\n 424\t # what makes a later reader look safe when it is not.\n 425\t if name not in file_syms and not source_file.startswith(\"external:\"):\n 426\t self._barrel_origins[path][name] = source_file\n 427\t\n 428\t # Track wildcard re-exports, which forward every symbol of the imported\n 429\t # module under this file's namespace. Two shapes qualify: Rust\n 430\t # `pub use foo::*` (is_reexport) and Python/JS `from foo import *` (a\n 431\t # \"*\" imported name). The latter is how package ``__init__.py`` barrels\n 432\t # commonly re-export a subpackage \u2014 ``build_import_name_maps`` skips the\n 433\t # \"*\" name (it is not a binding), so without this pass the barrel chain\n 434\t # dead-ends one hop short of the real definition and a call through the\n 435\t # barrel resolves to nothing.\n 436\t wildcard_sources: dict[str, list[str]] = defaultdict(list)\n 437\t for path, parsed in self._parsed_files.items():\n 438\t file_syms = self._file_symbols.get(path, {})\n 439\t for imp in parsed.imports:\n 440\t is_wildcard = imp.is_reexport or \"*\" in imp.imported_names\n 441\t if not is_wildcard or not imp.resolved_file:\n 442\t continue\n 443\t if imp.resolved_file.startswith(\"external:\"):\n 444\t continue\n 445\t # ``export * as ns from \"x\"`` forwards the module under ``ns``,\n 446\t # so x's names are reachable as ``ns.name`` and are NOT this\n 447\t # file's own exports. Flattening them makes a bare ``name``\n 448\t # resolve into a nested namespace it was never in.\n 449\t if any(b.local_name == \"*\" and b.exported_name for b in imp.bindings):\n 450\t continue\n 451\t resolved = imp.resolved_file\n 452\t if resolved != path:\n 453\t wildcard_sources[path].append(resolved)\n 454\t source_syms = self._file_symbols.get(resolved, {})\n 455\t source_parsed = self._parsed_files.get(resolved)\n 456\t published = (\n 457\t (*source_syms, *source_parsed.export_aliases)\n 458\t if source_parsed\n 459\t else tuple(source_syms)\n 460\t )\n 461\t for sym_name in published:\n 462\t if sym_name not in file_syms:\n 463\t self._barrel_origins[path][sym_name] = resolved\n 464\t\n 465\t # The pass above forwards only what the source file DECLARES, so a\n 466\t # barrel over a barrel forwards nothing and the chain breaks at its\n 467\t # first link rather than its last. Forward what the source file\n 468\t # re-exports too, to a fixpoint. The multi-hop pass below cannot do\n 469\t # this job \u2014 it deepens entries that exist, and here none do.\n 470\t #\n 471\t # Sorted so that a name two of this file's barrels both forward lands on\n 472\t # the same origin whatever order the repository was walked in.\n 473\t for _ in range(4):\n 474\t changed = False\n 475\t for path, sources in sorted(wildcard_sources.items()):\n 476\t file_syms = self._file_symbols.get(path, {})\n 477\t origins = self._barrel_origins[path]\n 478\t for source in sorted(sources):\n 479\t source_bindings = self._import_bindings.get(source, {})\n 480\t for name, declaring in sorted(self._barrel_origins.get(source, {}).items()):\n 481\t if name in file_syms or name in origins or declaring == path:\n 482\t continue\n 483\t # The map keys a name as the source file spells it and\n 484\t # records only the declaring file, never the name the\n 485\t # symbol has there. A hop that renames therefore hands\n 486\t # on a key the declaring file may coincidentally\n 487\t # declare as something unrelated, and the receiving\n 488\t # file carries no binding to undo it with. Refuse those\n 489\t # rather than forward a name that means something else\n 490\t # at the far end; it costs reach, never correctness.\n 491\t binding = source_bindings.get(name)\n 492\t if binding is not None and (binding.exported_name or name) != name:\n 493\t continue\n 494\t origins[name] = declaring\n 495\t changed = True\n 496\t if not changed:\n 497\t break\n 498\t\n 499\t # Multi-hop: follow chains up to 5 hops\n 500\t for _ in range(4):\n 501\t changed = False\n 502\t for _path, origins in list(self._barrel_origins.items()):\n 503\t for name, source in list(origins.items()):\n 504\t deeper = self._barrel_origins.get(source, {}).get(name)\n 505\t if deeper and deeper != source:\n 506\t origins[name] = deeper\n 507\t changed = True\n 508\t if not changed:\n 509\t break\n 510\t\n 511\t def _get_rust_crate_src(self) -> dict[str, str]:\n 512\t \"\"\"Lazily build a mapping from normalised crate name to src/ dir.\"\"\"\n 513\t if self._rust_crate_src is not None:\n 514\t return self._rust_crate_src\n 515\t self._rust_crate_src = {}\n 516\t if not self._repo_path:\n 517\t return self._rust_crate_src\n 518\t from .resolvers.rust_workspace import get_or_build_cargo_workspace_index\n 519\t\n 520\t class _Ctx:\n 521\t def __init__(self, rp, pf):\n 522\t self.repo_path = rp\n 523\t self.parsed_files = pf\n 524\t\n 525\t ctx = _Ctx(self._repo_path, self._parsed_files)\n 526\t ws = get_or_build_cargo_workspace_index(ctx)\n 527\t if ws:\n 528\t for crate in ws.crates:\n 529\t normalized = crate.name.replace(\"-\", \"_\")\n 530\t self._rust_crate_src[normalized] = crate.src_dir\n 531\t return self._rust_crate_src\n 532\t\n 533\t def _get_go_index(self) -> Any:\n 534\t \"\"\"Lazily build the GoPackageIndex (or None if unavailable).\n 535\t\n 536\t Mirrors ``_get_rust_crate_src``: the resolver runs without a\n 537\t ``ResolverContext``, so it constructs a minimal stand-in and rebuilds\n 538\t the package index. The build is one walk over the ``.go`` files; the\n 539\t result is cached for the lifetime of the resolver.\n 540\t \"\"\"\n 541\t if self._go_index_built:\n 542\t return self._go_index\n 543\t self._go_index_built = True\n 544\t if not self._repo_path:\n 545\t return None\n 546\t from pathlib import Path\n 547\t\n 548\t from .resolvers.go_workspace import build_go_package_index\n 549\t\n 550\t class _Ctx:\n 551\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 552\t self.repo_path = Path(rp)\n 553\t self.path_set = set(pf.keys())\n 554\t self.sorted_paths = tuple(sorted(self.path_set))\n 555\t self.parsed_files = pf\n 556\t self.go_modules: tuple[tuple[str, str], ...] = ()\n 557\t self.go_module_path: str | None = None\n 558\t\n 559\t self._go_index = build_go_package_index(_Ctx(self._repo_path, self._parsed_files))\n 560\t return self._go_index\n 561\t\n 562\t def _strategies_for(self, file_path: str) -> _LanguageCallStrategies:\n 563\t \"\"\"The extra strategies this file's language gets.\"\"\"\n 564\t parsed = self._parsed_files.get(file_path)\n 565\t language = parsed.file_info.language if parsed else \"\"\n 566\t return _LANGUAGE_CALL_STRATEGIES.get(language, _NO_LANGUAGE_STRATEGIES)\n 567\t\n 568\t def _get_cpp_index(self) -> Any:\n 569\t \"\"\"Lazily build a CppWorkspaceIndex via a minimal stand-in context.\"\"\"\n 570\t if self._cpp_index_built:\n 571\t return self._cpp_index\n 572\t self._cpp_index_built = True\n 573\t if not self._repo_path:\n 574\t return None\n 575\t from pathlib import Path\n 576\t\n 577\t from .resolvers.cpp_workspace import build_cpp_workspace_index\n 578\t\n 579\t class _Ctx:\n 580\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 581\t self.repo_path = Path(rp)\n 582\t self.path_set = set(pf.keys())\n 583\t self.sorted_paths = tuple(sorted(self.path_set))\n 584\t self.parsed_files = pf\n 585\t self.stem_map: dict[str, list[str]] = {}\n 586\t\n 587\t self._cpp_index = build_cpp_workspace_index(_Ctx(self._repo_path, self._parsed_files))\n 588\t return self._cpp_index\n 589\t\n 590\t def _collapse_declarations(self, sym_ids: list[str]) -> set[str]:\n 591\t \"\"\"Fold each declaration onto the definition it was paired with.\n 592\t\n 593\t Two ids naming one symbol must not read as an ambiguity.\n 594\t \"\"\"\n 595\t return {self._decl_to_def.get(sym_id, sym_id) for sym_id in sym_ids}\n 596\t\n 597\t def _resolve_cpp_scoped_call(\n 598\t self,\n 599\t file_path: str,\n 600\t call: CallSite,\n 601\t caller_id: str,\n 602\t ) -> ResolvedCall | None:\n 603\t \"\"\"Resolve ``Qualifier::name()`` against the class the qualifier names.\n 604\t\n 605\t The qualifier is written at the call site, so this infers nothing: the\n 606\t repository either declares ``Qualifier::name`` or it does not. Before\n 607\t it existed only the leaf name survived ex\n[repowise#c07e342c9b4c: 600 lines omitted (~7978 tokens); restore: repowise expand c07e342c9b4c]","start_line":247,"symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver","truncated":true,"verified":true},"get_why:targets":{"_meta":{"completeness":{"capped":true,"reason":"construction_cap","shown":23,"total":173},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#c3d5b15fafd9","repowise#9f8533616584","repowise#5e41015972a5","repowise#9fcc901ca410"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":39053},"response_budget":{"limit_chars":24000,"serialized_chars":22762,"tier":"default"},"state":{"truncated":true}},"alignment":{"active_count":0,"candidate_count":0,"deprecated_count":0,"explanation":"No architectural decisions govern packages/core/src/repowise/core/ingestion/call_resolver.py. This file is ungoverned \u2014 it may be an outlier or simply undocumented.","governing_count":0,"score":"none","sibling_coverage":null,"stale_count":0},"answer_basis":"episode","code_rationale":[{"comment":"Three-tier call resolution engine for the symbol-level dependency graph. Resolves CallSite objects (extracted from AST) to concrete symbol node IDs in the graph, producing CALLS edges with confidence scores. Resolution tiers (checked in order, first match wins): Tier 1 \u2014 Same-file exact match (confidence 0.95) The call target matches a symbol defined in the same file. Tier 2 \u2014 Import-scoped match (confidence 0.90) The call target matches a symbol in a file that the caller imports, optionally scoped by the specific imported names. Tier 3 \u2014 Global unique match (confidence 0.50) The call target matches exactly one symbol across the entire codebase. Only fires when the match is unambiguous to avoid false edges. Each resolved call produces a (source_id, target_id, confidence, origin) tuple that the GraphBuilder converts into a CALLS edge. The tiers above are the headline three; ``ResolutionOrigin`` in ``models`` is the full set, one name per strategy, and it is what the edge carries.","evidence_refs":[{"content_id":"e7b6b95c70b3f8749c12","id":"ev_30e9f5f0c3b34b452e8c","kind":"file_content","line":1,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[1,12],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[1,12],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Languages where a call the caller's own class cannot answer is looked for on its ancestors. Both shapes \u2014 an explicit ``self``/``this`` receiver and an implicit one \u2014 end in the same walk. C++ is absent because its heritage binds a qualified external parent to a same-named local type, which puts unrelated siblings in one hierarchy before this walk even runs. Java is absent because `java.scm`'s bare-call pattern also matches `this.field.m()`, which no receiver-carrying pattern claims, so such a call arrives here indistinguishable from a real implicit receiver \u2014 and its measured population on two Java repos was zero, so the tier could only cost. C# is present, and was once wrongly removed: a name's overloads all share one symbol id, so a declaration line read back out of the graph names an arbitrary overload. That reads as a wrong target and is not one \u2014 the id these calls resolve to is the id C# binds.","evidence_refs":[{"content_id":"e4551f6a4120417a9ac1","id":"ev_4c7480bb5b6fcc223188","kind":"file_content","line":71,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[71,82],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[71,82],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Languages where a bare name is scoped lexically: it can only mean the caller's own module, an explicit ``import``, or the prelude. Elixir's ``alias`` / ``require`` / ``use`` bind a module name, never a function name, so repo-wide uniqueness is no evidence and only wildcard imports may merge names. F# is the same rule with different spelling: a bare name means the enclosing scope, a module the file has ``open``ed, or FSharp.Core, and nothing else -- a name unique across the repo is not thereby in scope.","evidence_refs":[{"content_id":"279bc93ec731b668214a","id":"ev_925a17bc0fec5d8f2f7e","kind":"file_content","line":89,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[89,95],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[89,95],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"What a language resolves that the language-neutral tiers cannot. ``free`` runs after the same-file tier and before the import tiers; ``member`` runs before every receiver strategy; ``member_fallback`` runs after all of them, so a strategy there only ever sees a call nothing else claimed and can only add an edge. All three stop at the first hit. Strategies are named rather than bound so a probe can substitute one.","evidence_refs":[{"content_id":"fa671bfea3e99da6733e","id":"ev_edb4dc3ce42f43aa3355","kind":"file_content","line":108,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[108,115],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[108,115],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Kinds that can never be the callee of a call, used to keep the bare-name Tier 3 index from offering a data member as a function. This is deliberately NOT the complement of ``_FUNCTION_KINDS``. Measured over the corpus, plenty of non-function kinds are legitimately called: ``class`` is a constructor in python/java/c#/typescript; ``variable`` is both a rust tuple ``enum_variant`` (309 grounded call edges on goose) and a typescript const whose initialiser is not syntactically a function, such as a factory result or a ``.bind()`` handle (2,173 on zod); ``type_alias`` is a Go conversion. Denying by function-ness would delete thousands of real edges. ``property`` is the one kind in the whole of ``language_configs.py`` that means \"data member\" and nothing else: it is emitted by exactly one mapping, rust's ``field_declaration``. Every other language spells its fields ``variable``, which is why this fix cannot be extended to them \u2014 there a field is indistinguishable from a callable value by kind alone.","evidence_refs":[{"content_id":"8ac00a8632e2a7726d77","id":"ev_603ed9ddc8822602b80c","kind":"file_content","line":132,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[132,143],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[132,143],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"}],"code_rationale_emitted":5,"code_rationale_omitted":49,"code_rationale_reduced_reason":"construction_cap","code_rationale_total":54,"code_rationale_truncated":true,"decisions":[],"episodes":[{"evidence":"commit 0cbe36f70f0d, 2026-08-30, changed 10 files together","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"episode","source_kind":"episode","verification_basis":"historical"}],"kind":"code_fix","provenance":"historical","recorded":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","scope":["packages/core/src/repowise/core/analysis/dead_code/analyzer.py","packages/core/src/repowise/core/analysis/dead_code/jsx_prop_guards.py","packages/core/src/repowise/core/ingestion/call_resolver.py","packages/core/src/repowise/core/ingestion/graph/_rehydrate.py","packages/core/src/repowise/core/ingestion/graph/_resolvers.py","packages/core/src/repowise/core/ingestion/models.py","packages/core/src/repowise/core/ingestion/parser.py","tests/unit/dead_code/_helpers.py","tests/unit/dead_code/test_jsx_prop_guard_dead_code.py","tests/unit/ingestion/test_graph_rehydrate.py"],"still_true":"recorded 2026-08-30 at 0cbe36f70f0d; 10 commits have touched its scope since","subject":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","tier":"git"}],"episodes_emitted":1,"episodes_omitted":20,"episodes_reduced_reason":"construction_cap_and_response_budget","episodes_total":21,"episodes_truncated":true,"git_archaeology":{"cross_references":[],"file_commits":[{"author":"Contributor 19","date":"2026-09-04T18:15:43+00:00","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:file_commits","source_kind":"archaeology:file_commits","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","provenance":"historical","sha":"9af0b5f9"}],"file_commits_emitted":1,"file_commits_omitted":33,"file_commits_reduced_reason":"construction_cap_and_response_budget","file_commits_total":34,"file_commits_truncated":true,"git_log":[{"author":"Contributor 19","commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","date":"2026-09-04","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","provenance":"historical","sha":"9af0b5f9ca65","source":"git_log_follow"},{"author":"Contributor 19","commit":"01e50e2f8475888541745fcbb0d40dd016f77476","date":"2026-09-04","evidence_refs":[{"commit":"01e50e2f8475888541745fcbb0d40dd016f77476","id":"ev_39e60b3a5fcdf4065a36","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(languages): parse Elixir to a full AST and move it to Good (#2127)","provenance":"historical","sha":"01e50e2f8475","source":"git_log_follow"},{"author":"Contributor 20","commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","date":"2026-08-30","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","provenance":"historical","sha":"0cbe36f70f0d","source":"git_log_follow"},{"author":"Contributor 19","commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","date":"2026-08-26","evidence_refs":[{"commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","id":"ev_a162f4fe7b64b188a5a7","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): refuse a data member on the import-merged tier (#1925)","provenance":"historical","sha":"58403ddb6949","source":"git_log_follow"},{"author":"Contributor 19","commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","date":"2026-08-25","evidence_refs":[{"commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","id":"ev_4b18c964f408fa622c84","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): resolve a call to an overload set instead of refusing it (#1923)","provenance":"historical","sha":"f97ced7a4c7b","source":"git_log_follow"},{"author":"Contributor 19","commit":"127e0f1ec4aab7033c5ef1139a0762b1d50a15ac","date":"2026-08-25","evidence_refs":[{"commit":"127e0f1ec4aab7033c5ef1139a0762b1d50a15ac","id":"ev_90dca2153133ec4557c0","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(ingestion): extract C++ in-class method declarations (#1921)","provenance":"historical","sha":"127e0f1ec4aa","source":"git_log_follow"},{"author":"Contributor 19","commit":"0c9faff85da640782783e1f9a1371f1c257ce5aa","date":"2026-08-25","evidence_refs":[{"commit":"0c9faff85da640782783e1f9a1371f1c257ce5aa","id":"ev_c5df10bf3bef8ae640b5","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(ingestion): type C++ receivers from their declarations (#1919)","provenance":"historical","sha":"0c9faff85da6","source":"git_log_follow"},{"author":"Contributor 19","commit":"354269f101dd81be3a681e1e122c17d4b8c81bbc","date":"2026-08-25","evidence_refs":[{"commit":"354269f101dd81be3a681e1e122c17d4b8c81bbc","id":"ev_df55cb0a222f001ebcd4","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): resolve C++ scoped calls against their qualifier (#1915)","provenance":"historical","sha":"354269f101dd","source":"git_log_follow"},{"author":"Contributor 19","commit":"08e493b8f932296fc572def1873a6431b3023404","date":"2026-08-23","evidence_refs":[{"commit":"08e493b8f932296fc572def1873a6431b3023404","id":"ev_d3d093332515aa05cb6e","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): a java chain rooted at an external type is not a bare-name call (#1897)","provenance":"historical","sha":"08e493b8f932","source":"git_log_follow"},{"author":"Contributor 19","commit":"330ad6fa13caa842d816b836349bcbe6403e5c79","date":"2026-08-23","evidence_refs":[{"commit":"330ad6fa13caa842d816b836349bcbe6403e5c79","id":"ev_1acf1dcd8778ada4188b","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): stop the repo-wide receiver tier answering for foreign types (#1893)","provenance":"historical","sha":"330ad6fa13ca","source":"git_log_follow"},{"author":"Contributor 19","commit":"d7bd394ca894e0cd68ed2fd429a8c3fa9ff34c5a","date":"2026-08-23","evidence_refs":[{"commit":"d7bd394ca894e0cd68ed2fd429a8c3fa9ff34c5a","id":"ev_a47485b7ddc68ba5486d","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): a rust macro invocation is not a function call (#1885)","provenance":"historical","sha":"d7bd394ca894","source":"git_log_follow"}],"git_log_emitted":11,"git_log_omitted":19,"git_log_reduced_reason":"construction_cap_and_response_budget","git_log_total":30,"git_log_truncated":true,"provenance":"historical","summary":"No architectural decisions found for packages/core/src/repowise/core/ingestion/call_resolver.py, but git archaeology recovered 34 direct commit(s), 0 cross-reference(s), and 30 git log result(s). Review these to understand the intent behind this code.","triggered":true},"mode":"path","omission_marker":"[repowise#9fcc901ca410: 369 lines omitted (~2722 tokens); restore: repowise expand 9fcc901ca410]","origin_story":{"age_days":20,"author_commit_pct":0.9412,"available":true,"contributors":[{"commit_count":32,"email":"[email protected]","first_commit_ts":1786882824,"last_commit_ts":1788545743,"name":"Contributor 19"},{"commit_count":1,"email":"[email protected]","first_commit_ts":1788086763,"last_commit_ts":1788086763,"name":"Contributor 20"},{"commit_count":1,"email":"[email protected]","first_commit_ts":1787414540,"last_commit_ts":1787414540,"name":"Contributor 23"}],"first_commit":"2026-08-16","key_commits":[{"author":"Contributor 19","body":"tree-sitter-fsharp 0.3.11 replaces the regex tier for .fs and .fsx.\nModules, namespaces, let bindings including each `and` continuation,\nrecords, unions, classes, interfaces, members and exceptions become\nsymbols; `///` comments become docstrings; `inherit` and\n`interface ... with` become heritage edges. Signature files stay on the\nimport-only path: one grammar per language cannot select the signature\ngrammar, and the implementation grammar mis-parses them.\n\nImports keep the existing resolver and its .fsproj compile-order leg;\n`open` now carries the wildcard sentinel, which is what it means. A bare\nname in F# is lexically scoped, so the resolver refuses the global-unique\ntier for it and merges names only through `open`; an uppercase unqualified\ncallee is a union case or constructor, not a call site.\n\nA registry-parity test pins that every non-passthrough language has a\ngrammar, a query file and a config, and a pipeline-worker test drives the\nreal parse entry point over a .fs file.\n\nNo health markers yet. Docs","date":"2026-09-04T18:15:43+00:00","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","pr_number":2133,"provenance":"historical","sha":"9af0b5f9"},{"author":"Contributor 19","body":"tree-sitter-elixir 0.3.5 replaces the regex tier for .ex and .exs.\ndefmodule, def, defp, defmacro, defguard, defdelegate and defprotocol\nbecome symbols, defimpl becomes an impl symbol named for the module the\ncompiler generates, and @doc / @moduledoc become docstrings. Every one\nof those is a call node in this grammar, so the kind, the parent module\nand the definition-head filter are read from the call's target keyword\nin four small language-gated blocks beside the Pascal and Dart ones.\n\nImports keep the existing resolver: alias, import, require and use yield\none import per named module, including each member of alias Foo.{Bar,\nBaz}, and the resolver's reach is unchanged. Call edges resolve within a\nmodule and through receivers. A bare name in Elixir is lexically scoped,\nso the resolver refuses the global-unique tier for it and merges names\nonly from wildcard imports; alias, require and use bind a module name,\nnever a function name.\n\nNo heritage edges (use and @behaviour are not inheritance) and no health\nmar","date":"2026-09-04T15:42:58+00:00","evidence_refs":[{"commit":"01e50e2f8475888541745fcbb0d40dd016f77476","id":"ev_39e60b3a5fcdf4065a36","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"feat(languages): parse Elixir to a full AST and move it to Good (#2127)","pr_number":2127,"provenance":"historical","sha":"01e50e2f"},{"author":"Contributor 20","date":"2026-08-30T10:46:03+00:00","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","pr_number":1554,"provenance":"historical","sha":"0cbe36f7"},{"author":"Contributor 19","date":"2026-08-25T18:42:09+00:00","evidence_refs":[{"commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","id":"ev_a162f4fe7b64b188a5a7","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(ingestion): refuse a data member on the import-merged tier (#1925)","pr_number":1925,"provenance":"historical","sha":"58403ddb"},{"author":"Contributor 19","body":"`_global_symbols` holds one entry per declaration, so a method written as\nan overload set is several rows under one symbol id. Tier 3's\nglobal-unique rung gated on `len(candidates) == 1` and read that as an\nambiguity that does not exist: C#'s `AddRetry` is two rows and one\nsymbol, and the call reached nothing.\n\nCollapsing by symbol id is not the candidate filtering this rung already\nrefuses on purpose. A name that a field and a method both declare still\nhas two distinct ids and stays refused.\n\nThe collapsed answer is tried after the implicit-receiver tier rather\nthan in place of the row count. Ahead of it, it answered sites the\ncaller's own class hierarchy already answered, moving 1,027 edges in one\nrepository off `enclosing_inherited` at 0.90 confidence onto this rung at\n0.50 for the same target. Behind it, it can only add an edge.\n\nA getter and its setter are also two declarations under one id, which\nmade an attribute look like a unique callable and bound a local\n`router(...)` parameter invocation to it. Re","date":"2026-08-25T16:53:58+00:00","evidence_refs":[{"commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","id":"ev_4b18c964f408fa622c84","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(ingestion): resolve a call to an overload set instead of refusing it (#1923)","pr_number":1923,"provenance":"historical","sha":"f97ced7a"}],"key_commits_emitted":5,"key_commits_omitted":29,"key_commits_reduced_reason":"construction_cap","key_commits_total":34,"key_commits_truncated":true,"last_commit":"2026-09-04","linked_decisions":[],"primary_author":"Contributor 19","provenance":"historical","summary":"Created ~2026-08-16, last modified 2026-09-04 (20 days old). Primary author: Contributor 19 (34 total commits). Earliest key commit: \"fix(cpp): attach a call edge to the definition, not the header declaration (#1626)\" by Contributor 19 on 2026-08-16T12:20:24+00:00. Contributors: Contributor 19, Contributor 20, Contributor 23.","total_commits":34},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","truncated":true},"list_repos:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"response_budget":{"limit_chars":24000,"serialized_chars":462,"tier":"default"}},"default_repo":"default","hint":"This MCP server is serving a single repo; omit repo unless a tool asks for it.","repos":[{"absolute_path":"/repo","alias":"default","is_default":true,"path":"/repo"}],"workspace":false,"workspace_root":null},"search_codebase:limit-5":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","replaced_tokens":2000,"response_budget":{"limit_chars":24000,"serialized_chars":3288,"tier":"default"},"tokens_saved":1162},"candidates":[{"path":"packages/server/src/repowise/server/schemas/repository.py"},{"path":"packages/api-client/src/types/repository.ts"},{"path":"packages/core/src/repowise/core/persistence/crud/repository.py"},{"path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"}],"results":[{"confidence_score":1.0,"page_type":"file_page","relevance_score":3.958,"snippet":"# packages/server/src/repowise/server/schemas/repository.py\n\n## Overview\n\nRepository request/response models.\n\nIt exposes 9 public symbols and depends on 2 other files.\n\n## Public API\n\n| Symbol | Kind","sources":["fts","vector"],"target_path":"packages/server/src/repowise/server/schemas/repository.py","title":"File: packages/server/src/repowise/server/schemas/repository.py"},{"confidence_score":1.0,"page_type":"file_page","relevance_score":3.951,"snippet":"# packages/api-client/src/types/repository.ts\n\n## Overview\n\nTypes module repository defining RepoCreate, RepoUpdate, RepoResponse. `packages/api-client/src/types/repository.ts` is a typescript source","sources":["fts","vector"],"target_path":"packages/api-client/src/types/repository.ts","title":"File: packages/api-client/src/types/repository.ts"},{"confidence_score":0.94,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","page_type":"symbol_spotlight","relevance_score":3.727,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.upsert_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.upsert_repository"},{"confidence_score":0.67,"page_type":"file_page","relevance_score":2.647,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_meta.py\n\n## Overview\n\nIndexStore mixin: repository, generation jobs, pages, chat, webhooks.\n\nThis mixin covers the \"meta\" surface \u2014 the top-l","sources":["fts"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"confidence_score":0.66,"page_type":"file_page","relevance_score":2.601,"snippet":"# packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py\n\n## Overview\n\nIndex `wiki_symbols` on `(repository_id, file_path)`.\n\nEvery file-scoped symbol lookup joins on this pair, but the o","sources":["fts"],"target_path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","title":"File: packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"}]},"search_codebase:limit-50":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":19,"total":100},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#1cb22af443b7","repowise#5fe350551fca"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":6176},"replaced_tokens":5600,"response_budget":{"limit_chars":24000,"serialized_chars":12869,"tier":"default"},"state":{"truncated":true},"targets":["packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py","packages/core/src/repowise/core/persistence/_interfaces/_meta.py","packages/server/src/repowise/server/schemas/repository.py","packages/api-client/src/types/repository.ts","packages/core/src/repowise/core/workspace/repo_index.py","packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/workspace/repo_index.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py","packages/core/src/repowise/core/pipeline/full_index.py","packages/core/src/repowise/core/persistence/_interfaces/_analysis.py","packages/core/src/repowise/core/persistence/models.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/stores/_sql_meta.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/crud/git.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/_interfaces/index_store.py"],"tokens_saved":2296},"candidates_emitted":0,"candidates_reduced_reason":"response_budget","candidates_total":50,"omission_marker":"[repowise#5fe350551fca: 273 lines omitted (~3223 tokens); restore: repowise expand 5fe350551fca]","results":[{"confidence_score":1.0,"page_type":"file_page","relevance_score":4.345,"snippet":"# packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py\n\n## Overview\n\nIndex `graph_nodes` on `(repository_id, node_type)`.\n\n`node_type == \"file\"` is the most-issued predicate on this tabl","sources":["fts","vector"],"target_path":"packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py","title":"File: packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py"},{"confidence_score":0.99,"page_type":"file_page","relevance_score":4.298,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_meta.py\n\n## Overview\n\nIndexStore mixin: repository, generation jobs, pages, chat, webhooks.\n\nThis mixin covers the \"meta\" surface \u2014 the top-l","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"confidence_score":0.92,"page_type":"file_page","relevance_score":3.983,"snippet":"# packages/server/src/repowise/server/schemas/repository.py\n\n## Overview\n\nRepository request/response models.\n\nIt exposes 9 public symbols and depends on 2 other files.\n\n## Public API\n\n| Symbol | Kind","sources":["fts","vector"],"target_path":"packages/server/src/repowise/server/schemas/repository.py","title":"File: packages/server/src/repowise/server/schemas/repository.py"},{"confidence_score":0.92,"page_type":"file_page","relevance_score":3.977,"snippet":"# packages/api-client/src/types/repository.ts\n\n## Overview\n\nTypes module repository defining RepoCreate, RepoUpdate, RepoResponse. `packages/api-client/src/types/repository.ts` is a typescript source","sources":["fts","vector"],"target_path":"packages/api-client/src/types/repository.ts","title":"File: packages/api-client/src/types/repository.ts"},{"confidence_score":0.91,"file":"packages/core/src/repowise/core/workspace/repo_index.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/workspace/repo_index.py::open_repo_index","page_type":"symbol_spotlight","relevance_score":3.951,"snippet":"# packages.core.src.repowise.core.workspace.repo_index.open_repo_index\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/workspace/repo_index.py` | **Estimated complexity:","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/workspace/repo_index.py::open_repo_index","target_path":"packages/core/src/repowise/core/workspace/repo_index.py","title":"Symbol: packages.core.src.repowise.core.workspace.repo_index.open_repo_index"},{"confidence_score":0.87,"page_type":"file_page","relevance_score":3.801,"snippet":"# packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py\n\n## Overview\n\nIndex `wiki_symbols` on `(repository_id, file_path)`.\n\nEvery file-scoped symbol lookup joins on this pair, but the o","sources":["fts","vector"],"target_path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","title":"File: packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"},{"confidence_score":0.86,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","page_type":"symbol_spotlight","relevance_score":3.75,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.upsert_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.upsert_repository"},{"confidence_score":0.75,"page_type":"file_page","relevance_score":3.246,"snippet":"# packages/core/src/repowise/core/workspace/repo_index.py\n\n## Overview\n\nRead-only index access for the cross-repo hooks.\n\nThe hooks run immediately after ingestion writes each repo's\n`.repowise/wiki.d","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/workspace/repo_index.py","title":"File: packages/core/src/repowise/core/workspace/repo_index.py"},{"confidence_score":0.74,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::get_repository","page_type":"symbol_spotlight","relevance_score":3.225,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.get_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estimate","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::get_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.get_repository"},{"confidence_score":0.73,"page_type":"file_page","relevance_score":3.183,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py\n\n## Overview\n\nIndexStore mixin: relational graph rows, external systems, symbols.\n\nThe \"graph records\" surface of `IndexStor","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py"},{"confidence_score":0.71,"page_type":"file_page","relevance_score":3.082,"snippet":"# packages/core/src/repowise/core/pipeline/full_index.py\n\n## Overview\n\nFull index-only pipeline run + persistence for a single repo.\n\nThe \"index this repo from scratch\" step shared by `repowise worksp","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/pipeline/full_index.py","title":"File: packages/core/src/repowise/core/pipeline/full_index.py"},{"confidence_score":0.71,"page_type":"file_page","relevance_score":3.069,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_analysis.py\n\n## Overview\n\nIndexStore mixin: git metadata, dead code, decisions, health, coverage.\n\nThe \"analysis\" surface of IndexStore \u2014 any","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_analysis.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_analysis.py"},{"confidence_score":0.66,"file":"packages/core/src/repowise/core/persistence/models.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/models.py::Repository","page_type":"symbol_spotlight","relevance_score":2.875,"snippet":"# Repository\n\n**Kind:** class | **Defined in:** `packages/core/src/repowise/core/persistence/models.py` | **Estimated complexity:** 1\n\n```\nclass Repository\n```\n\n## Overview\n\n`Repository` is a class de","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/models.py::Repository","target_path":"packages/core/src/repowise/core/persistence/models.py","title":"Symbol: packages/core/src/repowise/core/persistence/models.py::Repository"},{"confidence_score":0.65,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::delete_repository","page_type":"symbol_spotlight","relevance_score":2.831,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.delete_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::delete_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.delete_repository"},{"confidence_score":0.65,"page_type":"file_page","relevance_score":2.827,"snippet":"ore/src/repowise/core/persistence/stores/_sql_meta.py\n\n## Overview\n\nMeta-domain delegations for `SqlIndexStore`.\n\nEach method here is a one-to-one delegation to `crud`. Split out from\n`sql_index_store","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/stores/_sql_meta.py","title":"File: packages/core/src/repowise/core/persistence/stores/_sql_meta.py"},{"confidence_score":0.65,"page_type":"file_page","relevance_score":2.817,"snippet":"# packages/core/src/repowise/core/persistence/crud/repository.py\n\n## Overview\n\nCRUD operations for the repository domain (repowise persistence layer).\n\nSplit out of the former monolithic `crud.py`; `c","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"File: packages/core/src/repowise/core/persistence/crud/repository.py"},{"confidence_score":0.64,"page_type":"file_page","relevance_score":2.76,"snippet":"| --- | --- | --- |\n| `upsert_git_metadata` | function | async def upsert_git_metadata(session, *, repository_id, file_path, **kwargs) -> GitMetadata |\n| `get_git_metadata` | function | async def get","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/crud/git.py","title":"File: packages/core/src/repowise/core/persistence/crud/git.py"},{"confidence_score":0.63,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::list_page_ids","page_type":"symbol_spotlight","relevance_score":2.735,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.list_page_ids\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estimated","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::list_page_ids","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.list_page_ids"},{"confidence_score":0.62,"page_type":"file_page","relevance_score":2.673,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/index_store.py\n\n## Overview\n\nIndexStore \u2014 aggregate pluggable CRUD facade.\n\n`IndexStore` combines three domain mixins:\n\n- `MetaIndexStore` (re","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/index_store.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/index_store.py"}],"results_emitted":19,"results_reduced_reason":"response_budget","results_total":50,"truncated":true}}
\ No newline at end of file
+{"get_answer:how-question":{"_meta":{"cached":true,"completeness":{"capped":true,"reason":"confidence_projection_and_deduplication","shown":1,"total":15},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","projection":{"recovery":{"arguments":{"include":["evidence"],"question":"How does index the repository work?"},"tool":"get_answer"}},"response_budget":{"limit_chars":24000,"serialized_chars":4391,"tier":"default"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","timing_ms":11.19},"answer":"## What \u201cindexing\u201d means here\n\nThe retrieved code describes the **read side of an already-created repository index**, rather than the process that parses a repository from scratch. Ingestion writes each repository\u2019s `.repowise/wiki.db`; `RepoIndex` opens that database and exposes convenient lookup APIs over its contents (`packages/core/src/repowise/core/workspace/repo_index.py`).\n\n## Opening an index\n\nFor one repository, callers use:\n\n```python\nawait open_repo_index(alias, repo_path) -> RepoIndex | None\n```\n\n`open_repo_index` opens the repository\u2019s `wiki.db` read side and returns `None` when the repository has not been indexed (`packages/core/src/repowise/core/workspace/repo_index.py`).\n\nFor a workspace, `open_workspace_index(...)` opens the indexed repositories and returns a `WorkspaceIndex`. The workspace object maps repository aliases to `RepoIndex` instances; callers retrieve one with `get(alias)`. Repositories that fail to open are skipped, and an optional alias filter can restrict which repositories are opened.\n\nEach `RepoIndex` owns one database session/connection. The implementation stores:\n\n- the repository alias, path, and `repo_id`;\n- an in-memory index by file (`_by_file`);\n- an in-memory index by symbol name (`_by_name`);\n- external-import records (`_externals`).\n\nIts `_load` method queries `WikiSymbol` rows and graph-edge data from the database. After loading, accessors are pure in-memory reads, so worker-thread dialects can call them without issuing additional database queries. The `repo_id` is required so repository-scoped queries cannot accidentally return unrelated rows.\n\n## Lookup capabilities\n\nThe exposed API supports:\n\n- `symbols_for_file(rel_path)` \u2014 symbols declared in a POSIX, repo-relative file, outermost first;\n- `symbol_at(rel_path, line)` \u2014 symbol covering a line;\n- `declared_symbol_at(...)` \u2014 declaration-specific lookup;\n- `symbol_named(expression)` \u2014 resolve qualified or unqualified symbol expressions;\n- access to external imports and the underlying session.\n\nThe index stores source locations from ingestion. Those spans can become stale if files change afterward, so callers extracting source must bound or validate spans against the current content; `extractors.from_index` provides the related safety behavior. The connection is closed explicitly through `RepoIndex.close()` or `WorkspaceIndex.close()`.","candidates_emitted":0,"candidates_reduced_reason":"confidence_projection_and_deduplication","candidates_total":5,"citations":["packages/core/src/repowise/core/workspace/repo_index.py"],"confidence":"high","fallback_targets_emitted":0,"fallback_targets_reduced_reason":"confidence_projection_and_deduplication","fallback_targets_total":5,"flow_path":["packages/core/src/repowise/core/persistence/crud/repository.py -> packages/core/src/repowise/core/workspace/repo_index.py","packages/server/src/repowise/server/schemas/repository.py -> packages/core/src/repowise/core/ingestion/languages/specs/json.py -> packages/core/src/repowise/core/persistence/crud/repository.py"],"next_action_hint":"Use the answer and citations directly.","note":"High confidence: the top retrieval result clearly dominates, by 0.83 points over the runner-up (top score 5.27). Both scores are strong, so the gap is the measure here and not the ratio. Cite this answer; do not re-read the source unless a specific detail is missing.","quotes":[{"lines":[79,81],"path":"packages/core/src/repowise/core/workspace/repo_index.py","quote":"class RepoIndex:\n \"\"\"Read-only accessor over one repo's ``wiki.db``.\n"}],"quotes_emitted":1,"quotes_reduced_reason":"confidence_projection_and_deduplication","quotes_total":5,"retrieval_quality":"high"},"get_architecture:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":295,"tier":"default"},"runtime_breakage_proven":false},"error":"get_architecture is only available in workspace mode."},"get_blast_radius:one-target":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":295,"tier":"default"},"runtime_breakage_proven":false},"error":"get_blast_radius is only available in workspace mode."},"get_change_risk:head":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#fede8a95b801"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":275},"response_budget":{"limit_chars":24000,"serialized_chars":6116,"tier":"default"},"source":"live_git","state":{"truncated":true},"timing_ms":1412.0},"branch_overlap":{"base":"origin/main","branches":[{"ahead":2,"behind":2,"branch":"perf/mcp-startup-floor","files":[{"basis":"same file","file":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py"},{"basis":"same file","file":"packages/core/src/repowise/core/workspace/__init__.py"},{"basis":"same file","file":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"basis":"same file","file":"tests/unit/workspace/test_lazy_workspace_exports.py"}],"last_commit":"2026-09-09"},{"ahead":12,"behind":2,"branch":"origin/feat/index-freshness-hook","files":[{"basis":"same file","file":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"basis":"co-change pair, 3 of 6 commits","file":"packages/server/src/repowise/server/mcp_server/_meta.py","partner":"packages/core/src/repowise/core/workspace/__init__.py"}],"last_commit":"2026-09-09"}],"current":"fix/mcp-budget-accounting","scanned":50,"summary":"2 of 50 open branches (1068 exist) edit files this change also edits.","total":1068,"truncated":true},"change_shape":{"classification":"Typical","diagnostics_via":"get_change_risk(include=['diagnostics'])","fallback_band":null,"independent_changes":{"basis":"no import, call, type reference or co-change pair in the index links one group to another","count":3,"groups":[{"bridging_files":[],"files":["packages/cli/src/repowise/cli/commands/mcp_cmd.py"]},{"bridging_files":[],"files":["packages/cli/src/repowise/cli/editor_integrations/claude_config.py"]},{"bridging_files":[],"files":["packages/core/src/repowise/core/workspace/__init__.py"]}],"summary":"This diff is 3 independent changes: 1 file, 1 file and 1 file. 1 changed file is left out of the grouping: docs, config, tests, files not in the index, or files it has never linked.","ungrouped_files":["tests/unit/workspace/test_lazy_workspace_exports.py"]},"is_fix":false,"measures":"diff size and spread, not danger","review_priority":"moderate","risk_percentile":40.9,"score":8.2},"classification":"Typical","directive":{"headline":"No supported new findings surfaced in the analyzed scope.","next_actions":["Run: tests/unit/workspace/test_lazy_workspace_exports.py tests/unit/cli/test_agent_target_baseline.py tests/unit/cli/test_agent_targets.py"],"reasons":[],"status":"clear_in_analyzed_scope"},"exclude_patterns":[],"fallback_band":null,"fix_history":{"available":true,"density":0.768,"files":[{"churn":9,"fix_pressure":4.35,"path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py"},{"churn":5,"fix_pressure":1.94,"path":"packages/cli/src/repowise/cli/commands/mcp_cmd.py"},{"churn":226,"fix_pressure":0.88,"path":"packages/core/src/repowise/core/workspace/__init__.py"}],"percentile":21.2},"health_delta":{"analyzer":{"analyzer_version":10,"performance_model_version":2,"rules_fingerprint":"3e9c9fe763b725f9bb1d493656de4afd4ee75e189f42c98e96b0e4233630fe47"},"base":{"kind":"commit","ref":"HEAD^","sha":"7791e6401fa9da72b285bd224a6cf3257121e3da"},"basis":"both_sides_analyzed","by_dimension":{},"by_severity":{},"explanation":"No supported new findings surfaced in the analyzed scope.","findings_emitted":0,"findings_total":0,"head":{"kind":"commit","ref":"HEAD","sha":"920d1c973d647a5df41165225dae38b514b03ae1"},"introduced":0,"limits":["Both sides are analysed over the changed files only, so cross-file detectors (duplication, cross-function performance) see no wider context."],"resolved":1,"scope":{"analyzed":4,"changed":4,"eligible":4,"failed":0,"skipped":0},"status":"available","top_findings":[],"worsened":0},"impacted_tests":{"basis":"inferred","line_coverage":{"covered":[],"no_coverage_data":[],"stale_test_candidates":[],"untested_changes":[]},"map_present":false,"status":"inferred","summary":"29 test file(s) reach the changed files in the graph; showing first 10. Inferred from the dependency graph, not measured. For the line-precise answer build the map with `coverage run --contexts=test` then `repowise coverage add`.","tests_to_run":["tests/unit/workspace/test_lazy_workspace_exports.py","tests/unit/cli/test_agent_target_baseline.py","tests/unit/cli/test_agent_targets.py","tests/unit/cli/test_commands.py","tests/unit/cli/test_doctor_embed_recipe.py","tests/unit/cli/test_doctor_fts_drift.py","tests/unit/cli/test_doctor_honours_exclusions.py","tests/unit/cli/test_doctor_information_floor.py","tests/unit/cli/test_doctor_mcp_smoke.py","tests/unit/cli/test_doctor_page_cap.py"],"total":29,"truncated":true},"is_fix":false,"omission_marker":"[repowise#fede8a95b801: 25 lines omitted (~275 tokens); restore: repowise expand fede8a95b801]","prior_fixes":{"changed_lines_in_fixed_files":98,"concentration":"packages/core/src/repowise/core/workspace/__init__.py carries 50% of the changed lines and 1 past bug fix(es).","files":[{"changed_lines":4,"file_path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py","fix_count":5,"last_fix_days_ago":32,"overlapping_lines":0,"share_of_change":0.022},{"changed_lines":4,"file_path":"packages/cli/src/repowise/cli/commands/mcp_cmd.py","fix_count":2,"last_fix_days_ago":3,"overlapping_lines":0,"share_of_change":0.022},{"changed_lines":90,"file_path":"packages/core/src/repowise/core/workspace/__init__.py","fix_count":1,"last_fix_days_ago":68,"overlapping_lines":0,"share_of_change":0.5}],"files_with_fixes":3,"line_overlap":"approximate","summary":"8 past bug-fix commit(s) touched 3 of the changed file(s). Line overlap is approximate (past ranges are numbered on their own parent commit); the per-file counts are not.","total_fixes":8,"truncated":false},"ref":"HEAD","review_priority":"moderate","risk_percentile":40.9,"score":8.2,"working_tree":false},"get_conformance:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":294,"tier":"default"},"runtime_breakage_proven":false},"error":"get_conformance is only available in workspace mode."},"get_context:many-targets":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#6c9c3e123777"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":4507},"replaced_tokens":48638,"response_budget":{"limit_chars":32000,"serialized_chars":14278,"tier":"expanded"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","state":{"truncated":true},"timing_ms":62.24,"tokens_saved":45004},"dropped_symbols":{},"dropped_targets":[],"targets":{"packages/cli/src/repowise/cli/commands/update_cmd/command.py":{"_call_graph_note":"File-level rollup: importing files plus inbound cross-file call counts. For symbol-precise callers pass 'file.py::Symbol'.","architectural_layer":{"description":"Contains the command-line application runtime, command definitions, platform clients, agent targets, helpers, and telemetry handling.","name":"Contributor 15","role":"edge_connector"},"callers":[{"file":"tests/integration/test_cli.py","imports":true,"inbound_calls":2},{"file":"tests/unit/cli/test_update_reindex_notice.py","imports":true,"inbound_calls":2},{"file":"tests/unit/cli/test_update_renderer_gate.py","imports":true,"inbound_calls":2},{"file":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/workspace.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/watch_cmd.py","imports":true,"inbound_calls":1},{"file":"tests/unit/cli/test_update_full_dry_run.py","imports":true,"inbound_calls":1},{"file":"packages/cli/src/repowise/cli/commands/update_cmd/__init__.py","imports":true},{"file":"tests/unit/cli/test_docs_pointer.py","imports":true},{"file":"tests/unit/cli/test_editor_setup.py","imports":true},{"file":"tests/unit/cli/test_update_up_to_date_lock.py","imports":true},{"file":"tests/unit/cli/test_workspace_docs_pointer.py","imports":true}],"docs":{"summary":"`repowise update` \u2014 incremental wiki regeneration for changed files.","title":"File: packages/cli/src/repowise/cli/commands/update_cmd/command.py"},"episodes":26,"fix_history":{"bug_magnet":true,"fix_count":27,"last_fix_days_ago":1},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"14.2.2","target_path":"packages/cli/src/repowise/cli/commands/health_cmd","title":"Code Health Commands"},"path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","skeleton":{"bodies_kept":["run_update","_current_renderer_fingerprint","_renderer_inputs","_surface_reindex_recommendation","_docs_provider_prompt_allowed"],"full_tokens":23489,"mode":"smart","pct_of_full":8.9,"text":"\"\"\"``repowise update`` \u2014 incremental wiki regeneration for changed files.\n\nThis module holds the Click command + single-repo orchestration. The standalone\nhelpers it relies on live in sibling modules: mode resolution (:mod:`.mode`),\ncore delegators (:mod:`.incremental`), persistence + re-score\n(:mod:`.persistence`), the workspace flow (:mod:`.workspace`), and report\nrendering (:mod:`.reporting`).\n\"\"\"\nfrom __future__ import annotations\nimport sys\nimport time\nfrom enum import StrEnum\nfrom pathlib import Path\nfrom typing import Any\nimport click\nimport structlog\nfrom repowise.cli._setup import configure_cli_logging\nfrom repowise.cli.helpers import (\n ... 19 lines (23-41)\nfrom repowise.core.docs_mode import docs_mode_state_fields, resolve_docs_mode\nfrom repowise.core.pipeline import PhaseTimings, timed\nfrom repowise.core.reasoning import REASONING_MODES\nfrom .incremental import (\n ... 8 lines (47-54)\nfrom .mode import _resolve_index_only_mode\nfrom .persistence import (\n ... 6 lines (57-62)\nfrom .reporting import (\n ... 7 lines (64-70)\nfrom .workspace import _workspace_update\nlog = structlog.get_logger(__name__)\n... 6 lines (74-79)\n_EFFICACY_LOOKBACK_SECONDS = 7 * 86400.0\n\n\ndef _docs_provider_prompt_allowed(emitter: Any) -> bool:\n \"\"\"Whether a docs run may block on an interactive provider prompt.\n\n Requires a real terminal on *both* ends: a terminal stdout (so the table\n renders) and a tty stdin (so the answer can actually be read). The stdin\n check is what keeps a background post-commit hook or CI run from hanging\n even when it inherits a ``FORCE_COLOR`` that makes ``console.is_terminal``\n report True. ``--progress json`` (emitter set) is always non-interactive.\n \"\"\"\n return console.is_terminal and sys.stdin.isatty() and emitter is None\n\n\ndef _record_update_outcome(\n *,\n index_only: bool,\n changed_count: int,\n provider: Any = None,\n generated_pages: list | None = None,\n docs_mode: str | None = None,\n) -> None:\n \"\"\"Attach an anonymous update-shape outcome to the ``command_run`` event.\n... 30 lines (104-133)\n\n\ndef _refresh_editor_stamp(\n repo_path: Any, agents_md: bool | None, degraded: list[str] | None = None\n) -> None:\n \"\"\"Re-stamp managed editor files (CLAUDE.md / AGENTS.md), best-effort.\n... 21 lines (140-160)\n\n\ndef _surface_release_news(*, written_by: str | None) -> None:\n \"\"\"Show a post-upgrade \"what's new\" panel and a cached PyPI advisory.\n... 23 lines (165-187)\n\n\ndef _surface_reindex_recommendation(repo_path, verdict, *, emitter: Any, dry_run: bool) -> None:\n \"\"\"Show the once-per-store reindex recommendation for *verdict*, if any.\n\n Read-only except for the shown-notice ledger, so it is safe to call on the\n no-op (\"already up to date\") path as well as the main assessment path. It\n never runs the verdict's auto actions \u2014 those stay behind the single-flight\n lock in the main path. Interactive-terminal only, so a background post-commit\n update never burns the one-shot into a log the user never reads; `doctor`\n reports the recommendation on demand regardless.\n \"\"\"\n from repowise.cli.upgrade import (\n record_reindex_notice_shown,\n reindex_notice_already_shown,\n )\n\n if not (verdict.reindex_recommended and verdict.reindex_command):\n return\n ... 139 lines (207-345)\ndef update_command(\n ... 49 lines (347-395)\n\n\nclass UpdateOutcome(StrEnum):\n \"\"\"What a single-repo :func:`run_update` actually did.\n... 11 lines (400-410)\n\n\ndef _render_full_upgrade_dry_run(\n repo_path: Path,\n *,\n provider_name: str | None,\n model: str | None,\n) -> None:\n \"\"\"Describe a full upgrade without resolving providers or touching the store.\"\"\"\n ... 20 lines (420-439)\n\n\ndef _renderer_inputs(repo_path):\n \"\"\"The (language, style fingerprint, style template dir) a file page uses.\n\n Read from the persisted config so the fingerprint computed at the \"up to\n date\" gate matches the one the pages actually store. A wrong triple here\n would make every page look stale on every run (or none ever), so all three\n come from the same place generation reads them. The template dir is a\n custom style's own ``templates/`` (``None`` for a built-in style), tried\n ahead of the shipped template exactly as the generator's Jinja loader does.\n \"\"\"\n from repowise.cli.helpers import load_config\n from repowise.core.generation.styles import resolve_style\n\n cfg = load_config(repo_path)\n style = resolve_style(cfg.get(\"wiki_style\", \"comprehensive\"), repo_path=repo_path)\n return cfg.get(\"language\", \"en\"), style.fingerprint, style.template_dir\n\n\ndef _head_commit_ts(repo_path) -> float | None:\n \"\"\"Committer timestamp of the repo's HEAD, or None when git is unavailable.\n... 9 lines (462-470)\n\n\ndef _current_renderer_fingerprint(repo_path) -> str:\n \"\"\"This release's fingerprint for the structural renderers, or '' on failure.\n\n Covers every template with no model path behind it, because this value is\n what decides whether a repository with no new commits is \"already up to\n date\". Fingerprinting only the file page meant a release that improved the\n spotlight template alone returned before doing anything, and the change\n never reached an existing wiki.\n\n Cheap: reads the templates and a few constants, no parse. An empty result\n disables the renderer-staleness gate for this run rather than risking a\n spurious full re-render, which is the safe direction.\n \"\"\"\n try:\n from repowise.core.generation.page_generator.structural import (\n FILE_PAGE_TEMPLATE,\n SYMBOL_SPOTLIGHT_TEMPLATE,\n structural_fingerprint,\n )\n\n language, style_fp, template_dir = _renderer_inputs(repo_path)\n return \":\".join(\n structural_fingerprint(\n template,\n language=language,\n style_fingerprint=style_fp,\n template_dir=template_dir,\n ... 6 lines (500-505)\n\n\ndef _stale_renderer_paths(repo_path, parsed_files) -> list[str]:\n \"\"\"File paths whose stored pages predate the current structural renderers.\n... 37 lines (510-546)\n\n\ndef run_update(\n path: str | None,\n provider_name: str | None,\n model: str | None,\n since: str | None,\n reasoning: str | None,\n cascade_budget: int | None,\n dry_run: bool,\n workspace: bool,\n no_workspace: bool,\n repo_alias: str | None,\n index_only: bool = False,\n docs_flag: bool | None = None,\n full: bool = False,\n yes: bool = False,\n agents_md: bool | None = None,\n concurrency: int = 10,\n no_cost_tracking: bool = False,\n verbose: bool = False,\n progress: str = \"rich\",\n skip_cross_repo_hooks: bool = False,\n include_working_tree: bool = False,\n) -> UpdateOutcome:\n \"\"\"Incrementally update wiki pages for files changed since last sync.\n\n If `since` is None, the base commit is read from state.json's last_sync_commit.\n\n ``skip_cross_repo_hooks`` is set only by the workspace docs flow, which\n calls this per repo and then runs the cross-repo hooks once over every\n updated repo instead of once per repo.\n\n ``include_working_tree`` folds uncommitted work (staged, unstaged and\n untracked) into the change set on top of the commit range. Off by default,\n because every other caller is anchored to a commit \u2014 the post-commit hook,\n a webhook, a manual sync \u2014 and indexing a half-finished edit under those is\n not what the user asked for. ``repowise watch`` sets it: watching for file\n saves and then only ever diffing commit-to-commit is what made the watcher\n a no-op until you committed.\n \"\"\"\n start = time.monotonic()\n # Per-stage wall clock for this run, written to ``state.json`` as\n # ``phase_timings`` by the paths that rebuild the index. ``run`` is the\n # denominator; stages nest and overlap, so compare each against it and\n # never against their sum. The fast paths (already up to date, no changed\n # files, config-only re-score) do not record: they do no stage work and\n # would overwrite the last real run's numbers with nothing.\n timings = PhaseTimings()\n timings.start(\"run\")\n\n # --- Machine-readable progress (--progress json) --------------------\n # Silence structlog/stdlib logging and redirect the shared Rich console\n ... 1530 lines (600-2129)\n","tokens":2095,"verified":true},"target":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","type":"file"},"packages/core/src/repowise/core/ingestion/call_resolver.py":{"_call_graph_note":"File-level rollup: importing files plus inbound cross-file call counts. For symbol-precise callers pass 'file.py::Symbol'.","architectural_layer":{"description":"Implements repository ingestion, language parsing, code analysis, health evaluation, domain modeling, and supporting application utilities across the codebase.","name":"Contributor 4","role":"edge_connector"},"callers":[{"file":"tests/unit/ingestion/test_return_type_chain_resolution.py","imports":true,"inbound_calls":20},{"file":"tests/unit/ingestion/test_bare_name_index_kinds.py","imports":true,"inbound_calls":4},{"file":"tests/unit/ingestion/test_call_resolver_strategies.py","imports":true,"inbound_calls":3},{"file":"packages/core/src/repowise/core/ingestion/graph/_resolvers.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_elixir_bare_name_scope.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_enclosing_class_calls.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_jvm_calls.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_overload_set_uniqueness.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_php_luau_receivers.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_resolver_merged_index.py","imports":true,"inbound_calls":2},{"file":"tests/unit/ingestion/test_self_call_resolution.py","imports":true,"inbound_calls":2}],"docs":{"summary":"Three-tier call resolution engine for the symbol-level dependency graph.","title":"File: packages/core/src/repowise/core/ingestion/call_resolver.py"},"episodes":21,"fix_history":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"17.4","target_path":"packages/core/src/repowise/core/ingestion","title":"Ingestion Overview"},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","skeleton":{"bodies_kept":[],"full_tokens":25149,"mode":"smart","omitted":true,"pct_of_full":17.9,"text":"[repowise#6c9c3e123777: 508 lines omitted (~4507 tokens); restore: repowise expand 6c9c3e123777]","tokens":4507,"verified":true},"target":"packages/core/src/repowise/core/ingestion/call_resolver.py","type":"file"}},"truncated":true},"get_context:one-file":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","response_budget":{"limit_chars":24000,"serialized_chars":11328,"tier":"default"},"scope_hint":"Unrelated to what was served: Contributor 11 (1,478 files), Contributor 2 (641), Contributor 6 (261).","timing_ms":22.87},"targets":{"packages/core/src/repowise/core/ingestion/call_resolver.py":{"architectural_layer":{"description":"Implements repository ingestion, language parsing, code analysis, health evaluation, domain modeling, and supporting application utilities across the codebase.","name":"Contributor 4","role":"edge_connector"},"docs":{"summary":"Three-tier call resolution engine for the symbol-level dependency graph.","symbols":[{"kind":"variable","line":64,"name":"log","signature":"log = structlog.get_logger(__name__)","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::log"},{"kind":"constant","line":69,"name":"_IMPLICIT_RECEIVER_LANGUAGES","signature":"_IMPLICIT_RECEIVER_LANGUAGES = frozenset({\"java\", \"csharp\", \"cpp\", \"kotlin\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_IMPLICIT_RECEIVER_LANGUAGES"},{"kind":"constant","line":87,"name":"_INHERITED_LANGUAGES","signature":"_INHERITED_LANGUAGES = frozenset({\"kotlin\", \"python\", \"typescript\", \"swift\", \"csharp\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_INHERITED_LANGUAGES"},{"kind":"constant","line":103,"name":"_MAX_ANCESTOR_EXPAND_DEPTH","signature":"_MAX_ANCESTOR_EXPAND_DEPTH = 3","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_MAX_ANCESTOR_EXPAND_DEPTH"},{"kind":"class","line":107,"name":"_LanguageCallStrategies","signature":"class _LanguageCallStrategies","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_LanguageCallStrategies"},{"kind":"constant","line":122,"name":"_NO_LANGUAGE_STRATEGIES","signature":"_NO_LANGUAGE_STRATEGIES = _LanguageCallStrategies()","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_NO_LANGUAGE_STRATEGIES"},{"kind":"constant","line":124,"name":"_TYPED_RECEIVER","signature":"_TYPED_RECEIVER = (\"_resolve_typed_receiver\",)","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_TYPED_RECEIVER"},{"kind":"constant","line":129,"name":"_TYPE_KINDS","signature":"_TYPE_KINDS = frozenset({\"class\", \"struct\", \"interface\", \"enum\", \"trait\", \"impl\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_TYPE_KINDS"},{"kind":"constant","line":130,"name":"_FUNCTION_KINDS","signature":"_FUNCTION_KINDS = frozenset({\"function\", \"method\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_FUNCTION_KINDS"},{"kind":"constant","line":148,"name":"_NON_CALLABLE_KINDS","signature":"_NON_CALLABLE_KINDS = frozenset({\"property\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_NON_CALLABLE_KINDS"},{"kind":"constant","line":163,"name":"_JVM_STRATEGIES","signature":"_JVM_STRATEGIES = _LanguageCallStrategies(","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_JVM_STRATEGIES"},{"kind":"constant","line":173,"name":"_CPP_STRATEGIES","signature":"_CPP_STRATEGIES = _LanguageCallStrategies(","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_CPP_STRATEGIES"},{"kind":"constant","line":180,"name":"_LANGUAGE_CALL_STRATEGIES","signature":"_LANGUAGE_CALL_STRATEGIES: dict[str, _LanguageCallStrategies] = {","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_LANGUAGE_CALL_STRATEGIES"},{"kind":"constant","line":212,"name":"_SOURCE_CACHE_FILES","signature":"_SOURCE_CACHE_FILES = 4","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_SOURCE_CACHE_FILES"},{"kind":"constant","line":213,"name":"_BODY_TYPE_CACHE_ENTRIES","signature":"_BODY_TYPE_CACHE_ENTRIES = 2048","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::_BODY_TYPE_CACHE_ENTRIES"},{"kind":"constant","line":217,"name":"PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES","signature":"PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES: frozenset[str] = frozenset({\"cpp\"})","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES"},{"kind":"class","line":221,"name":"ResolvedCall","signature":"class ResolvedCall","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::ResolvedCall"},{"kind":"class","line":247,"name":"CallResolver","signature":"class CallResolver","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver"},{"kind":"method","line":260,"name":"__init__","signature":"def __init__( self, parsed_files: dict[str, ParsedFile], import_targets: dict[str, set[str]], *, repo_path: str | None = None, import_maps: Any | None = None, heritage_parents: dict[str, set[str]] | None = None, return_type_chain_languages: frozenset[str] | None = None, ) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::__init__"},{"kind":"method","line":409,"name":"_follow_barrel_exports","signature":"def _follow_barrel_exports(self) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_follow_barrel_exports"},{"kind":"method","line":511,"name":"_get_rust_crate_src","signature":"def _get_rust_crate_src(self) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_rust_crate_src"},{"kind":"method","line":533,"name":"_get_go_index","signature":"def _get_go_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_go_index"},{"kind":"method","line":562,"name":"_strategies_for","signature":"def _strategies_for(self, file_path: str) -> _LanguageCallStrategies","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_strategies_for"},{"kind":"method","line":568,"name":"_get_cpp_index","signature":"def _get_cpp_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_cpp_index"},{"kind":"method","line":640,"name":"_resolve_cpp_same_target","signature":"def _resolve_cpp_same_target( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_cpp_same_target"},{"kind":"method","line":663,"name":"_get_jvm_index","signature":"def _get_jvm_index(self) -> Any","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_get_jvm_index"},{"kind":"method","line":684,"name":"_resolve_jvm_same_package","signature":"def _resolve_jvm_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_jvm_same_package"},{"kind":"method","line":744,"name":"_resolve_jvm_receiver_same_package","signature":"def _resolve_jvm_receiver_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_jvm_receiver_same_package"},{"kind":"method","line":767,"name":"_resolve_go_package_call","signature":"def _resolve_go_package_call( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_go_package_call"},{"kind":"method","line":796,"name":"_resolve_go_same_package","signature":"def _resolve_go_same_package( self, file_path: str, call: CallSite, caller_id: str, ) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_go_same_package"},{"kind":"method","line":824,"name":"_build_indices","signature":"def _build_indices(self, parsed_files: dict[str, ParsedFile]) -> None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_build_indices"},{"kind":"method","line":879,"name":"_link_declarations","signature":"def _link_declarations( self, declarations: list[tuple[str, str, tuple[str | None, str]]], definitions: dict[tuple[str | None, str], list[tuple[str, str]]], ) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_link_declarations"},{"kind":"method","line":930,"name":"declaration_definitions","signature":"def declaration_definitions(self) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::declaration_definitions"},{"kind":"method","line":939,"name":"_redirect_to_definition","signature":"def _redirect_to_definition(self, resolved: ResolvedCall) -> ResolvedCall","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_redirect_to_definition"},{"kind":"method","line":961,"name":"_published","signature":"def _published(self, file_path: str, name: str) -> str | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_published"},{"kind":"method","line":978,"name":"_merged_symbols_for","signature":"def _merged_symbols_for(self, file_path: str) -> dict[str, str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_merged_symbols_for"},{"kind":"method","line":1017,"name":"_merged_methods_for","signature":"def _merged_methods_for(self, file_path: str) -> dict[tuple[str, str], str]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_merged_methods_for"},{"kind":"method","line":1030,"name":"resolve_file","signature":"def resolve_file(self, file_path: str, calls: list[CallSite]) -> list[ResolvedCall]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::resolve_file"},{"kind":"method","line":1052,"name":"_resolve_one","signature":"def _resolve_one(self, file_path: str, call: CallSite) -> ResolvedCall | None","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_one"},{"kind":"method","line":1083,"name":"_resolve_return_typed_chain","signature":"def _resolve_return_typed_chain( self, file_path: str, call: CallSite, caller_id: str, language: str, ) -> tuple[bool, ResolvedCall | None]","symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver::_resolve_return_typed_chain"}],"symbols_truncated":{"hint":"Call with compact=False or include=['full_doc'] for the full list.","shown":40,"total":89},"title":"File: packages/core/src/repowise/core/ingestion/call_resolver.py"},"episodes":21,"fix_history":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10},"freshness":{"confidence_score":1.0,"freshness_status":"stale","is_stale":true},"hotspot":true,"parent_page":{"section":"17.4","target_path":"packages/core/src/repowise/core/ingestion","title":"Ingestion Overview"},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","target":"packages/core/src/repowise/core/ingestion/call_resolver.py","type":"file"}}},"get_dead_code:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#b20f4f25756c"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":4031},"response_budget":{"limit_chars":24000,"serialized_chars":13223,"tier":"default"},"state":{"truncated":true}},"impact":{"recommendation":"Start with the 'high' tier \u2014 these have no references in the graph and are the strongest cleanup candidates. Confirm each (runtime-loaded config/bootstrap/database files are flagged but never auto-marked safe), then review 'medium' tier with your team.","safe_lines_reclaimable":0,"total_lines_reclaimable":2013},"omission_marker":"[repowise#b20f4f25756c: 35 lines omitted (~4031 tokens); restore: repowise expand b20f4f25756c]","summary":{"by_kind":{"unreachable_file":25,"unused_export":27,"unused_internal":508},"call_resolution_basis":[{"guessed_share":0.0,"language":"javascript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":2,"unresolved_call_sites":null},{"guessed_share":0.03,"language":"python","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":49295,"unresolved_call_sites":null},{"guessed_share":0.04,"language":"typescript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":5364,"unresolved_call_sites":null}],"deletable_lines":0,"filtered_findings":52,"safe_to_delete_count":1,"total_findings":560},"tiers":{"high":{"count":1,"description":"High confidence (>=0.8): No references found in the codebase. Strong cleanup candidates \u2014 review (especially runtime-loaded files) before deleting.","findings":[{"age_days":100,"commit_count_90d":0,"confidence":0.8,"end_line":null,"file_path":"packages/core/src/repowise/core/analysis/decision_gate.py","id":"finding_a6c9a04ac7c39bae9231","kind":"unreachable_file","last_commit_at":"2026-05-27T10:27:47","last_meaningful_change":"2026-05-27T10:27:47+00:00","lines":0,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":true,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":0,"safe_count":1,"truncated":false},"low":{"count":51,"description":"Low confidence (<0.5): Potentially used via dynamic imports or reflection. Investigate first.","findings":[{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_readme_hero.py","id":"finding_0f040cd55166f823bccf","kind":"unreachable_file","last_commit_at":"2026-08-12T15:52:24","last_meaningful_change":"2026-08-12T15:52:24+00:00","lines":350,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_plugin_content.py","id":"finding_29369eff6365a1b0293f","kind":"unreachable_file","last_commit_at":"2026-08-12T14:19:38","last_meaningful_change":"2026-08-12T14:19:38+00:00","lines":190,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_agent_matrix.py","id":"finding_4e063ba4bc6f9980ff00","kind":"unreachable_file","last_commit_at":"2026-08-24T11:59:28","last_meaningful_change":"2026-08-24T11:59:28+00:00","lines":180,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":18,"commit_count_90d":4,"confidence":0.4,"end_line":352,"file_path":"packages/server/src/repowise/server/mcp_server/_graph_utils.py","id":"finding_7866e0a83040cdca646e","kind":"unused_export","last_commit_at":"2026-09-04T06:25:06","last_meaningful_change":"2026-09-04T06:25:06+00:00","lines":138,"primary_owner":"Contributor 19","reason":"Public symbol 'build_visual_context' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":214,"symbol_kind":"function","symbol_name":"build_visual_context"},{"age_days":4,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/generate_http_types.py","id":"finding_c1cedf34ddebe7d261cb","kind":"unreachable_file","last_commit_at":"2026-08-31T03:51:20","last_meaningful_change":"2026-08-31T03:51:20+00:00","lines":130,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":87,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/ui/scripts/contrast-check.py","id":"finding_1b9b8063b93def0ff331","kind":"unreachable_file","last_commit_at":"2026-06-08T15:01:45","last_meaningful_change":"2026-06-08T15:01:45+00:00","lines":120,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":21,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/uninstall_cmd.py","id":"finding_4d056697ef3263430455","kind":"unreachable_file","last_commit_at":"2026-08-13T06:48:25","last_meaningful_change":"2026-08-13T06:48:25+00:00","lines":100,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":13,"commit_count_90d":4,"confidence":0.4,"end_line":117,"file_path":"packages/server/src/repowise/server/mcp_server/tool_refactoring.py","id":"finding_4368b4710bdc7ab05fcc","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Public symbol 'generate_refactoring_code' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":31,"symbol_kind":"function","symbol_name":"generate_refactoring_code"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_3393e63b818004f15f8d","kind":"unreachable_file","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":3,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/measure_mcp_response_sizes.py","id":"finding_16a533bd7dba51d593b6","kind":"unreachable_file","last_commit_at":"2026-08-31T09:13:01","last_meaningful_change":"2026-08-31T09:13:01+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":100,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_63e9ee35b2c0edb37176","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Public symbol 'get_architecture' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":32,"symbol_kind":"function","symbol_name":"get_architecture"},{"age_days":73,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/telemetry_cmd.py","id":"finding_f6e27d31e8b93df85fd9","kind":"unreachable_file","last_commit_at":"2026-06-22T11:35:27","last_meaningful_change":"2026-06-22T11:35:27+00:00","lines":50,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":24,"commit_count_90d":2,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/ui/result_panels.py","id":"finding_2f1914812c29533dd062","kind":"unreachable_file","last_commit_at":"2026-08-14T17:16:16","last_meaningful_change":"2026-08-14T17:16:16+00:00","lines":50,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":63,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"packages/vscode/src/extension.ts","id":"finding_e900c8cb8978cb1bd8ee","kind":"unreachable_file","last_commit_at":"2026-07-04T17:35:07","last_meaningful_change":"2026-07-04T17:35:07+00:00","lines":40,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":102,"commit_count_90d":0,"confidence":0.4,"end_line":null,"file_path":"scripts/benchmark_upgrade.py","id":"finding_2a035f9742fa48fd2731","kind":"unreachable_file","last_commit_at":"2026-05-24T06:00:26","last_meaningful_change":"2026-05-24T06:00:26+00:00","lines":40,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":3,"confidence":0.4,"end_line":103,"file_path":"packages/server/src/repowise/server/mcp_server/tool_repos.py","id":"finding_9849407bdffedca12fbb","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":35,"primary_owner":"joptimus","reason":"Public symbol 'list_repos' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":68,"symbol_kind":"function","symbol_name":"list_repos"},{"age_days":10,"commit_count_90d":3,"confidence":0.4,"end_line":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_repos.py","id":"finding_237d674ac8ed2dae134d","kind":"unreachable_file","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":30,"primary_owner":"joptimus","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":57,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_fda1711f7fc7dbcba35e","kind":"unused_export","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":22,"primary_owner":"Contributor 19","reason":"Public symbol 'useC4DocsPathSet' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":35,"symbol_kind":"function","symbol_name":"useC4DocsPathSet"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":87,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_f0e29b2242ddf3a75783","kind":"unused_export","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":22,"primary_owner":"Contributor 19","reason":"Public symbol 'useC4SelectionContext' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":65,"symbol_kind":"function","symbol_name":"useC4SelectionContext"},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_de52d15beb2b3cbcbf97","kind":"unreachable_file","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":20,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":2013,"safe_count":0,"truncated":true},"medium":{"count":0,"description":"Medium confidence (0.5-0.8): Likely unused but may have indirect references. Review before deleting.","findings":[],"lines":0,"safe_count":0,"truncated":false}}},"get_dead_code:limit-200":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":36,"total":50},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#1ee5d92d3242","repowise#31ab8534db9e"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":69631},"reductions":[],"response_budget":{"limit_chars":24000,"serialized_chars":22533,"tier":"default"},"state":{"truncated":true}},"limit_note":"Requested limit=200 exceeded the MCP transport budget and was clamped to 25. Use tier/directory/owner filters or paginate to see more findings.","omission_marker":"[repowise#31ab8534db9e: 299 lines omitted (~2233 tokens); restore: repowise expand 31ab8534db9e]","summary":{"by_kind":{"unreachable_file":25,"unused_export":27,"unused_internal":508},"call_resolution_basis":[{"guessed_share":0.0,"language":"javascript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":2,"unresolved_call_sites":null},{"guessed_share":0.03,"language":"python","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":49295,"unresolved_call_sites":null},{"guessed_share":0.04,"language":"typescript","note":"Call sites the resolver could not bind are not counted, so an empty list means no resolved edge reaches this symbol, not proof that nothing calls it.","resolved_call_edges":5364,"unresolved_call_sites":null}],"deletable_lines":0,"filtered_findings":560,"safe_to_delete_count":1,"total_findings":560},"tiers":{"high":{"count":1,"description":"High confidence (>=0.8): No references found in the codebase. Strong cleanup candidates \u2014 review (especially runtime-loaded files) before deleting.","findings":[{"age_days":100,"commit_count_90d":0,"confidence":0.8,"end_line":null,"file_path":"packages/core/src/repowise/core/analysis/decision_gate.py","id":"finding_a6c9a04ac7c39bae9231","kind":"unreachable_file","last_commit_at":"2026-05-27T10:27:47","last_meaningful_change":"2026-05-27T10:27:47+00:00","lines":0,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":true,"start_line":null,"symbol_kind":null,"symbol_name":null}],"lines":0,"safe_count":1,"truncated":false},"low":{"count":51,"description":"Low confidence (<0.5): Potentially used via dynamic imports or reflection. Investigate first.","findings":[{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_readme_hero.py","id":"finding_0f040cd55166f823bccf","kind":"unreachable_file","last_commit_at":"2026-08-12T15:52:24","last_meaningful_change":"2026-08-12T15:52:24+00:00","lines":350,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_plugin_content.py","id":"finding_29369eff6365a1b0293f","kind":"unreachable_file","last_commit_at":"2026-08-12T14:19:38","last_meaningful_change":"2026-08-12T14:19:38+00:00","lines":190,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":22,"commit_count_90d":5,"confidence":0.4,"end_line":null,"file_path":"scripts/gen_agent_matrix.py","id":"finding_4e063ba4bc6f9980ff00","kind":"unreachable_file","last_commit_at":"2026-08-24T11:59:28","last_meaningful_change":"2026-08-24T11:59:28+00:00","lines":180,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":18,"commit_count_90d":4,"confidence":0.4,"end_line":352,"file_path":"packages/server/src/repowise/server/mcp_server/_graph_utils.py","id":"finding_7866e0a83040cdca646e","kind":"unused_export","last_commit_at":"2026-09-04T06:25:06","last_meaningful_change":"2026-09-04T06:25:06+00:00","lines":138,"primary_owner":"Contributor 19","reason":"Public symbol 'build_visual_context' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":214,"symbol_kind":"function","symbol_name":"build_visual_context"},{"age_days":4,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/generate_http_types.py","id":"finding_c1cedf34ddebe7d261cb","kind":"unreachable_file","last_commit_at":"2026-08-31T03:51:20","last_meaningful_change":"2026-08-31T03:51:20+00:00","lines":130,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":87,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/ui/scripts/contrast-check.py","id":"finding_1b9b8063b93def0ff331","kind":"unreachable_file","last_commit_at":"2026-06-08T15:01:45","last_meaningful_change":"2026-06-08T15:01:45+00:00","lines":120,"primary_owner":"Contributor 22","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":21,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/uninstall_cmd.py","id":"finding_4d056697ef3263430455","kind":"unreachable_file","last_commit_at":"2026-08-13T06:48:25","last_meaningful_change":"2026-08-13T06:48:25+00:00","lines":100,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":13,"commit_count_90d":4,"confidence":0.4,"end_line":117,"file_path":"packages/server/src/repowise/server/mcp_server/tool_refactoring.py","id":"finding_4368b4710bdc7ab05fcc","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Public symbol 'generate_refactoring_code' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":31,"symbol_kind":"function","symbol_name":"generate_refactoring_code"},{"age_days":109,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/web/src/lib/hooks/use-c4-context.ts","id":"finding_3393e63b818004f15f8d","kind":"unreachable_file","last_commit_at":"2026-07-27T11:24:34","last_meaningful_change":"2026-07-27T11:24:34+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":3,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"scripts/measure_mcp_response_sizes.py","id":"finding_16a533bd7dba51d593b6","kind":"unreachable_file","last_commit_at":"2026-08-31T09:13:01","last_meaningful_change":"2026-08-31T09:13:01+00:00","lines":70,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":["script"],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null},{"age_days":10,"commit_count_90d":2,"confidence":0.4,"end_line":100,"file_path":"packages/server/src/repowise/server/mcp_server/tool_architecture.py","id":"finding_63e9ee35b2c0edb37176","kind":"unused_export","last_commit_at":"2026-08-28T17:33:56","last_meaningful_change":"2026-08-28T17:33:56+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Public symbol 'get_architecture' has no importers","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":32,"symbol_kind":"function","symbol_name":"get_architecture"},{"age_days":73,"commit_count_90d":1,"confidence":0.4,"end_line":null,"file_path":"packages/cli/src/repowise/cli/commands/telemetry_cmd.py","id":"finding_f6e27d31e8b93df85fd9","kind":"unreachable_file","last_commit_at":"2026-06-22T11:35:27","last_meaningful_change":"2026-06-22T11:35:27+00:00","lines":50,"primary_owner":"Contributor 19","reason":"File has no importers (in_degree=0)","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":null,"symbol_kind":null,"symbol_name":null}],"findings_emitted":12,"findings_omitted":13,"findings_reduced_reason":"response_budget","findings_total":25,"findings_truncated":true,"lines":2013,"safe_count":0,"truncated":true},"medium":{"count":508,"description":"Medium confidence (0.5-0.8): Likely unused but may have indirect references. Review before deleting.","findings":[{"age_days":19,"commit_count_90d":1,"confidence":0.65,"end_line":224,"file_path":"packages/vscode/webview/src/views/settings/App.tsx","id":"finding_b075fd8305a7974411b7","kind":"unused_internal","last_commit_at":"2026-08-15T04:52:49","last_meaningful_change":"2026-08-15T04:52:49+00:00","lines":175,"primary_owner":"Contributor 19","reason":"Private symbol 'GROUPS' is not used anywhere","repository":"default","risk_factors":["config"],"safe_to_delete":false,"start_line":49,"symbol_kind":"constant","symbol_name":"GROUPS"},{"age_days":21,"commit_count_90d":4,"confidence":0.65,"end_line":638,"file_path":"packages/core/src/repowise/core/generation/onboarding/subkinds/key_concepts.py","id":"finding_be86c5b82740d8059283","kind":"unused_internal","last_commit_at":"2026-08-17T08:07:51","last_meaningful_change":"2026-08-17T08:07:51+00:00","lines":159,"primary_owner":"Contributor 19","reason":"Private symbol '_build' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":479,"symbol_kind":"function","symbol_name":"_build"},{"age_days":101,"commit_count_90d":2,"confidence":0.65,"end_line":173,"file_path":"packages/ui/src/c4/nodes/LayerClusterNode.tsx","id":"finding_c6ddde3060cf14ca3310","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":147,"primary_owner":"Contributor 22","reason":"Private symbol 'LayerClusterNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":26,"symbol_kind":"function","symbol_name":"LayerClusterNodeImpl"},{"age_days":22,"commit_count_90d":3,"confidence":0.65,"end_line":589,"file_path":"packages/core/src/repowise/core/ingestion/sfc_source.py","id":"finding_27b06007ec3b456791b8","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":144,"primary_owner":"Contributor 19","reason":"Private symbol '_razor_byte_scan' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":445,"symbol_kind":"function","symbol_name":"_razor_byte_scan"},{"age_days":101,"commit_count_90d":1,"confidence":0.65,"end_line":148,"file_path":"packages/ui/src/c4/nodes/ArchFileNode.tsx","id":"finding_7897e8b0e5b192dc04f3","kind":"unused_internal","last_commit_at":"2026-06-06T13:25:45","last_meaningful_change":"2026-06-06T13:25:45+00:00","lines":125,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchFileNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":23,"symbol_kind":"function","symbol_name":"ArchFileNodeImpl"},{"age_days":22,"commit_count_90d":3,"confidence":0.65,"end_line":484,"file_path":"packages/core/src/repowise/core/persistence/database.py","id":"finding_f8da2bf875ed65e153ee","kind":"unused_internal","last_commit_at":"2026-09-05T13:30:40","last_meaningful_change":"2026-09-05T13:30:40+00:00","lines":118,"primary_owner":"Contributor 19","reason":"Private symbol '_reconcile_schema' is not used anywhere","repository":"default","risk_factors":["database"],"safe_to_delete":false,"start_line":366,"symbol_kind":"function","symbol_name":"_reconcile_schema"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":508,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_97db30e3d8a29e1f728f","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":96,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_c_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":412,"symbol_kind":"function","symbol_name":"_resolve_c_type_refs"},{"age_days":101,"commit_count_90d":2,"confidence":0.65,"end_line":115,"file_path":"packages/ui/src/c4/nodes/ArchContainerNode.tsx","id":"finding_4cf23634a04a6a87e7f8","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":95,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchContainerNodeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":20,"symbol_kind":"function","symbol_name":"ArchContainerNodeImpl"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":638,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_3494eba7bab882eb59ec","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":91,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_ts_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":547,"symbol_kind":"function","symbol_name":"_resolve_ts_type_refs"},{"age_days":19,"commit_count_90d":1,"confidence":0.65,"end_line":151,"file_path":"packages/core/src/repowise/core/generation/onboarding/subkinds/active_landscape.py","id":"finding_de7b2aff5fc207d79981","kind":"unused_internal","last_commit_at":"2026-08-15T09:40:34","last_meaningful_change":"2026-08-15T09:40:34+00:00","lines":87,"primary_owner":"Contributor 19","reason":"Private symbol '_build' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":64,"symbol_kind":"function","symbol_name":"_build"},{"age_days":101,"commit_count_90d":1,"confidence":0.65,"end_line":142,"file_path":"packages/ui/src/graph-primitives/edge-renderer.tsx","id":"finding_eade40e87507df4bdae7","kind":"unused_internal","last_commit_at":"2026-06-06T13:25:45","last_meaningful_change":"2026-06-06T13:25:45+00:00","lines":87,"primary_owner":"Contributor 22","reason":"Private symbol 'ArchEdgeRendererImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":55,"symbol_kind":"function","symbol_name":"ArchEdgeRendererImpl"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1208,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_798475db14d41278d3f8","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":86,"primary_owner":"Contributor 19","reason":"Private symbol '_ts_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":1122,"symbol_kind":"function","symbol_name":"_ts_head_type_identifier"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":366,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_0320a6bd2eeb4c7b9686","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":83,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_go_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":283,"symbol_kind":"function","symbol_name":"_resolve_go_type_refs"},{"age_days":76,"commit_count_90d":1,"confidence":0.65,"end_line":94,"file_path":"packages/ui/src/workspace/system-map/system-map-edge.tsx","id":"finding_cde5d1605847ffe10cd1","kind":"unused_internal","last_commit_at":"2026-06-19T07:53:16","last_meaningful_change":"2026-06-19T07:53:16+00:00","lines":74,"primary_owner":"Contributor 19","reason":"Private symbol 'SystemMapEdgeInner' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":20,"symbol_kind":"function","symbol_name":"SystemMapEdgeInner"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":213,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_a72b31224fbeb674507a","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":72,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_dockerfile' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":141,"symbol_kind":"function","symbol_name":"_parse_dockerfile"},{"age_days":109,"commit_count_90d":2,"confidence":0.65,"end_line":90,"file_path":"packages/ui/src/c4/edges/RelationEdge.tsx","id":"finding_d11a1aeaa4becb88db2c","kind":"unused_internal","last_commit_at":"2026-06-23T10:24:32","last_meaningful_change":"2026-06-23T10:24:32+00:00","lines":72,"primary_owner":"Contributor 19","reason":"Private symbol 'RelationEdgeImpl' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":18,"symbol_kind":"function","symbol_name":"RelationEdgeImpl"},{"age_days":9,"commit_count_90d":4,"confidence":0.65,"end_line":831,"file_path":"packages/server/src/repowise/server/job_executor.py","id":"finding_ea3a8bb0f7e7024be0d4","kind":"unused_internal","last_commit_at":"2026-09-07T11:41:26","last_meaningful_change":"2026-09-07T11:41:26+00:00","lines":71,"primary_owner":"Contributor 19","reason":"Private symbol '_persist_initial_index_state' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":760,"symbol_kind":"function","symbol_name":"_persist_initial_index_state"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":125,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_4c6222d665b3595e0493","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":70,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_openapi' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":55,"symbol_kind":"function","symbol_name":"_parse_openapi"},{"age_days":18,"commit_count_90d":4,"confidence":0.65,"end_line":741,"file_path":"packages/core/src/repowise/core/ingestion/type_ref_resolution.py","id":"finding_60313f5eee105a75790e","kind":"unused_internal","last_commit_at":"2026-08-22T16:05:26","last_meaningful_change":"2026-08-22T16:05:26+00:00","lines":68,"primary_owner":"Contributor 19","reason":"Private symbol '_resolve_jvm_type_refs' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":673,"symbol_kind":"function","symbol_name":"_resolve_jvm_type_refs"},{"age_days":20,"commit_count_90d":3,"confidence":0.65,"end_line":112,"file_path":"packages/core/src/repowise/core/ingestion/graph_warmups.py","id":"finding_56627b474c7331f636f9","kind":"unused_internal","last_commit_at":"2026-09-04T13:27:00","last_meaningful_change":"2026-09-04T13:27:00+00:00","lines":62,"primary_owner":"Contributor 19","reason":"Private symbol '_warmup_jvm' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":50,"symbol_kind":"function","symbol_name":"_warmup_jvm"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1060,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_f2ff92755f90a64d9b11","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":62,"primary_owner":"Contributor 19","reason":"Private symbol '_go_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":998,"symbol_kind":"function","symbol_name":"_go_head_type_identifier"},{"age_days":22,"commit_count_90d":11,"confidence":0.65,"end_line":1276,"file_path":"packages/core/src/repowise/core/ingestion/parser_helpers.py","id":"finding_391c43bb421d142b8094","kind":"unused_internal","last_commit_at":"2026-09-04T18:23:23","last_meaningful_change":"2026-09-04T18:23:23+00:00","lines":61,"primary_owner":"Contributor 19","reason":"Private symbol '_java_head_type_identifier' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":1215,"symbol_kind":"function","symbol_name":"_java_head_type_identifier"},{"age_days":161,"commit_count_90d":1,"confidence":0.65,"end_line":285,"file_path":"packages/core/src/repowise/core/ingestion/special_handlers.py","id":"finding_f3d3afff206d3be963cf","kind":"unused_internal","last_commit_at":"2026-07-04T11:15:25","last_meaningful_change":"2026-07-04T11:15:25+00:00","lines":59,"primary_owner":"Contributor 19","reason":"Private symbol '_parse_makefile' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":226,"symbol_kind":"function","symbol_name":"_parse_makefile"},{"age_days":20,"commit_count_90d":3,"confidence":0.65,"end_line":173,"file_path":"packages/core/src/repowise/core/ingestion/graph_warmups.py","id":"finding_d645a649dd73cd608107","kind":"unused_internal","last_commit_at":"2026-09-04T13:27:00","last_meaningful_change":"2026-09-04T13:27:00+00:00","lines":58,"primary_owner":"Contributor 19","reason":"Private symbol '_warmup_cpp' is not used anywhere","repository":"default","risk_factors":[],"safe_to_delete":false,"start_line":115,"symbol_kind":"function","symbol_name":"_warmup_cpp"}],"findings_emitted":24,"findings_omitted":1,"findings_reduced_reason":"response_budget","findings_total":25,"findings_truncated":true,"lines":5444,"safe_count":0,"truncated":true}},"truncated":true},"get_dependency_path:two-files":{"_meta":{"completeness":{"capped":false},"contract_version":1,"evidence_kind":"structural","response_budget":{"limit_chars":24000,"serialized_chars":2005,"tier":"default"},"runtime_breakage_proven":false},"distance":-1,"explanation":"No direct dependency path found","path":[],"visual_context":{"bridge_suggestions":[{"node":"external:typing","pagerank":0.02358},{"node":"external:dataclasses","pagerank":0.02038},{"node":"tests/conftest.py","pagerank":0.02011},{"node":"external:pathlib","pagerank":0.01869},{"node":"external:collections.abc","pagerank":0.01618}],"community":{"same_community":false,"source_community":3,"target_community":2},"disconnected":false,"nearest_common_ancestors":[{"distance_from_source":1,"distance_from_target":1,"node":"external:typing"},{"distance_from_source":1,"distance_from_target":1,"node":"external:structlog"},{"distance_from_source":1,"distance_from_target":1,"node":"external:pathlib"},{"distance_from_source":2,"distance_from_target":1,"node":"packages/core/src/repowise/core/docs_mode.py"},{"distance_from_source":2,"distance_from_target":1,"node":"packages/cli/src/repowise/cli/commands/upgrade_flow.py"}],"reverse_path":{"distance":5,"exists":true,"note":"A path exists in the reverse direction (packages/cli/src/repowise/cli/commands/update_cmd/command.py -> packages/core/src/repowise/core/ingestion/call_resolver.py). The dependency flows the other way.","path":["packages/cli/src/repowise/cli/commands/update_cmd/command.py","packages/core/src/repowise/core/ingestion/__init__.py","packages/core/src/repowise/core/ingestion/graph/__init__.py","packages/core/src/repowise/core/ingestion/graph/builder.py","packages/core/src/repowise/core/ingestion/graph/_resolvers.py","packages/core/src/repowise/core/ingestion/call_resolver.py"]},"shared_neighbors":["external:pathlib","external:structlog","external:typing"],"suggestion":"No direct path, but both nodes connect through 'external:typing'. This shared dependency may be the architectural bridge point."}},"get_execution_flows:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","hint":"Use get_context(include=['callers','callees']) on any trace node for detail.","index_age_days":0,"indexed_commit":"920d1c973d64","replaced_tokens":2160,"response_budget":{"limit_chars":24000,"serialized_chars":4969,"tier":"default"},"runtime_breakage_proven":false,"timing_ms":1155.0,"tokens_saved":870},"flows":[{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/vscode/webview/src/views/graph/App.tsx::App","entry_point_name":"App","entry_point_score":0.95,"termination":"no_callees","trace":["packages/vscode/webview/src/views/graph/App.tsx::App","packages/vscode/webview/src/views/graph/App.tsx::CommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::GraphCommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::FactGrid","packages/ui/src/graph/graph-community-panel.tsx::FactValue"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","entry_point_name":"execute","entry_point_score":0.928,"termination":"no_callees","trace":["packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::_announce_total","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_announce_paid"],"trace_via":["self_scope","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/git.py::get_risk_range","entry_point_name":"get_risk_range","entry_point_score":0.843,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/git.py::get_risk_range","packages/server/src/repowise/server/routers/git.py::_revision_exists"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","entry_point_name":"HealthOverviewCard","entry_point_score":0.838,"termination":"no_callees","trace":["packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","packages/ui/src/dashboard/health-overview-card.tsx::AccuracyStrip"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/costs.py::get_distill_savings","entry_point_name":"get_distill_savings","entry_point_score":0.831,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/costs.py::get_distill_savings","packages/server/src/repowise/server/routers/costs.py::_parse_since"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/ownership-table.tsx::OwnershipTable","entry_point_name":"OwnershipTable","entry_point_score":0.83,"termination":"no_callees","trace":["packages/ui/src/git/ownership-table.tsx::OwnershipTable","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","entry_point_name":"DecisionsTimeline","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","entry_point_name":"HotspotsMini","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","packages/ui/src/dashboard/hotspots-mini.tsx::getChurnColor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","entry_point_name":"ModuleMinimap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","entry_point_name":"OwnershipTreemap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]}],"total_entry_points":10},"get_execution_flows:top-100-depth-20":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":45,"total":50},"contract_version":1,"embedder_degraded":false,"evidence_kind":"structural","hint":"Use get_context(include=['callers','callees']) on any trace node for detail.","index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#54b10477a47c","repowise#94e97218a71a"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":761},"replaced_tokens":6000,"response_budget":{"limit_chars":24000,"serialized_chars":22639,"tier":"default"},"runtime_breakage_proven":false,"state":{"truncated":true},"timing_ms":1286.0,"tokens_saved":102},"flows":[{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/vscode/webview/src/views/graph/App.tsx::App","entry_point_name":"App","entry_point_score":0.95,"termination":"no_callees","trace":["packages/vscode/webview/src/views/graph/App.tsx::App","packages/vscode/webview/src/views/graph/App.tsx::CommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::GraphCommunityPanel","packages/ui/src/graph/graph-community-panel.tsx::FactGrid","packages/ui/src/graph/graph-community-panel.tsx::FactValue"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","entry_point_name":"execute","entry_point_score":0.928,"termination":"no_callees","trace":["packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::execute","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_GenerationRun::_announce_total","packages/core/src/repowise/core/generation/page_generator/orchestrate.py::_announce_paid"],"trace_via":["self_scope","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/git.py::get_risk_range","entry_point_name":"get_risk_range","entry_point_score":0.843,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/git.py::get_risk_range","packages/server/src/repowise/server/routers/git.py::_revision_exists"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","entry_point_name":"HealthOverviewCard","entry_point_score":0.838,"termination":"no_callees","trace":["packages/ui/src/dashboard/health-overview-card.tsx::HealthOverviewCard","packages/ui/src/dashboard/health-overview-card.tsx::AccuracyStrip"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/costs.py::get_distill_savings","entry_point_name":"get_distill_savings","entry_point_score":0.831,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/costs.py::get_distill_savings","packages/server/src/repowise/server/routers/costs.py::_parse_since"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/ownership-table.tsx::OwnershipTable","entry_point_name":"OwnershipTable","entry_point_score":0.83,"termination":"no_callees","trace":["packages/ui/src/git/ownership-table.tsx::OwnershipTable","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","entry_point_name":"DecisionsTimeline","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/decisions-timeline.tsx::DecisionsTimeline","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","entry_point_name":"HotspotsMini","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/hotspots-mini.tsx::HotspotsMini","packages/ui/src/dashboard/hotspots-mini.tsx::getChurnColor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","entry_point_name":"ModuleMinimap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-minimap.tsx::ModuleMinimap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","entry_point_name":"OwnershipTreemap","entry_point_score":0.826,"termination":"no_callees","trace":["packages/ui/src/dashboard/ownership-treemap.tsx::OwnershipTreemap","packages/ui/src/ui/card.tsx::Card","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/graph/community.py::get_community_detail","entry_point_name":"get_community_detail","entry_point_score":0.825,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/graph/community.py::get_community_detail","packages/server/src/repowise/server/mcp_server/_graph_utils.py::community_cohesion","packages/server/src/repowise/server/mcp_server/_graph_utils.py::parse_community_meta"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/health/kpi-cards.tsx::HealthKpiCards","entry_point_name":"HealthKpiCards","entry_point_score":0.821,"termination":"no_callees","trace":["packages/ui/src/health/kpi-cards.tsx::HealthKpiCards","packages/ui/src/health/kpi-cards.tsx::InlineStat","packages/ui/src/health/sparkline.tsx::Sparkline"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":0,"entry_point":"packages/ui/src/health/ai-prompt-builder.ts::buildGalaxyMapAiPrompt","entry_point_name":"buildGalaxyMapAiPrompt","entry_point_score":0.821,"termination":"no_callees","trace":["packages/ui/src/health/ai-prompt-builder.ts::buildGalaxyMapAiPrompt"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/modules.py::get_module_health","entry_point_name":"get_module_health","entry_point_score":0.821,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/modules.py::get_module_health","packages/server/src/repowise/server/routers/modules.py::_decision_refs","packages/server/src/repowise/server/schemas/ownership.py::GoverningDecisionRef"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_plan_page","entry_point_name":"get_refactoring_plan_page","entry_point_score":0.821,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_plan_page","packages/server/src/repowise/server/routers/refactoring.py::RefactoringPlanPageResponse"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_mermaid","entry_point_name":"get_c4_mermaid","entry_point_score":0.816,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_mermaid","packages/server/src/repowise/server/services/c4_builder/mermaid.py::to_mermaid_l1","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_emit_externals","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_external_line","packages/server/src/repowise/server/services/c4_builder/mermaid.py::_ext_kind"],"trace_via":["import_scoped","same_file","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_workspace_graph","entry_point_name":"get_workspace_graph","entry_point_score":0.816,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_workspace_graph","packages/server/src/repowise/server/routers/workspace.py::_query_repo_stats","packages/core/src/repowise/core/docs_mode.py::resolve_docs_mode"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/dashboard/commits-mini.tsx::CommitsMini","entry_point_name":"CommitsMini","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/commits-mini.tsx::CommitsMini","packages/ui/src/lib/format.ts::formatRelativeTime","packages/ui/src/lib/format.ts::parseDate"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/module-overview-grid.tsx::ModuleOverviewGrid","entry_point_name":"ModuleOverviewGrid","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/module-overview-grid.tsx::ModuleOverviewGrid","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/dashboard/savings-mini.tsx::SavingsMini","entry_point_name":"SavingsMini","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/dashboard/savings-mini.tsx::SavingsMini","packages/ui/src/lib/format.ts::formatCost"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/git/contributors-strip.tsx::ContributorsStrip","entry_point_name":"ContributorsStrip","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/git/contributors-strip.tsx::ContributorsStrip","packages/ui/src/git/contributors-strip.tsx::firstName"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/ui/src/graph/graph-context-drawer.tsx::GraphContextDrawer","entry_point_name":"GraphContextDrawer","entry_point_score":0.815,"termination":"no_callees","trace":["packages/ui/src/graph/graph-context-drawer.tsx::GraphContextDrawer","packages/ui/src/graph/node-badges.tsx::NodeBadges","packages/ui/src/lib/cn.ts::cn"],"trace_via":["import_scoped","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l1","entry_point_name":"get_c4_l1","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l1","packages/server/src/repowise/server/routers/c4.py::_person","packages/server/src/repowise/server/schemas/c4.py::C4PersonResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l3","entry_point_name":"get_c4_l3","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l3","packages/server/src/repowise/server/routers/c4.py::_component","packages/server/src/repowise/server/schemas/c4.py::C4ComponentResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/decisions.py::get_decision_graph","entry_point_name":"get_decision_graph","entry_point_score":0.81,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/decisions.py::get_decision_graph","packages/server/src/repowise/server/schemas/decisions.py::DecisionCodeEdge"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/cli/src/repowise/cli/commands/init_cmd/command.py::init_command","entry_point_name":"init_command","entry_point_score":0.809,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/init_cmd/command.py::init_command","packages/cli/src/repowise/cli/commands/init_cmd/command.py::_print_structural_plan","packages/cli/src/repowise/cli/commands/init_cmd/generation.py::page_type_label"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/ui/src/graph/centrality-leaderboard.tsx::CentralityLeaderboard","entry_point_name":"CentralityLeaderboard","entry_point_score":0.807,"termination":"no_callees","trace":["packages/ui/src/graph/centrality-leaderboard.tsx::CentralityLeaderboard","packages/ui/src/graph/centrality-leaderboard.tsx::score"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/cli/src/repowise/cli/commands/health_cmd/command.py::health_command","entry_point_name":"health_command","entry_point_score":0.805,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/health_cmd/command.py::health_command","packages/cli/src/repowise/cli/_setup.py::configure_cli_logging"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/vscode/webview/src/views/decisions/App.tsx::App","entry_point_name":"App","entry_point_score":0.805,"termination":"confidence_filtered","termination_detail":{"global_unique":1},"trace":["packages/vscode/webview/src/views/decisions/App.tsx::App","packages/vscode/webview/src/views/decisions/App.tsx::DecisionsSkeleton"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/web/src/app/repos/[id]/overview/page.tsx::OverviewPage","entry_point_name":"OverviewPage","entry_point_score":0.804,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/overview/page.tsx::OverviewPage","packages/web/src/app/repos/[id]/overview/page.tsx::safeFetch"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/web/src/app/repos/[id]/costs/page.tsx::CostsPage","entry_point_name":"CostsPage","entry_point_score":0.803,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/costs/page.tsx::CostsPage","packages/api-client/src/costs.ts::getCostSummary","packages/api-client/src/client.ts::apiGet","packages/api-client/src/client.ts::buildHeaders","packages/api-client/src/client.ts::resolveToken"],"trace_via":["import_scoped","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/vscode/src/extension.ts::activate","entry_point_name":"activate","entry_point_score":0.802,"termination":"confidence_filtered","termination_detail":{"global_unique":1},"trace":["packages/vscode/src/extension.ts::activate","packages/vscode/src/extension.ts::checkSetup"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/c4.py::get_c4_l2","entry_point_name":"get_c4_l2","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/c4.py::get_c4_l2","packages/server/src/repowise/server/routers/c4.py::_container","packages/server/src/repowise/server/schemas/c4.py::C4ContainerResponse"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/knowledge_map.py::get_knowledge_map","entry_point_name":"get_knowledge_map","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/knowledge_map.py::get_knowledge_map","packages/server/src/repowise/server/schemas/ownership.py::KnowledgeMapOwner"],"trace_via":["import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_targets","entry_point_name":"get_refactoring_targets","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/refactoring.py::get_refactoring_targets","packages/server/src/repowise/server/routers/refactoring.py::RefactoringSummary"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/server/src/repowise/server/routers/repos.py::create_repo","entry_point_name":"create_repo","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/repos.py::create_repo","packages/server/src/repowise/server/routers/repos.py::_enqueue_index_job","packages/server/src/repowise/server/routers/repos.py::_launch_job_task","packages/server/src/repowise/server/routers/repos.py::_resolve_repo_session_factory","packages/server/src/repowise/server/deps.py::resolve_session_factory"],"trace_via":["same_file","same_file","same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_workspace","entry_point_name":"get_workspace","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_workspace","packages/server/src/repowise/server/routers/workspace.py::_query_repo_stats","packages/core/src/repowise/core/docs_mode.py::resolve_docs_mode"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":3,"entry_point":"packages/server/src/repowise/server/routers/graph/intelligence.py::get_execution_flows","entry_point_name":"get_execution_flows","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/graph/intelligence.py::get_execution_flows","packages/server/src/repowise/server/mcp_server/_graph_utils.py::bfs_trace","packages/server/src/repowise/server/mcp_server/_graph_utils.py::_node_id_is_excluded","packages/core/src/repowise/core/analysis/execution_graph.py::is_excluded_execution_path"],"trace_via":["import_scoped","same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/server/src/repowise/server/routers/workspace.py::get_contract_detail","entry_point_name":"get_contract_detail","entry_point_score":0.802,"termination":"no_callees","trace":["packages/server/src/repowise/server/routers/workspace.py::get_contract_detail","packages/server/src/repowise/server/routers/workspace.py::_contract_entry","packages/server/src/repowise/server/schemas/workspace.py::WorkspaceContractEntry"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/cli/src/repowise/cli/commands/saved_cmd.py::saved_command","entry_point_name":"saved_command","entry_point_score":0.799,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/saved_cmd.py::saved_command","packages/cli/src/repowise/cli/commands/saved_cmd.py::_estimate_usd","packages/core/src/repowise/core/generation/cost_tracker.py::get_model_pricing","packages/core/src/repowise/core/generation/cost_tracker.py::_get_pricing","packages/core/src/repowise/core/generation/cost_tracker.py::_family_pricing"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/web/src/app/repos/[id]/code-health/page.tsx::CodeHealthPage","entry_point_name":"CodeHealthPage","entry_point_score":0.799,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/code-health/page.tsx::CodeHealthPage","packages/web/src/app/repos/[id]/code-health/page.tsx::ViewSelect","packages/ui/src/ui/select.tsx::Select"],"trace_via":["same_file","import_scoped"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/cli/src/repowise/cli/commands/dead_code_cmd.py::dead_code_command","entry_point_name":"dead_code_command","entry_point_score":0.798,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/dead_code_cmd.py::dead_code_command","packages/cli/src/repowise/cli/helpers.py::load_state","packages/cli/src/repowise/cli/helpers.py::get_repowise_dir"],"trace_via":["import_scoped","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":4,"entry_point":"packages/cli/src/repowise/cli/commands/restyle_cmd.py::restyle_command","entry_point_name":"restyle_command","entry_point_score":0.798,"termination":"no_callees","trace":["packages/cli/src/repowise/cli/commands/restyle_cmd.py::restyle_command","packages/cli/src/repowise/cli/commands/restyle_cmd.py::_print_styles","packages/core/src/repowise/core/generation/styles/registry.py::list_styles","packages/core/src/repowise/core/generation/styles/registry.py::_load_custom_style","packages/core/src/repowise/core/generation/styles/registry.py::_clip"],"trace_via":["same_file","import_scoped","same_file","same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":1,"entry_point":"packages/web/src/app/repos/[id]/refactoring/page.tsx::RefactoringPage","entry_point_name":"RefactoringPage","entry_point_score":0.797,"termination":"no_callees","trace":["packages/web/src/app/repos/[id]/refactoring/page.tsx::RefactoringPage","packages/web/src/app/repos/[id]/refactoring/page.tsx::leadTypeFor"],"trace_via":["same_file"]},{"communities_visited":[0],"crosses_community":false,"depth":2,"entry_point":"packages/vscode/webview/src/views/risk/App.tsx::App","entry_point_name":"App","entry_point_score":0.797,"termination":"no_callees","trace":["packages/vscode/webview/src/views/risk/App.tsx::App","packages/vscode/webview/src/views/risk/App.tsx::ChangeImpact","packages/vscode/webview/src/views/risk/App.tsx::DirectRiskRow"],"trace_via":["same_file","same_file"]}],"flows_emitted":45,"flows_omitted":5,"flows_reduced_reason":"response_budget","flows_total":50,"flows_truncated":true,"omission_marker":"[repowise#94e97218a71a: 26 lines omitted (~201 tokens); restore: repowise expand 94e97218a71a]","total_entry_points":50,"truncated":true},"get_health:all-includes":{"_meta":{"completeness":{"capped":true,"reason":"collection_cap_and_response_budget","shown":80,"total":1855},"contract_version":2,"embedder":"mock","embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-30T14:04:24.529401","analyzed_commit":"547df91a7e7b","analyzed_commits_distinct":2,"live_verification":{"basis":"index_commit_and_live_git_head","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-30T14:04:24.529401","health_analyzed_commit":"547df91a7e7b","health_analyzed_commits_distinct":2,"index_age_days":0,"index_behind":true,"index_scope":{"content_provenance":"model","fingerprint":"4a1aa5b83bd6","full":"get_overview()","git_tier":"full","projection":"compact","run_mode":"standard","status":"partial","version":1},"indexed_commit":"eaf9fb2638af","live_head":"303f55f1785c","omitted":{"refs":["repowise#7c7d4b4978b4","repowise#b0df000b1f03"],"restore":"`repowise expand <ref>`, or get_symbol(\"repowise#<ref>\", query=...)","tokens":22235},"reductions":[{"emitted":0,"field":"performance_summary.facets.context","reason":"response_budget","total":3},{"emitted":0,"field":"performance_summary.facets.boundary","reason":"response_budget","total":5},{"emitted":0,"field":"performance_summary.facets.confidence","reason":"response_budget","total":1},{"emitted":0,"field":"performance_summary.facets.actionability","reason":"response_budget","total":3},{"emitted":0,"field":"performance_summary.facets.plan_state","reason":"response_budget","total":2}],"response_budget":{"limit_chars":32000,"serialized_chars":30504,"tier":"expanded"},"semantic_search":false,"stale_warning":"Index is behind live HEAD \u2014 run `repowise update`.","state":{"truncated":true},"timing_ms":1515.0},"counts":"everything","distribution":{"bands":{"at_risk":{"files":180,"nloc":103273,"pct":13.6},"excellent":{"files":3312,"nloc":388454,"pct":51.0},"fair":{"files":261,"nloc":78236,"pct":10.3},"good":{"files":570,"nloc":140575,"pct":18.4},"needs_work":{"files":138,"nloc":51446,"pct":6.8}},"total_files":4461,"total_nloc":761984},"fix_first":{"basis":{"analyzed_commit":"547df91a7e7ba6e01f7457ac2172e09a36ad47a6","health_analyzed_at":"2026-09-30T14:04:24.529401"},"by_improves":{"defect":768,"maintainability":157,"performance":122},"detail_call":"get_health(fix_id='fix1_97d425a56a911cf78db4')","items":[{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_d21fb1bde221e8df007e","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ae647f629da0ef35d96e"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/analysis/health/complexity/walker.py","line_end":208,"line_start":152,"symbol":"walk_file"},"tier":"now","title":"Extract a helper from walk_file","why":"walk_file has more branches than its tests can easily cover; 8 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_fba1d37b9cbd137f45e7","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_f679a97d234a223b34f5"},"tool":"get_health"},"target":{"file_path":"packages/web/src/components/code-health/triage-tab.tsx","line_end":121,"line_start":71,"symbol":"TriageTab"},"tier":"now","title":"Extract a helper from TriageTab","why":"TriageTab has more branches than its tests can easily cover; it changed 6 times in 90 days, so the cost recurs."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_26c2da3b4c98f8fdef56","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_5ca551b7b7c3293951d0"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/repo_db.py","line_end":null,"line_start":null,"symbol":"ensure_repo_registration"},"tier":"next","title":"Batch the database calls loops make through ensure_repo_registration","why":"ensure_repo_registration makes a database call once per loop iteration; 2 call sites reach it, an entry point reaches it, the loop grows with the data."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_f17556ad6537b1c26c98","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_29080eb5a091e8eeb79d"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/job_executor.py","line_end":null,"line_start":null,"symbol":"_start_job"},"tier":"next","title":"Move the database call in _start_job out of its loop","why":"_start_job makes a database call once per loop iteration; an entry point reaches it, the loop grows with the data."}],"items_emitted":5,"items_total":5,"lead":{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},"model_version":1,"totals":{"candidates":2834,"eligible":1047,"excluded":{"below_min_worth":428,"expected":148,"generated":4,"history_only":137,"no_plan":12,"test":804,"tooling":254},"shown":5}},"gap_analysis":{"files_below_target":860,"files_for_half_gap":22,"files_to_reach_target":57,"target_score":8.0,"weighted_gap_points":324845,"weighted_gross_gap_points":925602},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":69.6,"maintainability_score":1.3,"max_ccn":249,"max_nesting":5,"module":"packages/cli","nloc":1810,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"run_update nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":1.4,"total_deduction":9.213,"weighted_deficit":12670},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/incremental.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.35,"maintainability_score":2.0,"max_ccn":54,"max_nesting":5,"module":"packages/core","nloc":1727,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_incremental_index nests 5 levels deep","score":1.41,"share_of_repo_gap_pct":1.2,"total_deduction":8.569,"weighted_deficit":11381},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":75.35,"maintainability_score":2.8,"max_ccn":162,"max_nesting":4,"module":"packages/cli","nloc":1535,"performance_score":10.0,"primary_biomarker":"brain_method","primary_reason":"Brain Method: init_command is 739 lines, CCN 162, in a file imported by 7 others","score":1.01,"share_of_repo_gap_pct":1.2,"total_deduction":8.985,"weighted_deficit":10730},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/workspace_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.45,"maintainability_score":1.3,"max_ccn":29,"max_nesting":4,"module":"packages/cli","nloc":1341,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"workspace_scan nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":1.0,"total_deduction":9.1,"weighted_deficit":9387},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_test_file":true,"is_test":false,"line_coverage_pct":92.35,"maintainability_score":3.1,"max_ccn":25,"max_nesting":6,"module":"packages/core","nloc":1460,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_find_parent nests 6 levels deep","score":1.74,"share_of_repo_gap_pct":1.0,"total_deduction":8.258,"weighted_deficit":9140},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":1.3,"max_ccn":74,"max_nesting":5,"module":"packages/cli","nloc":1279,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_persist_full_update_async nests 5 levels deep","score":1.11,"share_of_repo_gap_pct":1.0,"total_deduction":8.538,"weighted_deficit":8812},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/dead_code/analyzer.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":4.2,"max_ccn":27,"max_nesting":5,"module":"packages/core","nloc":1352,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_get_unsatisfied_prop_guard nests 5 levels deep","score":1.71,"share_of_repo_gap_pct":0.9,"total_deduction":8.291,"weighted_deficit":8504},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":78.67,"maintainability_score":2.0,"max_ccn":24,"max_nesting":4,"module":"packages/cli","nloc":1121,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"validate_provider_config nests 4 levels deep","score":1.15,"share_of_repo_gap_pct":0.8,"total_deduction":8.85,"weighted_deficit":7679},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_change_risk.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":46,"max_nesting":4,"module":"packages/server","nloc":1173,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_cross_repo_block nests 4 levels deep","score":2.01,"share_of_repo_gap_pct":0.8,"total_deduction":7.99,"weighted_deficit":7026},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/engine.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.77,"maintainability_score":1.7,"max_ccn":30,"max_nesting":4,"module":"packages/core","nloc":1013,"performance_score":9.58,"primary_biomarker":"god_class","primary_reason":"HealthAnalyzer is a god class: 669 lines across 19 methods, including a brain method (analyze_async, CCN 30)","score":1.12,"share_of_repo_gap_pct":0.8,"total_deduction":8.73,"weighted_deficit":6969},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/git_indexer/indexer.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.98,"maintainability_score":2.0,"max_ccn":42,"max_nesting":4,"module":"packages/core","nloc":1047,"performance_score":10.0,"primary_biomarker":"god_class","primary_reason":"GitIndexer is a god class: 760 lines across 24 methods, including a brain method (index_changed_files, CCN 42)","score":1.44,"share_of_repo_gap_pct":0.7,"total_deduction":8.555,"weighted_deficit":6868},{"branch_coverage_pct":null,"file_path":"packages/ui/src/graph/graph-flow.tsx","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":4.0,"max_ccn":260,"max_nesting":7,"module":"packages/ui","nloc":1235,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"GraphFlow nests 7 levels deep","score":2.5,"share_of_repo_gap_pct":0.7,"total_deduction":7.5,"weighted_deficit":6792},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.68,"maintainability_score":2.5,"max_ccn":43,"max_nesting":7,"module":"packages/core","nloc":1001,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"find_npm_script_entry_targets nests 7 levels deep","score":1.43,"share_of_repo_gap_pct":0.7,"total_deduction":8.571,"weighted_deficit":6577},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/workspace/update.py","has_test_file":true,"is_test":false,"line_coverage_pct":87.58,"maintainability_score":2.0,"max_ccn":31,"max_nesting":6,"module":"packages/core","nloc":968,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_merged_repo_excludes nests 6 levels deep","score":1.5,"share_of_repo_gap_pct":0.7,"total_deduction":8.499,"weighted_deficit":6292},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":35,"max_nesting":5,"module":"packages/core","nloc":1819,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_analysis nests 5 levels deep","score":4.57,"share_of_repo_gap_pct":0.7,"total_deduction":5.089,"weighted_deficit":6239},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/decision_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":16.05,"maintainability_score":7.7,"max_ccn":8,"max_nesting":3,"module":"packages/cli","nloc":877,"performance_score":10.0,"primary_biomarker":"coverage_gap","primary_reason":"204/243 lines uncovered (16% line coverage)","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":9.151,"weighted_deficit":6139},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/ui/provider_selection.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.2,"maintainability_score":3.1,"max_ccn":22,"max_nesting":4,"module":"packages/cli","nloc":851,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_interactive_openai_compatible_select nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.919,"weighted_deficit":5957},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/security_scan.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.82,"maintainability_score":3.1,"max_ccn":52,"max_nesting":5,"module":"packages/core","nloc":828,"performance_score":8.6,"primary_biomarker":"nested_complexity","primary_reason":"scan_source nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.597,"weighted_deficit":5796},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/generation/context/assembler.py","has_test_file":true,"is_test":false,"line_coverage_pct":89.71,"maintainability_score":2.8,"max_ccn":32,"max_nesting":5,"module":"packages/core","nloc":898,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"assemble_repo_overview nests 5 levels deep","score":1.59,"share_of_repo_gap_pct":0.6,"total_deduction":8.414,"weighted_deficit":5756},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/perf/dialects/python.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":3.3,"max_ccn":28,"max_nesting":4,"module":"packages/core","nloc":892,"performance_score":10.0,"primary_biomarker":"complex_conditional","primary_reason":"if condition combines 5 boolean operators","score":1.61,"share_of_repo_gap_pct":0.6,"total_deduction":8.045,"weighted_deficit":5700},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/doctor_cmd/repo_checks.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":1.3,"max_ccn":69,"max_nesting":4,"module":"packages/cli","nloc":884,"performance_score":9.3,"primary_biomarker":"brain_method","primary_reason":"Brain Method: _run_repo_checks is 468 lines, CCN 69, in a file imported by 15 others","score":1.65,"share_of_repo_gap_pct":0.6,"total_deduction":8.002,"weighted_deficit":5613},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py","has_test_file":true,"is_test":false,"line_coverage_pct":89.32,"maintainability_score":2.5,"max_ccn":18,"max_nesting":5,"module":"packages/cli","nloc":850,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"claude_code_leftover_reason nests 5 levels deep","score":1.42,"share_of_repo_gap_pct":0.6,"total_deduction":8.422,"weighted_deficit":5593},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_context/targets.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.59,"maintainability_score":4.0,"max_ccn":176,"max_nesting":5,"module":"packages/server","nloc":942,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_resolve_one_target nests 5 levels deep","score":2.16,"share_of_repo_gap_pct":0.6,"total_deduction":7.838,"weighted_deficit":5501}],"high_leverage_files_emitted":23,"high_leverage_files_omitted":755,"high_leverage_files_reduced_reason":"limit_and_response_budget","high_leverage_files_total":778,"high_leverage_files_truncated":true,"kpis":{"average_health":7.57,"average_health_unweighted":8.79,"average_health_weighting":"nloc","band":"good","file_count":4461,"history_average":1.0,"hotspot_health":5.84,"maintainability_average":8.08,"performance_analyzed_files":4459,"performance_average":9.74,"performance_coverage_pct":100.0,"performance_covered_files":4452,"performance_findings":1061,"performance_findings_density_per_10k_loc":13.93,"performance_skipped_files":7,"performance_unsupported_languages":[["shell",7]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.43,"worst_performer_path":"packages/cli/src/repowise/cli/commands/serve_cmd.py","worst_performer_score":1.0,"worst_test_path":"packages/core/src/repowise/core/analysis/test_impact.py","worst_test_score":2.0},"mode":"dashboard","omission_marker":"[repowise#b0df000b1f03: 25 lines omitted (~172 tokens); restore: repowise expand b0df000b1f03]","performance_opportunities":[{"actionability_reason":"strategy_requires_validation","actionability_state":"advisory","affected_call_sites_total":8,"affected_files_total":5,"biomarker_type":"io_in_loop","biomarker_types":["io_in_loop"],"biomarker_types_emitted":1,"biomarker_types_total":1,"boundary_kind":"db","confidence":"high","evidence":[{"biomarker_type":"io_in_loop","file_path":"packages/core/src/repowise/core/persistence/crud/decision_ingest.py","finding_id":"finding_a28156f45bdc525925d3","function_name":"bulk_upsert_decisions","line_end":208,"line_start":208,"path":["packages/core/src/repowise/core/persistence/crud/decision_ingest.py::bulk_upsert_decisions","packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record","packages/core/src/repowise/core/persistence/decision_graph.py::sync_decision_node_links"],"path_emitted":3,"path_total":3,"provenance":"call-site","reason":"a database call is reached once per loop iteration through bulk_upsert_decisions -> sync_links_from_record -> sync_decision_node_links (cross-function N+1 query)"},{"biomarker_type":"io_in_loop","file_path":"packages/core/src/repowise/core/persistence/crud/decision_staleness.py","finding_id":"finding_87e3241ec84d98ad4eb2","function_name":"recompute_decision_staleness","line_end":93,"line_start":93,"path":["packages/core/src/repowise/core/persistence/crud/decision_staleness.py::recompute_decision_staleness","packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record","packages/core/src/repowise/core/persistence/decision_graph.py::sync_decision_node_links"],"path_emitted":3,"path_total":3,"provenance":"call-site","reason":"a database call is reached once per loop iteration through recompute_decision_staleness -> sync_links_from_record -> sync_decision_node_links (cross-function N+1 query)"},{"biomarker_type":"io_in_loop","file_path":"packages/core/src/repowise/core/persistence/decision_dedupe.py","finding_id":"finding_f403adb11591ee210497","function_name":"apply_dedupe","line_end":393,"line_start":393,"path":["packages/core/src/repowise/core/persistence/decision_dedupe.py::apply_dedupe","packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record","packages/core/src/repowise/core/persistence/decision_graph.py::sync_decision_node_links"],"path_emitted":3,"path_total":3,"provenance":"call-site","reason":"a database call is reached once per loop iteration through apply_dedupe -> sync_links_from_record -> sync_decision_node_links (cross-function N+1 query)"}],"evidence_emitted":3,"evidence_next_cursor":3,"evidence_reduced_reason":"evidence_page","evidence_total":8,"evidence_truncated":true,"execution_context":"production","facets":{"actionability_confidence":"medium","amplification":"per_iteration","change_risk":"wide","exposure":"entry_reachable","leverage":"shared","loop_magnitude":"grows_with_data"},"file_path":"packages/core/src/repowise/core/persistence/decision_graph.py","fix":{"rationale":"The shared I/O sink is proven; no concrete batch API or result-equivalence proof is available.","safety":"advisory","strategy":"batch_or_prefetch_io"},"intervention_symbol":"packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record","observations_total":8,"opportunity_id":"perf2_e4f7e2faf8f17903562d","performance_model_version":2,"plan_economics":{"benefit":2.996,"cost":5.0,"effort_bucket":"XL","risk":3.889},"plan_id":"f4b65c2839824c29801d866006483a8f","plan_reason":"A stored performance plan addresses this exact opportunity.","plan_reference":"refac2_8cdc4ea10cf6c05d400d","plan_status":"available","plan_steps":[{"action":"Add a form of sync_links_from_record that takes every key at once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_graph.py","line":null,"order":1,"symbol":"packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/crud/decision_ingest.py","line":208,"order":2,"symbol":"bulk_upsert_decisions"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/crud/decision_staleness.py","line":93,"order":3,"symbol":"recompute_decision_staleness"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_dedupe.py","line":393,"order":4,"symbol":"apply_dedupe"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_manifest.py","line":322,"order":5,"symbol":"import_manifest"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_manifest.py","line":330,"order":6,"symbol":"import_manifest"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_migration.py","line":382,"order":7,"symbol":"apply_migration"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_migration.py","line":587,"order":8,"symbol":"backfill_decision_node_links"},{"action":"Collect the keys before the loop and call the batched form once","applicability":"judgment","file_path":"packages/core/src/repowise/core/persistence/decision_migration.py","line":653,"order":9,"symbol":"prune_unindexed_scope_files"}],"plan_steps_emitted":9,"plan_steps_total":9,"prerequisites":["batch_api_contract","result_equivalence"],"prerequisites_emitted":2,"prerequisites_total":2,"provenance":"call-site","rank_factors":{"affected_call_sites":6,"boundary_kind":4,"entry_reachability":3,"execution_context":3,"loop_magnitude":2,"multiplier_shape":4,"provenance":3},"rank_position":0,"rank_score":25,"reliable_entry_reachability":true,"resource_fingerprints":[],"resource_fingerprints_emitted":0,"resource_fingerprints_total":0,"shared_path_suffix":["packages/core/src/repowise/core/persistence/decision_graph.py::sync_links_from_record","packages/core/src/repowise/core/persistence/decision_graph.py::sync_decision_node_links"],"shared_path_suffix_emitted":2,"shared_path_suffix_total":2,"siblings":[],"siblings_emitted":0,"siblings_total":0,"terminal_sink":"packages/core/src/repowise/core/persistence/decision_graph.py::sync_decision_node_links","validation":{"basis":"inferred","commands":["pytest tests/unit/persistence/test_decision_acceptance_provenance.py tests/unit/persistence/test_decision_authority.py tests/unit/persistence/test_decision_candidate_meta_capture.py tests/unit/persistence/test_decision_conventions_persist.py tests/unit/persistence/test_decision_evidence.py tests/unit/persistence/test_decision_evolution_update.py tests/unit/persistence/test_decision_graph.py tests/unit/persistence/test_decision_kinds.py tests/unit/persistence/test_decision_manifest.py tests/unit/persistence/test_decision_migration.py tests/unit/persistence/test_decision_scope_basis.py tests/unit/persistence/test_decision_semantic_dedup.py"],"commands_emitted":1,"commands_total":1,"tests":["tests/unit/persistence/test_decision_acceptance_provenance.py","tests/unit/persistence/test_decision_authority.py","tests/unit/persistence/test_decision_candidate_meta_capture.py","tests/unit/persistence/test_decision_conventions_persist.py","tests/unit/persistence/test_decision_evidence.py","tests/unit/persistence/test_decision_evolution_update.py","tests/unit/persistence/test_decision_graph.py","tests/unit/persistence/test_decision_kinds.py","tests/unit/persistence/test_decision_manifest.py","tests/unit/persistence/test_decision_migration.py","tests/unit/persistence/test_decision_scope_basis.py","tests/unit/persistence/test_decision_semantic_dedup.py"],"tests_emitted":12,"tests_total":12,"total":69,"via":"call-graph"},"why_ranked":[{"factor":"affected_call_sites","points":6,"value":8},{"factor":"boundary_kind","points":4,"value":"db"},{"factor":"multiplier_shape","points":4,"value":"io_in_loop"}],"why_ranked_emitted":3,"why_ranked_total":3}],"performance_opportunities_emitted":1,"performance_opportunities_omitted":202,"performance_opportunities_reduced_reason":"collection_cap_and_response_budget","performance_opportunities_total":203,"performance_opportunities_truncated":true,"recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=100)","remaining":678},"performance_opportunities":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=6, only=['performance_opportunities'], refactoring_view='diversified', cursor=6)","remaining":197},"refactoring_opportunities":{"call":"get_health(targets=[], include=['files', 'refactoring', 'performance'], repo=None, limit=6, only=['refactoring_opportunities'], refactoring_view='diversified', cursor=6)","remaining":794}},"refactoring_opportunities":[{"addresses_primary_problem":true,"affected_files_total":1,"confidence":"high","dependents":8,"effort_bucket":"S","evidence_total":0,"file_nloc":218,"file_path":"packages/core/src/repowise/core/analysis/health/complexity/walker.py","judgment_steps":0,"lead_biomarker":"complex_method","lead_refactoring_type":"extract_method","mechanical_steps":1,"opportunity_id":"refop2_ae647f629da0ef35d96e","queue_position":0,"rank_factors":{"benefit":1.694,"cost":1.0,"mechanical_share":0.5,"primary_problem":0.5,"risk":0.0},"rank_position":0,"rank_score":1.694,"recoverable_health":1.694,"refactoring_model_version":2,"status":"open","step_count":1,"steps":[{"applicability":{"classification":"mechanical","facts":{"affected_file_count":1,"blast_size":0,"confidence":"high","cross_file":false,"local_scope":true},"reasons":["dataflow_proved_local_extraction"],"reasons_emitted":1,"reasons_total":1,"unknowns":[],"unknowns_emitted":0,"unknowns_total":0},"confidence":"high","effort_bucket":"S","file_path":"packages/core/src/repowise/core/analysis/health/complexity/walker.py","finding_ids":["finding_2b453a22e0c1b5255f17"],"finding_ids_emitted":1,"finding_ids_total":1,"impact_delta":1.694,"line_end":208,"line_start":94,"plan_id":"refac2_9346327bc364ff91125c","refactoring_type":"extract_method","relocated_by":null,"source_biomarker":"complex_method","target_symbol":"walk_file","validation_profile_id":"validation_987b19c9e18ff1bb"}],"steps_emitted":1,"steps_total":1,"why_ranked":[{"factor":"benefit","value":1.694},{"factor":"cost","value":1.0},{"factor":"mechanical_share","value":0.5}],"why_ranked_emitted":3,"why_ranked_total":3}],"refactoring_opportunities_emitted":1,"refactoring_opportunities_omitted":799,"refactoring_opportunities_reduced_reason":"collection_cap_and_response_budget","refactoring_opportunities_total":800,"refactoring_opportunities_truncated":true,"scope":"all","secondary_rankings":{"modules":{"call":"get_health(repo=None, only=['modules'], limit=50)","total":13},"test_findings":{"call":"get_health(repo=None, only=['test_findings'], limit=50)","total":464},"test_worst_files":{"call":"get_health(repo=None, only=['test_worst_files'], limit=50)","total":1736},"top_findings":{"call":"get_health(repo=None, only=['top_findings'], limit=50)","total":597},"worst_files":{"call":"get_health(repo=None, only=['worst_files'], limit=50)","total":2725}},"truncated":true,"unknown_include_keys":["files"],"unknown_include_keys_emitted":1,"unknown_include_keys_total":1,"unscored_files":0},"get_health:default":{"_meta":{"completeness":{"capped":true,"reason":"limit","shown":26,"total":784},"contract_version":2,"embedder":"mock","embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-30T14:04:24.529401","analyzed_commit":"547df91a7e7b","analyzed_commits_distinct":2,"live_verification":{"basis":"index_commit_and_live_git_head","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-30T14:04:24.529401","health_analyzed_commit":"547df91a7e7b","health_analyzed_commits_distinct":2,"index_age_days":0,"index_behind":true,"index_scope":{"content_provenance":"model","fingerprint":"4a1aa5b83bd6","full":"get_overview()","git_tier":"full","projection":"compact","run_mode":"standard","status":"partial","version":1},"indexed_commit":"eaf9fb2638af","live_head":"303f55f1785c","response_budget":{"limit_chars":24000,"serialized_chars":16878,"tier":"default"},"semantic_search":false,"stale_warning":"Index is behind live HEAD \u2014 run `repowise update`.","timing_ms":1036.0},"counts":"everything","distribution":{"bands":{"at_risk":{"files":180,"nloc":103273,"pct":13.6},"excellent":{"files":3312,"nloc":388454,"pct":51.0},"fair":{"files":261,"nloc":78236,"pct":10.3},"good":{"files":570,"nloc":140575,"pct":18.4},"needs_work":{"files":138,"nloc":51446,"pct":6.8}},"total_files":4461,"total_nloc":761984},"fix_first":{"basis":{"analyzed_commit":"547df91a7e7ba6e01f7457ac2172e09a36ad47a6","health_analyzed_at":"2026-09-30T14:04:24.529401"},"by_improves":{"defect":768,"maintainability":157,"performance":122},"detail_call":"get_health(fix_id='fix1_97d425a56a911cf78db4')","items":[{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_d21fb1bde221e8df007e","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ae647f629da0ef35d96e"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/analysis/health/complexity/walker.py","line_end":208,"line_start":152,"symbol":"walk_file"},"tier":"now","title":"Extract a helper from walk_file","why":"walk_file has more branches than its tests can easily cover; 8 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_fba1d37b9cbd137f45e7","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_f679a97d234a223b34f5"},"tool":"get_health"},"target":{"file_path":"packages/web/src/components/code-health/triage-tab.tsx","line_end":121,"line_start":71,"symbol":"TriageTab"},"tier":"now","title":"Extract a helper from TriageTab","why":"TriageTab has more branches than its tests can easily cover; it changed 6 times in 90 days, so the cost recurs."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_26c2da3b4c98f8fdef56","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_5ca551b7b7c3293951d0"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/repo_db.py","line_end":null,"line_start":null,"symbol":"ensure_repo_registration"},"tier":"next","title":"Batch the database calls loops make through ensure_repo_registration","why":"ensure_repo_registration makes a database call once per loop iteration; 2 call sites reach it, an entry point reaches it, the loop grows with the data."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_f17556ad6537b1c26c98","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_29080eb5a091e8eeb79d"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/job_executor.py","line_end":null,"line_start":null,"symbol":"_start_job"},"tier":"next","title":"Move the database call in _start_job out of its loop","why":"_start_job makes a database call once per loop iteration; an entry point reaches it, the loop grows with the data."}],"items_emitted":5,"items_total":5,"lead":{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},"model_version":1,"totals":{"candidates":2834,"eligible":1047,"excluded":{"below_min_worth":428,"expected":148,"generated":4,"history_only":137,"no_plan":12,"test":804,"tooling":254},"shown":5}},"gap_analysis":{"files_below_target":860,"files_for_half_gap":22,"files_to_reach_target":57,"target_score":8.0,"weighted_gap_points":324845,"weighted_gross_gap_points":925602},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":69.6,"maintainability_score":1.3,"max_ccn":249,"max_nesting":5,"module":"packages/cli","nloc":1810,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"run_update nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":1.4,"total_deduction":9.213,"weighted_deficit":12670},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/incremental.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.35,"maintainability_score":2.0,"max_ccn":54,"max_nesting":5,"module":"packages/core","nloc":1727,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_incremental_index nests 5 levels deep","score":1.41,"share_of_repo_gap_pct":1.2,"total_deduction":8.569,"weighted_deficit":11381},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":75.35,"maintainability_score":2.8,"max_ccn":162,"max_nesting":4,"module":"packages/cli","nloc":1535,"performance_score":10.0,"primary_biomarker":"brain_method","primary_reason":"Brain Method: init_command is 739 lines, CCN 162, in a file imported by 7 others","score":1.01,"share_of_repo_gap_pct":1.2,"total_deduction":8.985,"weighted_deficit":10730},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/workspace_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.45,"maintainability_score":1.3,"max_ccn":29,"max_nesting":4,"module":"packages/cli","nloc":1341,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"workspace_scan nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":1.0,"total_deduction":9.1,"weighted_deficit":9387},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_test_file":true,"is_test":false,"line_coverage_pct":92.35,"maintainability_score":3.1,"max_ccn":25,"max_nesting":6,"module":"packages/core","nloc":1460,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_find_parent nests 6 levels deep","score":1.74,"share_of_repo_gap_pct":1.0,"total_deduction":8.258,"weighted_deficit":9140},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":1.3,"max_ccn":74,"max_nesting":5,"module":"packages/cli","nloc":1279,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_persist_full_update_async nests 5 levels deep","score":1.11,"share_of_repo_gap_pct":1.0,"total_deduction":8.538,"weighted_deficit":8812},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/dead_code/analyzer.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":4.2,"max_ccn":27,"max_nesting":5,"module":"packages/core","nloc":1352,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_get_unsatisfied_prop_guard nests 5 levels deep","score":1.71,"share_of_repo_gap_pct":0.9,"total_deduction":8.291,"weighted_deficit":8504},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":78.67,"maintainability_score":2.0,"max_ccn":24,"max_nesting":4,"module":"packages/cli","nloc":1121,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"validate_provider_config nests 4 levels deep","score":1.15,"share_of_repo_gap_pct":0.8,"total_deduction":8.85,"weighted_deficit":7679},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_change_risk.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":46,"max_nesting":4,"module":"packages/server","nloc":1173,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_cross_repo_block nests 4 levels deep","score":2.01,"share_of_repo_gap_pct":0.8,"total_deduction":7.99,"weighted_deficit":7026},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/engine.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.77,"maintainability_score":1.7,"max_ccn":30,"max_nesting":4,"module":"packages/core","nloc":1013,"performance_score":9.58,"primary_biomarker":"god_class","primary_reason":"HealthAnalyzer is a god class: 669 lines across 19 methods, including a brain method (analyze_async, CCN 30)","score":1.12,"share_of_repo_gap_pct":0.8,"total_deduction":8.73,"weighted_deficit":6969},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/git_indexer/indexer.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.98,"maintainability_score":2.0,"max_ccn":42,"max_nesting":4,"module":"packages/core","nloc":1047,"performance_score":10.0,"primary_biomarker":"god_class","primary_reason":"GitIndexer is a god class: 760 lines across 24 methods, including a brain method (index_changed_files, CCN 42)","score":1.44,"share_of_repo_gap_pct":0.7,"total_deduction":8.555,"weighted_deficit":6868},{"branch_coverage_pct":null,"file_path":"packages/ui/src/graph/graph-flow.tsx","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":4.0,"max_ccn":260,"max_nesting":7,"module":"packages/ui","nloc":1235,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"GraphFlow nests 7 levels deep","score":2.5,"share_of_repo_gap_pct":0.7,"total_deduction":7.5,"weighted_deficit":6792},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.68,"maintainability_score":2.5,"max_ccn":43,"max_nesting":7,"module":"packages/core","nloc":1001,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"find_npm_script_entry_targets nests 7 levels deep","score":1.43,"share_of_repo_gap_pct":0.7,"total_deduction":8.571,"weighted_deficit":6577},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/workspace/update.py","has_test_file":true,"is_test":false,"line_coverage_pct":87.58,"maintainability_score":2.0,"max_ccn":31,"max_nesting":6,"module":"packages/core","nloc":968,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_merged_repo_excludes nests 6 levels deep","score":1.5,"share_of_repo_gap_pct":0.7,"total_deduction":8.499,"weighted_deficit":6292},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":35,"max_nesting":5,"module":"packages/core","nloc":1819,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_analysis nests 5 levels deep","score":4.57,"share_of_repo_gap_pct":0.7,"total_deduction":5.089,"weighted_deficit":6239},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/decision_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":16.05,"maintainability_score":7.7,"max_ccn":8,"max_nesting":3,"module":"packages/cli","nloc":877,"performance_score":10.0,"primary_biomarker":"coverage_gap","primary_reason":"204/243 lines uncovered (16% line coverage)","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":9.151,"weighted_deficit":6139},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/ui/provider_selection.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.2,"maintainability_score":3.1,"max_ccn":22,"max_nesting":4,"module":"packages/cli","nloc":851,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_interactive_openai_compatible_select nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.919,"weighted_deficit":5957},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/security_scan.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.82,"maintainability_score":3.1,"max_ccn":52,"max_nesting":5,"module":"packages/core","nloc":828,"performance_score":8.6,"primary_biomarker":"nested_complexity","primary_reason":"scan_source nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.597,"weighted_deficit":5796},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/generation/context/assembler.py","has_test_file":true,"is_test":false,"line_coverage_pct":89.71,"maintainability_score":2.8,"max_ccn":32,"max_nesting":5,"module":"packages/core","nloc":898,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"assemble_repo_overview nests 5 levels deep","score":1.59,"share_of_repo_gap_pct":0.6,"total_deduction":8.414,"weighted_deficit":5756},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/perf/dialects/python.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":3.3,"max_ccn":28,"max_nesting":4,"module":"packages/core","nloc":892,"performance_score":10.0,"primary_biomarker":"complex_conditional","primary_reason":"if condition combines 5 boolean operators","score":1.61,"share_of_repo_gap_pct":0.6,"total_deduction":8.045,"weighted_deficit":5700}],"high_leverage_files_emitted":20,"high_leverage_files_reduced_reason":"limit","high_leverage_files_total":778,"kpis":{"average_health":7.57,"average_health_unweighted":8.79,"average_health_weighting":"nloc","band":"good","file_count":4461,"history_average":1.0,"hotspot_health":5.84,"maintainability_average":8.08,"performance_analyzed_files":4459,"performance_average":9.74,"performance_coverage_pct":100.0,"performance_covered_files":4452,"performance_findings":1061,"performance_findings_density_per_10k_loc":13.93,"performance_skipped_files":7,"performance_unsupported_languages":[["shell",7]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.43,"worst_performer_path":"packages/cli/src/repowise/cli/commands/serve_cmd.py","worst_performer_score":1.0,"worst_test_path":"packages/core/src/repowise/core/analysis/test_impact.py","worst_test_score":2.0},"mode":"dashboard","recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=[], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=20)","remaining":758}},"scope":"all","secondary_rankings":{"modules":{"call":"get_health(repo=None, only=['modules'], limit=50)","total":13},"test_findings":{"call":"get_health(repo=None, only=['test_findings'], limit=50)","total":1072},"test_worst_files":{"call":"get_health(repo=None, only=['test_worst_files'], limit=50)","total":1736},"top_findings":{"call":"get_health(repo=None, only=['top_findings'], limit=50)","total":9408},"worst_files":{"call":"get_health(repo=None, only=['worst_files'], limit=50)","total":2725}},"unscored_files":0},"get_health:limit-100":{"_meta":{"completeness":{"capped":true,"reason":"limit_and_response_budget","shown":37,"total":784},"contract_version":2,"embedder":"mock","embedder_degraded":false,"health_analysis":{"analyzed_at":"2026-09-30T14:04:24.529401","analyzed_commit":"547df91a7e7b","analyzed_commits_distinct":2,"live_verification":{"basis":"index_commit_and_live_git_head","source_bytes_verified":false},"recomputed_this_call":false,"refresh":{"command":"repowise update","precondition":"commit health-relevant working-tree changes first","required_before_comparison":true},"source":"stored_health_analysis","status":"available"},"health_analyzed_at":"2026-09-30T14:04:24.529401","health_analyzed_commit":"547df91a7e7b","health_analyzed_commits_distinct":2,"index_age_days":0,"index_behind":true,"index_scope":{"content_provenance":"model","fingerprint":"4a1aa5b83bd6","full":"get_overview()","git_tier":"full","projection":"compact","run_mode":"standard","status":"partial","version":1},"indexed_commit":"eaf9fb2638af","live_head":"303f55f1785c","omitted":{"refs":["repowise#c3e68e923dea","repowise#b2756974b788"],"restore":"`repowise expand <ref>`, or get_symbol(\"repowise#<ref>\", query=...)","tokens":9566},"response_budget":{"limit_chars":24000,"serialized_chars":22580,"tier":"default"},"semantic_search":false,"stale_warning":"Index is behind live HEAD \u2014 run `repowise update`.","state":{"truncated":true},"timing_ms":2005.0},"counts":"everything","distribution":{"bands":{"at_risk":{"files":180,"nloc":103273,"pct":13.6},"excellent":{"files":3312,"nloc":388454,"pct":51.0},"fair":{"files":261,"nloc":78236,"pct":10.3},"good":{"files":570,"nloc":140575,"pct":18.4},"needs_work":{"files":138,"nloc":51446,"pct":6.8}},"total_files":4461,"total_nloc":761984},"fix_first":{"basis":{"analyzed_commit":"547df91a7e7ba6e01f7457ac2172e09a36ad47a6","health_analyzed_at":"2026-09-30T14:04:24.529401"},"by_improves":{"defect":768,"maintainability":157,"performance":122},"detail_call":"get_health(fix_id='fix1_97d425a56a911cf78db4')","items":[{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_d21fb1bde221e8df007e","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ae647f629da0ef35d96e"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/analysis/health/complexity/walker.py","line_end":208,"line_start":152,"symbol":"walk_file"},"tier":"now","title":"Extract a helper from walk_file","why":"walk_file has more branches than its tests can easily cover; 8 files import it, so every caller inherits the risk."},{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_fba1d37b9cbd137f45e7","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_f679a97d234a223b34f5"},"tool":"get_health"},"target":{"file_path":"packages/web/src/components/code-health/triage-tab.tsx","line_end":121,"line_start":71,"symbol":"TriageTab"},"tier":"now","title":"Extract a helper from TriageTab","why":"TriageTab has more branches than its tests can easily cover; it changed 6 times in 90 days, so the cost recurs."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_26c2da3b4c98f8fdef56","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_5ca551b7b7c3293951d0"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/repo_db.py","line_end":null,"line_start":null,"symbol":"ensure_repo_registration"},"tier":"next","title":"Batch the database calls loops make through ensure_repo_registration","why":"ensure_repo_registration makes a database call once per loop iteration; 2 call sites reach it, an entry point reaches it, the loop grows with the data."},{"confidence":"medium","effort":"M","gain":"one database call per loop iteration, grows with the data","id":"fix1_f17556ad6537b1c26c98","kind":"perf_fix","next_call":{"arguments":{"opportunity_id":"perf2_29080eb5a091e8eeb79d"},"tool":"get_health"},"target":{"file_path":"packages/server/src/repowise/server/job_executor.py","line_end":null,"line_start":null,"symbol":"_start_job"},"tier":"next","title":"Move the database call in _start_job out of its loop","why":"_start_job makes a database call once per loop iteration; an entry point reaches it, the loop grows with the data."}],"items_emitted":5,"items_total":5,"lead":{"confidence":"high","effort":"S","gain":"about +1.7 health on this file","id":"fix1_97d425a56a911cf78db4","kind":"refactor","next_call":{"arguments":{"opportunity_id":"refop2_ff13ab231f7b30bbdffb"},"tool":"get_health"},"target":{"file_path":"packages/core/src/repowise/core/workspace/repo_index.py","line_end":254,"line_start":243,"symbol":"declared_symbol_at"},"tier":"now","title":"Extract a helper from declared_symbol_at","why":"declared_symbol_at has more branches than its tests can easily cover; 19 files import it, so every caller inherits the risk."},"model_version":1,"totals":{"candidates":2834,"eligible":1047,"excluded":{"below_min_worth":428,"expected":148,"generated":4,"history_only":137,"no_plan":12,"test":804,"tooling":254},"shown":5}},"gap_analysis":{"files_below_target":860,"files_for_half_gap":22,"files_to_reach_target":57,"target_score":8.0,"weighted_gap_points":324845,"weighted_gross_gap_points":925602},"high_leverage_files":[{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":69.6,"maintainability_score":1.3,"max_ccn":249,"max_nesting":5,"module":"packages/cli","nloc":1810,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"run_update nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":1.4,"total_deduction":9.213,"weighted_deficit":12670},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/incremental.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.35,"maintainability_score":2.0,"max_ccn":54,"max_nesting":5,"module":"packages/core","nloc":1727,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_incremental_index nests 5 levels deep","score":1.41,"share_of_repo_gap_pct":1.2,"total_deduction":8.569,"weighted_deficit":11381},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/command.py","has_test_file":true,"is_test":false,"line_coverage_pct":75.35,"maintainability_score":2.8,"max_ccn":162,"max_nesting":4,"module":"packages/cli","nloc":1535,"performance_score":10.0,"primary_biomarker":"brain_method","primary_reason":"Brain Method: init_command is 739 lines, CCN 162, in a file imported by 7 others","score":1.01,"share_of_repo_gap_pct":1.2,"total_deduction":8.985,"weighted_deficit":10730},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/workspace_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":72.45,"maintainability_score":1.3,"max_ccn":29,"max_nesting":4,"module":"packages/cli","nloc":1341,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"workspace_scan nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":1.0,"total_deduction":9.1,"weighted_deficit":9387},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_test_file":true,"is_test":false,"line_coverage_pct":92.35,"maintainability_score":3.1,"max_ccn":25,"max_nesting":6,"module":"packages/core","nloc":1460,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_find_parent nests 6 levels deep","score":1.74,"share_of_repo_gap_pct":1.0,"total_deduction":8.258,"weighted_deficit":9140},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/update_cmd/persistence.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":1.3,"max_ccn":74,"max_nesting":5,"module":"packages/cli","nloc":1279,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_persist_full_update_async nests 5 levels deep","score":1.11,"share_of_repo_gap_pct":1.0,"total_deduction":8.538,"weighted_deficit":8812},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/dead_code/analyzer.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.47,"maintainability_score":4.2,"max_ccn":27,"max_nesting":5,"module":"packages/core","nloc":1352,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_get_unsatisfied_prop_guard nests 5 levels deep","score":1.71,"share_of_repo_gap_pct":0.9,"total_deduction":8.291,"weighted_deficit":8504},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/helpers.py","has_test_file":true,"is_test":false,"line_coverage_pct":78.67,"maintainability_score":2.0,"max_ccn":24,"max_nesting":4,"module":"packages/cli","nloc":1121,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"validate_provider_config nests 4 levels deep","score":1.15,"share_of_repo_gap_pct":0.8,"total_deduction":8.85,"weighted_deficit":7679},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_change_risk.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":2.8,"max_ccn":46,"max_nesting":4,"module":"packages/server","nloc":1173,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_cross_repo_block nests 4 levels deep","score":2.01,"share_of_repo_gap_pct":0.8,"total_deduction":7.99,"weighted_deficit":7026},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/engine.py","has_test_file":true,"is_test":false,"line_coverage_pct":81.77,"maintainability_score":1.7,"max_ccn":30,"max_nesting":4,"module":"packages/core","nloc":1013,"performance_score":9.58,"primary_biomarker":"god_class","primary_reason":"HealthAnalyzer is a god class: 669 lines across 19 methods, including a brain method (analyze_async, CCN 30)","score":1.12,"share_of_repo_gap_pct":0.8,"total_deduction":8.73,"weighted_deficit":6969},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/git_indexer/indexer.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.98,"maintainability_score":2.0,"max_ccn":42,"max_nesting":4,"module":"packages/core","nloc":1047,"performance_score":10.0,"primary_biomarker":"god_class","primary_reason":"GitIndexer is a god class: 760 lines across 24 methods, including a brain method (index_changed_files, CCN 42)","score":1.44,"share_of_repo_gap_pct":0.7,"total_deduction":8.555,"weighted_deficit":6868},{"branch_coverage_pct":null,"file_path":"packages/ui/src/graph/graph-flow.tsx","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":4.0,"max_ccn":260,"max_nesting":7,"module":"packages/ui","nloc":1235,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"GraphFlow nests 7 levels deep","score":2.5,"share_of_repo_gap_pct":0.7,"total_deduction":7.5,"weighted_deficit":6792},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/ingestion/resolvers/ts_workspace.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.68,"maintainability_score":2.5,"max_ccn":43,"max_nesting":7,"module":"packages/core","nloc":1001,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"find_npm_script_entry_targets nests 7 levels deep","score":1.43,"share_of_repo_gap_pct":0.7,"total_deduction":8.571,"weighted_deficit":6577},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/workspace/update.py","has_test_file":true,"is_test":false,"line_coverage_pct":87.58,"maintainability_score":2.0,"max_ccn":31,"max_nesting":6,"module":"packages/core","nloc":968,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_merged_repo_excludes nests 6 levels deep","score":1.5,"share_of_repo_gap_pct":0.7,"total_deduction":8.499,"weighted_deficit":6292},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/pipeline/persist.py","has_test_file":true,"is_test":false,"line_coverage_pct":85.47,"maintainability_score":1.3,"max_ccn":35,"max_nesting":5,"module":"packages/core","nloc":1819,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"persist_analysis nests 5 levels deep","score":4.57,"share_of_repo_gap_pct":0.7,"total_deduction":5.089,"weighted_deficit":6239},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/decision_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":16.05,"maintainability_score":7.7,"max_ccn":8,"max_nesting":3,"module":"packages/cli","nloc":877,"performance_score":10.0,"primary_biomarker":"coverage_gap","primary_reason":"204/243 lines uncovered (16% line coverage)","score":1.0,"share_of_repo_gap_pct":0.7,"total_deduction":9.151,"weighted_deficit":6139},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/ui/provider_selection.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.2,"maintainability_score":3.1,"max_ccn":22,"max_nesting":4,"module":"packages/cli","nloc":851,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_interactive_openai_compatible_select nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.919,"weighted_deficit":5957},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/security_scan.py","has_test_file":true,"is_test":false,"line_coverage_pct":58.82,"maintainability_score":3.1,"max_ccn":52,"max_nesting":5,"module":"packages/core","nloc":828,"performance_score":8.6,"primary_biomarker":"nested_complexity","primary_reason":"scan_source nests 5 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.597,"weighted_deficit":5796},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/generation/context/assembler.py","has_test_file":true,"is_test":false,"line_coverage_pct":89.71,"maintainability_score":2.8,"max_ccn":32,"max_nesting":5,"module":"packages/core","nloc":898,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"assemble_repo_overview nests 5 levels deep","score":1.59,"share_of_repo_gap_pct":0.6,"total_deduction":8.414,"weighted_deficit":5756},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/analysis/health/perf/dialects/python.py","has_test_file":true,"is_test":false,"line_coverage_pct":86.49,"maintainability_score":3.3,"max_ccn":28,"max_nesting":4,"module":"packages/core","nloc":892,"performance_score":10.0,"primary_biomarker":"complex_conditional","primary_reason":"if condition combines 5 boolean operators","score":1.61,"share_of_repo_gap_pct":0.6,"total_deduction":8.045,"weighted_deficit":5700},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/doctor_cmd/repo_checks.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":1.3,"max_ccn":69,"max_nesting":4,"module":"packages/cli","nloc":884,"performance_score":9.3,"primary_biomarker":"brain_method","primary_reason":"Brain Method: _run_repo_checks is 468 lines, CCN 69, in a file imported by 15 others","score":1.65,"share_of_repo_gap_pct":0.6,"total_deduction":8.002,"weighted_deficit":5613},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/editor_integrations/claude_config.py","has_test_file":true,"is_test":false,"line_coverage_pct":89.32,"maintainability_score":2.5,"max_ccn":18,"max_nesting":5,"module":"packages/cli","nloc":850,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"claude_code_leftover_reason nests 5 levels deep","score":1.42,"share_of_repo_gap_pct":0.6,"total_deduction":8.422,"weighted_deficit":5593},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_context/targets.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.59,"maintainability_score":4.0,"max_ccn":176,"max_nesting":5,"module":"packages/server","nloc":942,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_resolve_one_target nests 5 levels deep","score":2.16,"share_of_repo_gap_pct":0.6,"total_deduction":7.838,"weighted_deficit":5501},{"branch_coverage_pct":null,"file_path":"packages/ui/src/graph/sigma/use-sigma.ts","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":4.0,"max_ccn":131,"max_nesting":4,"module":"packages/ui","nloc":981,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"makeDrawNodeHover nests 4 levels deep","score":2.5,"share_of_repo_gap_pct":0.6,"total_deduction":7.499,"weighted_deficit":5396},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/_answer_pipeline.py","has_test_file":true,"is_test":false,"line_coverage_pct":68.99,"maintainability_score":3.0,"max_ccn":32,"max_nesting":4,"module":"packages/server","nloc":765,"performance_score":9.79,"primary_biomarker":"nested_complexity","primary_reason":"expand_via_parent_page nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.24,"weighted_deficit":5355},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_symbol.py","has_test_file":true,"is_test":false,"line_coverage_pct":91.01,"maintainability_score":4.0,"max_ccn":41,"max_nesting":4,"module":"packages/server","nloc":911,"performance_score":8.0,"primary_biomarker":"brain_method","primary_reason":"Brain Method: get_symbol is 208 lines, CCN 41, in a file imported by 7 others","score":2.14,"share_of_repo_gap_pct":0.6,"total_deduction":7.86,"weighted_deficit":5338},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/tool_context/enrichment.py","has_test_file":true,"is_test":false,"line_coverage_pct":59.91,"maintainability_score":3.7,"max_ccn":53,"max_nesting":4,"module":"packages/server","nloc":757,"performance_score":8.6,"primary_biomarker":"nested_complexity","primary_reason":"attach_doc_references nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.6,"total_deduction":9.552,"weighted_deficit":5299},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/hook_cmd.py","has_test_file":true,"is_test":false,"line_coverage_pct":74.29,"maintainability_score":4.3,"max_ccn":26,"max_nesting":4,"module":"packages/cli","nloc":890,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"hook_stats nests 4 levels deep","score":2.13,"share_of_repo_gap_pct":0.6,"total_deduction":7.714,"weighted_deficit":5224},{"branch_coverage_pct":null,"file_path":"packages/cli/src/repowise/cli/commands/init_cmd/workspace.py","has_test_file":true,"is_test":false,"line_coverage_pct":65.84,"maintainability_score":2.8,"max_ccn":44,"max_nesting":4,"module":"packages/cli","nloc":768,"performance_score":9.3,"primary_biomarker":"nested_complexity","primary_reason":"_workspace_init nests 4 levels deep","score":1.25,"share_of_repo_gap_pct":0.6,"total_deduction":8.753,"weighted_deficit":5184},{"branch_coverage_pct":null,"file_path":"packages/core/src/repowise/core/generation/concept_tree/vocabulary.py","has_test_file":true,"is_test":false,"line_coverage_pct":null,"maintainability_score":3.7,"max_ccn":27,"max_nesting":5,"module":"packages/core","nloc":910,"performance_score":8.0,"primary_biomarker":"nested_complexity","primary_reason":"_harvest nests 5 levels deep","score":2.35,"share_of_repo_gap_pct":0.6,"total_deduction":7.651,"weighted_deficit":5142},{"branch_coverage_pct":null,"file_path":"packages/server/src/repowise/server/mcp_server/_server.py","has_test_file":true,"is_test":false,"line_coverage_pct":60.59,"maintainability_score":2.0,"max_ccn":18,"max_nesting":4,"module":"packages/server","nloc":718,"performance_score":10.0,"primary_biomarker":"nested_complexity","primary_reason":"_detect_workspace nests 4 levels deep","score":1.0,"share_of_repo_gap_pct":0.5,"total_deduction":9.57,"weighted_deficit":5026}],"high_leverage_files_emitted":31,"high_leverage_files_omitted":747,"high_leverage_files_reduced_reason":"limit_and_response_budget","high_leverage_files_total":778,"high_leverage_files_truncated":true,"kpis":{"average_health":7.57,"average_health_unweighted":8.79,"average_health_weighting":"nloc","band":"good","file_count":4461,"history_average":1.0,"hotspot_health":5.84,"maintainability_average":8.08,"performance_analyzed_files":4459,"performance_average":9.74,"performance_coverage_pct":100.0,"performance_covered_files":4452,"performance_findings":1061,"performance_findings_density_per_10k_loc":13.93,"performance_skipped_files":7,"performance_unsupported_languages":[["shell",7]],"performance_unsupported_languages_emitted":1,"performance_unsupported_languages_total":1,"structure_average":1.43,"worst_performer_path":"packages/cli/src/repowise/cli/commands/serve_cmd.py","worst_performer_score":1.0,"worst_test_path":"packages/core/src/repowise/core/analysis/test_impact.py","worst_test_score":2.0},"mode":"dashboard","omission_marker":"[repowise#b2756974b788: 25 lines omitted (~175 tokens); restore: repowise expand b2756974b788]","recovery":{"high_leverage_files":{"call":"get_health(targets=[], include=[], repo=None, limit=50, only=['high_leverage_files'], refactoring_view='diversified', cursor=100)","remaining":678}},"scope":"all","secondary_rankings":{"modules":{"call":"get_health(repo=None, only=['modules'], limit=50)","total":13},"test_findings":{"call":"get_health(repo=None, only=['test_findings'], limit=50)","total":1072},"test_worst_files":{"call":"get_health(repo=None, only=['test_worst_files'], limit=50)","total":1736},"top_findings":{"call":"get_health(repo=None, only=['top_findings'], limit=50)","total":9408},"worst_files":{"call":"get_health(repo=None, only=['worst_files'], limit=50)","total":2725}},"truncated":true,"unscored_files":0},"get_overview:all-includes":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#4e8f0bb0e304"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1376},"response_budget":{"limit_chars":32000,"serialized_chars":7934,"tier":"expanded"},"state":{"truncated":true}},"architecture":{"layer_order":["UI","CLI","Application","API","Config","Utility","Data","Types","Service","Docs & Tooling","Test"],"layers":[{"file_count":641,"name":"Contributor 2"},{"file_count":261,"name":"Contributor 6"},{"file_count":191,"name":"Contributor 15"},{"file_count":92,"name":"Contributor 12"},{"file_count":28,"name":"Contributor 10"},{"file_count":52,"name":"Contributor 17"},{"file_count":60,"name":"Contributor 13"},{"file_count":81,"name":"Contributor 18"},{"file_count":981,"name":"Contributor 4"},{"file_count":220,"name":"Contributor 8"},{"file_count":1478,"name":"Contributor 11"}],"tour_available":true,"tour_step_count":12},"code_health":{"average_health":6.94,"band":"warning","distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"file_count":3793,"hotspot_health":4.35,"open_findings":14239,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"content_hint":"Overview essay trimmed to its summary section. Call get_overview(include=[\"content\"]) for the full walkthrough.","content_md":"## Project Summary\n\nRepowise consumes source repositories and configuration files, walks and parses them through language-specific ingestion, persists and analyzes the resulting code graph, and generates documentation, health insights, and interactive views exposed through CLI, MCP/server APIs, web apps, and VS Code.\n\nIt is a Python/TypeScript monorepo organized around a shared analysis engine and several presentation surfaces. The repository contains 3,659 files and approximately 740k lines of code; dependency analysis reports 18 circular dependencies. Recent hotspots include dead-code analysis, MCP answer generation, and the web sidebar.","entry_points":["packages/server/src/repowise/server/app.py","packages/cli/src/repowise/cli/main.py","packages/vscode/webview/src/views/risk/App.tsx","packages/vscode/webview/src/views/decisions/App.tsx","packages/vscode/webview/src/views/settings/App.tsx","packages/vscode/webview/src/views/architecture/App.tsx","packages/vscode/webview/src/views/home/App.tsx","packages/vscode/webview/src/views/refactoring/App.tsx"],"git_health":{"avg_bus_factor":1.2,"churn_trend":"increasing","files_git_attributed":4136,"files_with_bus_factor_1":3339,"hotspot_count":419,"top_churn_modules":["packages/core","tests/unit","packages/ui","packages/server","packages/web"]},"key_modules":[{"name":"Contributor 3","path":"packages/api-client","section":"6"},{"name":"Contributor 14","path":"packages/api-client/src","section":"7"},{"name":"Contributor 5","path":"packages/vscode/src/features","section":"8"},{"name":"Contributor 9","path":"packages/vscode/webview/src/runtime","section":"9"},{"name":"Contributor 7","path":"packages/web","section":"10"},{"name":"Contributor 21","path":"packages/web/src/app/repos/[id]","section":"11"},{"name":"Contributor 1","path":"packages/web/src/app/repos/[id]/docs","section":"11.1"},{"name":"Contributor 16","path":"packages/web/src/app/repos/[id]/settings","section":"11.2"}],"more":"get_overview(include=[...]) also serves: \"outline\" (the wiki page tree), \"tour\" (guided_tour + reading_order), \"decisions\", \"graph\" (code communities), \"ownership\" (top owners, silos), \"content\" (the full essay).","omission_marker":"[repowise#4e8f0bb0e304: 90 lines omitted (~1376 tokens); restore: repowise expand 4e8f0bb0e304]","title":"Repository Overview: repowise","tool_surface":{"counts":{"default":10,"eligible":13,"enabled":10,"opt_in_available":3,"tiers":{"canonical":10}},"enabled":["get_answer","get_context","get_symbol","search_codebase","get_risk","get_change_risk","get_why","get_overview","get_health","get_dead_code"],"mode":"single_repo","opt_in":[{"description":"Find how two files/modules are connected in the dependency graph.","enabled":false,"name":"get_dependency_path"},{"description":"Show how the codebase executes: top entry points and their call traces.","enabled":false,"name":"get_execution_flows"},{"description":"Generate refactored code + a unified diff for one refactoring plan.","enabled":false,"name":"generate_refactoring_code"}],"recipes":[{"call":"get_answer(question=\"how does X work?\")","name":"answer_question"},{"call":"get_context(targets=[\"path\"], include=[\"skeleton\"])","name":"read_file_shape"},{"call":"search_codebase(query=\"identifier or path\", mode=\"auto\")","name":"find_raw_hits"},{"call":"get_risk(targets=[\"path\"])","name":"assess_hotspot"},{"call":"get_risk(targets=[\"path\"], changed_files=[\"path\"])","name":"review_change"},{"call":"get_why(targets=[\"path\"])","name":"read_rationale"},{"call":"get_health(only=[\"directive\"])","name":"health_directive"},{"call":"get_health(targets=[\"path\"], include=[\"refactoring\"])","name":"health_file_self_check"},{"call":"get_health(targets=[\"module:path\"], only=[\"modules\",\"metrics\"])","name":"health_module_triage"},{"call":"get_health(include=[\"trend\"], only=[\"trend\"])","name":"health_trend"},{"call":"get_health(include=[\"accuracy\"], only=[\"accuracy\"])","name":"health_accuracy"},{"call":"get_health(include=[\"coverage\"], only=[\"coverage\"])","name":"health_coverage"},{"call":"get_health(include=[\"performance\",\"refactoring\"], only=[\"performance_opportunities\",\"refactoring_plans\"])","name":"health_performance_refactoring"},{"call":"get_health(include=[\"performance\"], only=[\"performance_summary\"])","name":"health_performance_summary"},{"call":"get_health(opportunity_id=\"perf...\")","name":"health_performance_opportunity"},{"call":"get_health(opportunity_id=\"perf...\", only=[\"performance_evidence\"], cursor=0)","name":"health_performance_evidence"}],"tools":[{"default":true,"description":"Answer a how, where, or why question in one evidence-grounded call.","name":"get_answer","tier":"canonical"},{"default":true,"description":"Triage card for files / modules / symbols \u2014 relationships, not source bytes.","name":"get_context","tier":"canonical"},{"default":true,"description":"Follow-up read of one symbol whose id another response already gave you.","name":"get_symbol","tier":"canonical"},{"default":true,"description":"Find code by concept, symbol, or path \u2014 hybrid codebase search.","name":"search_codebase","tier":"canonical"},{"default":true,"description":"What history says about touching these files \u2014 bug fixes, churn, owners.","name":"get_risk","tier":"canonical"},{"default":true,"description":"Review a commit, ``base..head`` range, or uncommitted work.","name":"get_change_risk","tier":"canonical"},{"default":true,"description":"Why this code is shaped this way \u2014 decision records + evidence commits.","name":"get_why","tier":"canonical"},{"default":true,"description":"Architecture map for an unfamiliar repo \u2014 first call when you don't know your way around.","name":"get_overview","tier":"canonical"},{"default":true,"description":"Code-health scores and findings from stored analysis.","name":"get_health","tier":"canonical"},{"default":true,"description":"Unused exports, unreachable files, zombie packages \u2014 tiered by confidence.","name":"get_dead_code","tier":"canonical"}]}},"get_overview:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#4e8f0bb0e304"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1376},"response_budget":{"limit_chars":24000,"serialized_chars":7933,"tier":"default"},"state":{"truncated":true}},"architecture":{"layer_order":["UI","CLI","Application","API","Config","Utility","Data","Types","Service","Docs & Tooling","Test"],"layers":[{"file_count":641,"name":"Contributor 2"},{"file_count":261,"name":"Contributor 6"},{"file_count":191,"name":"Contributor 15"},{"file_count":92,"name":"Contributor 12"},{"file_count":28,"name":"Contributor 10"},{"file_count":52,"name":"Contributor 17"},{"file_count":60,"name":"Contributor 13"},{"file_count":81,"name":"Contributor 18"},{"file_count":981,"name":"Contributor 4"},{"file_count":220,"name":"Contributor 8"},{"file_count":1478,"name":"Contributor 11"}],"tour_available":true,"tour_step_count":12},"code_health":{"average_health":6.94,"band":"warning","distribution":{"bands":{"alert":{"files":212,"nloc":110556,"pct":17.5},"healthy":{"files":2678,"nloc":299568,"pct":47.5},"warning":{"files":903,"nloc":220758,"pct":35.0}},"total_files":3793,"total_nloc":630882},"file_count":3793,"hotspot_health":4.35,"open_findings":14239,"worst_performer_path":"packages/server/src/repowise/server/routers/repos.py","worst_performer_score":1.0},"content_hint":"Overview essay trimmed to its summary section. Call get_overview(include=[\"content\"]) for the full walkthrough.","content_md":"## Project Summary\n\nRepowise consumes source repositories and configuration files, walks and parses them through language-specific ingestion, persists and analyzes the resulting code graph, and generates documentation, health insights, and interactive views exposed through CLI, MCP/server APIs, web apps, and VS Code.\n\nIt is a Python/TypeScript monorepo organized around a shared analysis engine and several presentation surfaces. The repository contains 3,659 files and approximately 740k lines of code; dependency analysis reports 18 circular dependencies. Recent hotspots include dead-code analysis, MCP answer generation, and the web sidebar.","entry_points":["packages/server/src/repowise/server/app.py","packages/cli/src/repowise/cli/main.py","packages/vscode/webview/src/views/risk/App.tsx","packages/vscode/webview/src/views/decisions/App.tsx","packages/vscode/webview/src/views/settings/App.tsx","packages/vscode/webview/src/views/architecture/App.tsx","packages/vscode/webview/src/views/home/App.tsx","packages/vscode/webview/src/views/refactoring/App.tsx"],"git_health":{"avg_bus_factor":1.2,"churn_trend":"increasing","files_git_attributed":4136,"files_with_bus_factor_1":3339,"hotspot_count":419,"top_churn_modules":["packages/core","tests/unit","packages/ui","packages/server","packages/web"]},"key_modules":[{"name":"Contributor 3","path":"packages/api-client","section":"6"},{"name":"Contributor 14","path":"packages/api-client/src","section":"7"},{"name":"Contributor 5","path":"packages/vscode/src/features","section":"8"},{"name":"Contributor 9","path":"packages/vscode/webview/src/runtime","section":"9"},{"name":"Contributor 7","path":"packages/web","section":"10"},{"name":"Contributor 21","path":"packages/web/src/app/repos/[id]","section":"11"},{"name":"Contributor 1","path":"packages/web/src/app/repos/[id]/docs","section":"11.1"},{"name":"Contributor 16","path":"packages/web/src/app/repos/[id]/settings","section":"11.2"}],"more":"get_overview(include=[...]) also serves: \"outline\" (the wiki page tree), \"tour\" (guided_tour + reading_order), \"decisions\", \"graph\" (code communities), \"ownership\" (top owners, silos), \"content\" (the full essay).","omission_marker":"[repowise#4e8f0bb0e304: 90 lines omitted (~1376 tokens); restore: repowise expand 4e8f0bb0e304]","title":"Repository Overview: repowise","tool_surface":{"counts":{"default":10,"eligible":13,"enabled":10,"opt_in_available":3,"tiers":{"canonical":10}},"enabled":["get_answer","get_context","get_symbol","search_codebase","get_risk","get_change_risk","get_why","get_overview","get_health","get_dead_code"],"mode":"single_repo","opt_in":[{"description":"Find how two files/modules are connected in the dependency graph.","enabled":false,"name":"get_dependency_path"},{"description":"Show how the codebase executes: top entry points and their call traces.","enabled":false,"name":"get_execution_flows"},{"description":"Generate refactored code + a unified diff for one refactoring plan.","enabled":false,"name":"generate_refactoring_code"}],"recipes":[{"call":"get_answer(question=\"how does X work?\")","name":"answer_question"},{"call":"get_context(targets=[\"path\"], include=[\"skeleton\"])","name":"read_file_shape"},{"call":"search_codebase(query=\"identifier or path\", mode=\"auto\")","name":"find_raw_hits"},{"call":"get_risk(targets=[\"path\"])","name":"assess_hotspot"},{"call":"get_risk(targets=[\"path\"], changed_files=[\"path\"])","name":"review_change"},{"call":"get_why(targets=[\"path\"])","name":"read_rationale"},{"call":"get_health(only=[\"directive\"])","name":"health_directive"},{"call":"get_health(targets=[\"path\"], include=[\"refactoring\"])","name":"health_file_self_check"},{"call":"get_health(targets=[\"module:path\"], only=[\"modules\",\"metrics\"])","name":"health_module_triage"},{"call":"get_health(include=[\"trend\"], only=[\"trend\"])","name":"health_trend"},{"call":"get_health(include=[\"accuracy\"], only=[\"accuracy\"])","name":"health_accuracy"},{"call":"get_health(include=[\"coverage\"], only=[\"coverage\"])","name":"health_coverage"},{"call":"get_health(include=[\"performance\",\"refactoring\"], only=[\"performance_opportunities\",\"refactoring_plans\"])","name":"health_performance_refactoring"},{"call":"get_health(include=[\"performance\"], only=[\"performance_summary\"])","name":"health_performance_summary"},{"call":"get_health(opportunity_id=\"perf...\")","name":"health_performance_opportunity"},{"call":"get_health(opportunity_id=\"perf...\", only=[\"performance_evidence\"], cursor=0)","name":"health_performance_evidence"}],"tools":[{"default":true,"description":"Answer a how, where, or why question in one evidence-grounded call.","name":"get_answer","tier":"canonical"},{"default":true,"description":"Triage card for files / modules / symbols \u2014 relationships, not source bytes.","name":"get_context","tier":"canonical"},{"default":true,"description":"Follow-up read of one symbol whose id another response already gave you.","name":"get_symbol","tier":"canonical"},{"default":true,"description":"Find code by concept, symbol, or path \u2014 hybrid codebase search.","name":"search_codebase","tier":"canonical"},{"default":true,"description":"What history says about touching these files \u2014 bug fixes, churn, owners.","name":"get_risk","tier":"canonical"},{"default":true,"description":"Review a commit, ``base..head`` range, or uncommitted work.","name":"get_change_risk","tier":"canonical"},{"default":true,"description":"Why this code is shaped this way \u2014 decision records + evidence commits.","name":"get_why","tier":"canonical"},{"default":true,"description":"Architecture map for an unfamiliar repo \u2014 first call when you don't know your way around.","name":"get_overview","tier":"canonical"},{"default":true,"description":"Code-health scores and findings from stored analysis.","name":"get_health","tier":"canonical"},{"default":true,"description":"Unused exports, unreachable files, zombie packages \u2014 tiered by confidence.","name":"get_dead_code","tier":"canonical"}]}},"get_risk:one-target":{"_meta":{"completeness":{"capped":true,"reason":"construction_cap","shown":5,"total":25},"contract_version":1,"embedder_degraded":false,"floor":["co_change_partners_total","dependents_count"],"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#160ca2a7eeeb"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":1810},"response_budget":{"limit_chars":24000,"serialized_chars":3742,"tier":"default"},"state":{"truncated":true}},"omission_marker":"[repowise#160ca2a7eeeb: 258 lines omitted (~1810 tokens); restore: repowise expand 160ca2a7eeeb]","targets":{"packages/core/src/repowise/core/ingestion/call_resolver.py":{"bus_factor":1,"co_change_partners":[{"direction":"undirected","evidence_kind":"historical","file_path":"tests/unit/ingestion/test_call_resolver_strategies.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-23","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":6,"weight":2.906},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/languages/receiver_types.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-25","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":9,"weight":2.799},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/models.py","has_import_link":true,"has_structural_link":true,"last_co_change":"2026-08-30","provenance":"git_history","relationship_type":"co_change","structural_relationship_types":["imports"],"support":20,"weight":2.578},{"direction":"undirected","evidence_kind":"historical","file_path":"tests/unit/ingestion/test_receiver_types.py","has_import_link":false,"has_structural_link":false,"last_co_change":"2026-08-25","provenance":"git_history","relationship_type":"co_change","support":7,"weight":2.315},{"direction":"undirected","evidence_kind":"historical","file_path":"packages/core/src/repowise/core/ingestion/parser.py","has_import_link":false,"has_structural_link":false,"last_co_change":"2026-09-04","provenance":"git_history","relationship_type":"co_change","support":17,"weight":1.567}],"co_change_partners_emitted":5,"co_change_partners_omitted":20,"co_change_partners_reduced_reason":"construction_cap","co_change_partners_total":25,"co_change_partners_truncated":true,"commit_count_capped":false,"contributor_count":3,"coverage_pct":91.47,"defect_profile":{"bug_magnet":true,"fix_count":22,"last_fix_days_ago":10,"top_symbols":{"__init__":5,"_link_declarations":4,"_published":3},"window":"6 months"},"dependents_count":11,"episodes":21,"health_score":1.81,"hotspot_score":0.9995,"is_hotspot":true,"owner_pct":0.9412,"primary_owner":"Contributor 19","recent_owner":"Contributor 19","recent_owner_pct":0.9412,"risk_summary":"packages/core/src/repowise/core/ingestion/call_resolver.py \u2014 22 bug fixes in 6mo, last 10d ago (bug magnet), hotspot score 100% (increasing), 11 direct dependents, bug-prone, feature-active, 25 co-change partners, owned 94% by Contributor 19, bus factor risk (sole maintainer: Contributor 19)","security_signals":[],"target":"packages/core/src/repowise/core/ingestion/call_resolver.py","test_gap":false,"top_biomarkers":[{"biomarker_type":"change_entropy","function_name":null,"impact":1.18,"severity":"critical"},{"biomarker_type":"co_change_scatter","function_name":null,"impact":0.85,"severity":"high"},{"biomarker_type":"prior_defect","function_name":null,"impact":0.78,"severity":"critical"}],"trend":"increasing"}}},"get_symbol:largest-depth-3":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#63171fe88e36","repowise#bb943f58f05d"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":8087},"replaced_tokens":25149,"response_budget":{"limit_chars":24000,"serialized_chars":22623,"tier":"default"},"state":{"truncated":true},"timing_ms":6.7,"tokens_saved":19480},"continuation":"packages/core/src/repowise/core/ingestion/call_resolver.py:797-2117","continuation_reference":{"id":"packages/core/src/repowise/core/ingestion/call_resolver.py:797-2117","kind":"file_range","path":"packages/core/src/repowise/core/ingestion/call_resolver.py","range":[797,2117],"repository":"default","source_kind":"source","verification_basis":"live"},"end_line":796,"file":"packages/core/src/repowise/core/ingestion/call_resolver.py","kind":"class","name":"CallResolver","omission_marker":"[repowise#bb943f58f05d: 11 lines omitted (~136 tokens); restore: repowise expand bb943f58f05d]","qualified_name":"packages.core.src.repowise.core.ingestion.call_resolver.CallResolver","signature":"class CallResolver","source":" 197\t _JVM_STRATEGIES,\n 198\t free=(\"_resolve_java_same_package_unique\",),\n 199\t member_fallback=_TYPED_RECEIVER,\n 200\t ),\n 201\t \"kotlin\": replace(_JVM_STRATEGIES, member_fallback=_TYPED_RECEIVER),\n 202\t \"csharp\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 203\t \"python\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 204\t # Swift registers the fallback and nothing else: it has no package\n 205\t # tier of its own, so a typed receiver is looked for in the caller's\n 206\t # file, in what the file imports, and then in the global pair index.\n 207\t \"swift\": _LanguageCallStrategies(member_fallback=_TYPED_RECEIVER),\n 208\t \"cpp\": _CPP_STRATEGIES,\n 209\t \"c\": _CPP_STRATEGIES,\n 210\t}\n 211\t\n 212\t_SOURCE_CACHE_FILES = 4\n 213\t_BODY_TYPE_CACHE_ENTRIES = 2048\n 214\t\n 215\t# Phase admission is intentionally explicit. P16 lands the behavior-preserving\n 216\t# substrate with no language enabled; later phases add only measured lanes.\n 217\tPRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES: frozenset[str] = frozenset({\"cpp\"})\n 218\t\n 219\t\n 220\t@dataclass(frozen=True, slots=True)\n 221\tclass ResolvedCall:\n 222\t \"\"\"A call resolved to concrete symbol IDs with a confidence score.\"\"\"\n 223\t\n 224\t caller_id: str # symbol node ID of the calling function/method\n 225\t callee_id: str # symbol node ID of the called function/method\n 226\t confidence: float # 0.0\u20131.0\n 227\t line: int # call site line number (for diagnostics)\n 228\t origin: ResolutionOrigin # which strategy below produced it\n 229\t edge_type: CallSiteEdgeType = \"calls\" # carried through from the CallSite\n 230\t supplied_props: frozenset[str] | None = None # prop names supplied in JSX element (None if unknown/spread)\n 231\t\n 232\t\n 233\tdef _same_translation_unit(decl_file: str, def_file: str) -> bool:\n 234\t \"\"\"Are these two paths the same C++ translation unit?\n 235\t\n 236\t Compared on the base name, because a public header rarely sits beside its\n 237\t implementation (``include/pkg/thing.h`` against ``src/thing.cc``). The\n 238\t include relation would be the better test, but a C++ include binds to the\n 239\t path as written and usually is not a file key.\n 240\t \"\"\"\n 241\t return (\n 242\t decl_file == def_file\n 243\t or PurePosixPath(decl_file).stem == PurePosixPath(def_file).stem\n 244\t )\n 245\t\n 246\t\n 247\tclass CallResolver:\n 248\t \"\"\"Resolve raw CallSites to symbol-level edges.\n 249\t\n 250\t Constructed once per ``GraphBuilder.build()`` call with the full set of\n 251\t parsed files and import edges, then driven one file at a time.\n 252\t\n 253\t ``resolve_file()`` is **not** safe to call concurrently. Several lazy\n 254\t caches are filled during resolution, and the capped ones evict wholesale.\n 255\t Every cached value is a pure function of state fixed at construction, so a\n 256\t race would cost recomputation rather than a wrong answer, but the eviction\n 257\t makes concurrent use pointless as well as unsupported.\n 258\t \"\"\"\n 259\t\n 260\t def __init__(\n 261\t self,\n 262\t parsed_files: dict[str, ParsedFile],\n 263\t import_targets: dict[str, set[str]],\n 264\t *,\n 265\t repo_path: str | None = None,\n 266\t import_maps: Any | None = None,\n 267\t heritage_parents: dict[str, set[str]] | None = None,\n 268\t return_type_chain_languages: frozenset[str] | None = None,\n 269\t ) -> None:\n 270\t # {type symbol id: parent type symbol ids}, from the caller's already\n 271\t # resolved heritage. Absent when the resolver is built standalone, in\n 272\t # which case the inherited tier simply never fires.\n 273\t self._heritage_parents: dict[str, set[str]] = heritage_parents or {}\n 274\t self._return_type_chain_languages = (\n 275\t PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES\n 276\t if return_type_chain_languages is None\n 277\t else return_type_chain_languages\n 278\t )\n 279\t self._ancestors: dict[str, tuple[str, ...]] = {}\n 280\t # Per-file symbol index: {file_path: {symbol_name: symbol_id}}\n 281\t self._file_symbols: dict[str, dict[str, str]] = {}\n 282\t\n 283\t # Per-file method index: {file_path: {(class_name, method_name): symbol_id}}\n 284\t self._file_methods: dict[str, dict[tuple[str, str], str]] = {}\n 285\t\n 286\t # Global method index: {(class_name, method_name): [(file_path, symbol_id)]}\n 287\t # in file-insertion order \u2014 replaces the trait-dispatch scan over\n 288\t # every file's method dict with one short-list lookup.\n 289\t self._global_methods: dict[tuple[str, str], list[tuple[str, str]]] = defaultdict(list)\n 290\t\n 291\t # Global symbol index: {name: [symbol_ids]} \u2014 for Tier 3\n 292\t self._global_symbols: dict[str, list[str]] = defaultdict(list)\n 293\t self._symbols_by_id = {\n 294\t symbol.id: symbol for parsed in parsed_files.values() for symbol in parsed.symbols\n 295\t }\n 296\t self._symbol_paths_by_id = {\n 297\t symbol.id: path\n 298\t for path, parsed in parsed_files.items()\n 299\t for symbol in parsed.symbols\n 300\t }\n 301\t self._overload_return_types: dict[tuple[str, str | None, str, int | None], set[str]] = (\n 302\t defaultdict(set)\n 303\t )\n 304\t for path, parsed in parsed_files.items():\n 305\t for symbol in parsed.symbols:\n 306\t raw_return = declared_return_type(symbol.signature or \"\")\n 307\t normalized = (\n 308\t normalize_return_type(raw_return, symbol.language) if raw_return else None\n 309\t )\n 310\t if normalized is not None:\n 311\t key = (\n 312\t path,\n 313\t symbol.parent_name,\n 314\t symbol.name,\n 315\t signature_parameter_count(symbol.signature or \"\"),\n 316\t )\n 317\t self._overload_return_types[key].add(normalized)\n 318\t self._known_type_names = frozenset(\n 319\t symbol.name for symbol in self._symbols_by_id.values() if symbol.kind in _TYPE_KINDS\n 320\t )\n 321\t\n 322\t # Symbols in the index above that are data members, not callables\n 323\t # Held as an id set rather than a full id->kind map: it is the only\n 324\t # kind question asked of it and the set is small.\n 325\t self._non_callable_ids: set[str] = set()\n 326\t self._property_accessor_ids: set[str] = set()\n 327\t\n 328\t # C/C++ forward declaration \u2192 the definition it declares. Populated by\n 329\t # ``_build_indices``; applied to every resolved call so the edge lands\n 330\t # on the body rather than the header line that announced it.\n 331\t self._decl_to_def: dict[str, str] = {}\n 332\t\n 333\t # Import graph: {file_path: set of imported file paths}\n 334\t self._import_targets = import_targets\n 335\t\n 336\t # Shared import-name maps (built once per GraphBuilder.build() and\n 337\t # injected; standalone construction builds them locally).\n 338\t if import_maps is None:\n 339\t from .import_index import build_import_name_maps\n 340\t\n 341\t import_maps = build_import_name_maps(parsed_files)\n 342\t # Import name mapping: {file_path: {local_name: source_file}}\n 343\t self._import_names: dict[str, dict[str, str]] = import_maps.import_names\n 344\t # Full binding data: {file_path: {local_name: NamedBinding}}\n 345\t self._import_bindings: dict[str, dict[str, NamedBinding]] = import_maps.import_bindings\n 346\t # Module alias mapping: {file_path: {alias: source_file}}\n 347\t self._module_aliases: dict[str, dict[str, str]] = import_maps.module_aliases\n 348\t\n 349\t # Lazy per-file merged views of every imported file's symbol /\n 350\t # method tables \u2014 turns the Tier-2b \"scan each imported file\"\n 351\t # loops into single dict lookups. Built on first miss per file;\n 352\t # merge order is sorted(import paths) with first-wins so shadowed\n 353\t # names resolve deterministically (the old set-iteration order was\n 354\t # hash-randomized per process).\n 355\t self._merged_import_symbols: dict[str, dict[str, str]] = {}\n 356\t self._merged_import_methods: dict[str, dict[tuple[str, str], str]] = {}\n 357\t\n 358\t # Lazy per-file set of (line, target) that also carry a receiver.\n 359\t self._member_shaped: dict[str, set[tuple[int, str]]] = {}\n 360\t\n 361\t # Receiver typing reads source text, so both caches are capped rather\n 362\t # than per-repo: files resolve one at a time, so a few slots always\n 363\t # hit, and the cap is what keeps a whole repo's source out of memory.\n 364\t # Scanning is memoised per *function*, not per reference \u2014 one scan\n 365\t # answers every unresolved receiver in a body.\n 366\t self._source_text: dict[str, str] = {}\n 367\t self._declarations: dict[str, tuple[Declaration, ...]] = {}\n 368\t self._symbol_spans: dict[str, dict[str, tuple[int, int]]] = {}\n 369\t self._body_types: dict[tuple[str, str], dict[str, str | None]] = {}\n 370\t self._field_types: dict[str, dict[str, dict[str, str | None]]] = {}\n 371\t self._bindings: dict[str, tuple[tuple[int, str], ...]] = {}\n 372\t self._bound_names: dict[tuple[str, str], frozenset[str]] = {}\n 373\t # {file: {name: type}} \u2014 module-level defs a framework decorator retyped.\n 374\t self._framework_types: dict[str, dict[str, str]] = {}\n 375\t self._external_names: dict[str, frozenset[str]] = {}\n 376\t self._repo_rebound_names: dict[str, frozenset[str]] = {}\n 377\t self._method_name_set: frozenset[str] | None = None\n 378\t self._framework_name_set: frozenset[str] | None = None\n 379\t\n 380\t # Barrel re-export origins: {barrel_file: {name: origin_file}}\n 381\t self._barrel_origins: dict[str, dict[str, str]] = defaultdict(dict)\n 382\t\n 383\t # Keep reference for cross-language checks in Tier 3\n 384\t self._parsed_files = parsed_files\n 385\t\n 386\t # Rust cross-crate resolution\n 387\t self._repo_path = repo_path\n 388\t self._rust_crate_src: dict[str, str] | None = None # lazy\n 389\t\n 390\t # Go package-scoped resolution (lazy GoPackageIndex). ``_go_index``\n 391\t # holds the built index; ``_go_index_built`` distinguishes \"not yet\n 392\t # built\" from \"built but unavailable\" (no repo_path / no go files).\n 393\t self._go_index: Any = None\n 394\t self._go_index_built = False\n 395\t\n 396\t # JVM same-package resolution (lazy JvmWorkspaceIndex)\n 397\t self._jvm_index: Any = None\n 398\t self._jvm_index_built = False\n 399\t\n 400\t # C/C++ same-target resolution (lazy CppWorkspaceIndex)\n 401\t self._cpp_index: Any = None\n 402\t self._cpp_index_built = False\n 403\t\n 404\t self._strategies_by_file: dict[str, _LanguageCallStrategies] = {}\n 405\t\n 406\t self._build_indices(parsed_files)\n 407\t self._follow_barrel_exports()\n 408\t\n 409\t def _follow_barrel_exports(self) -> None:\n 410\t \"\"\"Detect barrel/re-export files and record origin mappings.\n 411\t\n 412\t A barrel file imports a name and re-exports it without defining it\n 413\t locally (e.g., ``__init__.py`` with ``from .calculator import Calculator``).\n 414\t When downstream code imports from the barrel, we follow chains to\n 415\t find the actual defining file.\n 416\t \"\"\"\n 417\t # First pass: identify direct barrel origins\n 418\t for path, name_to_file in self._import_names.items():\n 419\t file_syms = self._file_symbols.get(path, {})\n 420\t for name, source_file in name_to_file.items():\n 421\t # An origin outside the repo names no file any reader of this\n 422\t # map can look up, and the wildcard pass below already refuses\n 423\t # one. Holding the invariant in one pass and not its twin is\n 424\t # what makes a later reader look safe when it is not.\n 425\t if name not in file_syms and not source_file.startswith(\"external:\"):\n 426\t self._barrel_origins[path][name] = source_file\n 427\t\n 428\t # Track wildcard re-exports, which forward every symbol of the imported\n 429\t # module under this file's namespace. Two shapes qualify: Rust\n 430\t # `pub use foo::*` (is_reexport) and Python/JS `from foo import *` (a\n 431\t # \"*\" imported name). The latter is how package ``__init__.py`` barrels\n 432\t # commonly re-export a subpackage \u2014 ``build_import_name_maps`` skips the\n 433\t # \"*\" name (it is not a binding), so without this pass the barrel chain\n 434\t # dead-ends one hop short of the real definition and a call through the\n 435\t # barrel resolves to nothing.\n 436\t wildcard_sources: dict[str, list[str]] = defaultdict(list)\n 437\t for path, parsed in self._parsed_files.items():\n 438\t file_syms = self._file_symbols.get(path, {})\n 439\t for imp in parsed.imports:\n 440\t is_wildcard = imp.is_reexport or \"*\" in imp.imported_names\n 441\t if not is_wildcard or not imp.resolved_file:\n 442\t continue\n 443\t if imp.resolved_file.startswith(\"external:\"):\n 444\t continue\n 445\t # ``export * as ns from \"x\"`` forwards the module under ``ns``,\n 446\t # so x's names are reachable as ``ns.name`` and are NOT this\n 447\t # file's own exports. Flattening them makes a bare ``name``\n 448\t # resolve into a nested namespace it was never in.\n 449\t if any(b.local_name == \"*\" and b.exported_name for b in imp.bindings):\n 450\t continue\n 451\t resolved = imp.resolved_file\n 452\t if resolved != path:\n 453\t wildcard_sources[path].append(resolved)\n 454\t source_syms = self._file_symbols.get(resolved, {})\n 455\t source_parsed = self._parsed_files.get(resolved)\n 456\t published = (\n 457\t (*source_syms, *source_parsed.export_aliases)\n 458\t if source_parsed\n 459\t else tuple(source_syms)\n 460\t )\n 461\t for sym_name in published:\n 462\t if sym_name not in file_syms:\n 463\t self._barrel_origins[path][sym_name] = resolved\n 464\t\n 465\t # The pass above forwards only what the source file DECLARES, so a\n 466\t # barrel over a barrel forwards nothing and the chain breaks at its\n 467\t # first link rather than its last. Forward what the source file\n 468\t # re-exports too, to a fixpoint. The multi-hop pass below cannot do\n 469\t # this job \u2014 it deepens entries that exist, and here none do.\n 470\t #\n 471\t # Sorted so that a name two of this file's barrels both forward lands on\n 472\t # the same origin whatever order the repository was walked in.\n 473\t for _ in range(4):\n 474\t changed = False\n 475\t for path, sources in sorted(wildcard_sources.items()):\n 476\t file_syms = self._file_symbols.get(path, {})\n 477\t origins = self._barrel_origins[path]\n 478\t for source in sorted(sources):\n 479\t source_bindings = self._import_bindings.get(source, {})\n 480\t for name, declaring in sorted(self._barrel_origins.get(source, {}).items()):\n 481\t if name in file_syms or name in origins or declaring == path:\n 482\t continue\n 483\t # The map keys a name as the source file spells it and\n 484\t # records only the declaring file, never the name the\n 485\t # symbol has there. A hop that renames therefore hands\n 486\t # on a key the declaring file may coincidentally\n 487\t # declare as something unrelated, and the receiving\n 488\t # file carries no binding to undo it with. Refuse those\n 489\t # rather than forward a name that means something else\n 490\t # at the far end; it costs reach, never correctness.\n 491\t binding = source_bindings.get(name)\n 492\t if binding is not None and (binding.exported_name or name) != name:\n 493\t continue\n 494\t origins[name] = declaring\n 495\t changed = True\n 496\t if not changed:\n 497\t break\n 498\t\n 499\t # Multi-hop: follow chains up to 5 hops\n 500\t for _ in range(4):\n 501\t changed = False\n 502\t for _path, origins in list(self._barrel_origins.items()):\n 503\t for name, source in list(origins.items()):\n 504\t deeper = self._barrel_origins.get(source, {}).get(name)\n 505\t if deeper and deeper != source:\n 506\t origins[name] = deeper\n 507\t changed = True\n 508\t if not changed:\n 509\t break\n 510\t\n 511\t def _get_rust_crate_src(self) -> dict[str, str]:\n 512\t \"\"\"Lazily build a mapping from normalised crate name to src/ dir.\"\"\"\n 513\t if self._rust_crate_src is not None:\n 514\t return self._rust_crate_src\n 515\t self._rust_crate_src = {}\n 516\t if not self._repo_path:\n 517\t return self._rust_crate_src\n 518\t from .resolvers.rust_workspace import get_or_build_cargo_workspace_index\n 519\t\n 520\t class _Ctx:\n 521\t def __init__(self, rp, pf):\n 522\t self.repo_path = rp\n 523\t self.parsed_files = pf\n 524\t\n 525\t ctx = _Ctx(self._repo_path, self._parsed_files)\n 526\t ws = get_or_build_cargo_workspace_index(ctx)\n 527\t if ws:\n 528\t for crate in ws.crates:\n 529\t normalized = crate.name.replace(\"-\", \"_\")\n 530\t self._rust_crate_src[normalized] = crate.src_dir\n 531\t return self._rust_crate_src\n 532\t\n 533\t def _get_go_index(self) -> Any:\n 534\t \"\"\"Lazily build the GoPackageIndex (or None if unavailable).\n 535\t\n 536\t Mirrors ``_get_rust_crate_src``: the resolver runs without a\n 537\t ``ResolverContext``, so it constructs a minimal stand-in and rebuilds\n 538\t the package index. The build is one walk over the ``.go`` files; the\n 539\t result is cached for the lifetime of the resolver.\n 540\t \"\"\"\n 541\t if self._go_index_built:\n 542\t return self._go_index\n 543\t self._go_index_built = True\n 544\t if not self._repo_path:\n 545\t return None\n 546\t from pathlib import Path\n 547\t\n 548\t from .resolvers.go_workspace import build_go_package_index\n 549\t\n 550\t class _Ctx:\n 551\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 552\t self.repo_path = Path(rp)\n 553\t self.path_set = set(pf.keys())\n 554\t self.sorted_paths = tuple(sorted(self.path_set))\n 555\t self.parsed_files = pf\n 556\t self.go_modules: tuple[\n[repowise#63171fe88e36: 600 lines omitted (~7951 tokens); restore: repowise expand 63171fe88e36]","start_line":197,"symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver","truncated":true,"verified":true},"get_symbol:largest-symbol":{"_meta":{"completeness":{"capped":true},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#c07e342c9b4c","repowise#6abe1e1bba89"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":8114},"replaced_tokens":25149,"response_budget":{"limit_chars":24000,"serialized_chars":22619,"tier":"default"},"state":{"truncated":true},"timing_ms":7.41,"tokens_saved":19481},"continuation":"packages/core/src/repowise/core/ingestion/call_resolver.py:847-2117","continuation_reference":{"id":"packages/core/src/repowise/core/ingestion/call_resolver.py:847-2117","kind":"file_range","path":"packages/core/src/repowise/core/ingestion/call_resolver.py","range":[847,2117],"repository":"default","source_kind":"source","verification_basis":"live"},"end_line":846,"file":"packages/core/src/repowise/core/ingestion/call_resolver.py","kind":"class","name":"CallResolver","omission_marker":"[repowise#6abe1e1bba89: 11 lines omitted (~136 tokens); restore: repowise expand 6abe1e1bba89]","qualified_name":"packages.core.src.repowise.core.ingestion.call_resolver.CallResolver","signature":"class CallResolver","source":" 247\tclass CallResolver:\n 248\t \"\"\"Resolve raw CallSites to symbol-level edges.\n 249\t\n 250\t Constructed once per ``GraphBuilder.build()`` call with the full set of\n 251\t parsed files and import edges, then driven one file at a time.\n 252\t\n 253\t ``resolve_file()`` is **not** safe to call concurrently. Several lazy\n 254\t caches are filled during resolution, and the capped ones evict wholesale.\n 255\t Every cached value is a pure function of state fixed at construction, so a\n 256\t race would cost recomputation rather than a wrong answer, but the eviction\n 257\t makes concurrent use pointless as well as unsupported.\n 258\t \"\"\"\n 259\t\n 260\t def __init__(\n 261\t self,\n 262\t parsed_files: dict[str, ParsedFile],\n 263\t import_targets: dict[str, set[str]],\n 264\t *,\n 265\t repo_path: str | None = None,\n 266\t import_maps: Any | None = None,\n 267\t heritage_parents: dict[str, set[str]] | None = None,\n 268\t return_type_chain_languages: frozenset[str] | None = None,\n 269\t ) -> None:\n 270\t # {type symbol id: parent type symbol ids}, from the caller's already\n 271\t # resolved heritage. Absent when the resolver is built standalone, in\n 272\t # which case the inherited tier simply never fires.\n 273\t self._heritage_parents: dict[str, set[str]] = heritage_parents or {}\n 274\t self._return_type_chain_languages = (\n 275\t PRODUCTION_RETURN_TYPE_CHAIN_LANGUAGES\n 276\t if return_type_chain_languages is None\n 277\t else return_type_chain_languages\n 278\t )\n 279\t self._ancestors: dict[str, tuple[str, ...]] = {}\n 280\t # Per-file symbol index: {file_path: {symbol_name: symbol_id}}\n 281\t self._file_symbols: dict[str, dict[str, str]] = {}\n 282\t\n 283\t # Per-file method index: {file_path: {(class_name, method_name): symbol_id}}\n 284\t self._file_methods: dict[str, dict[tuple[str, str], str]] = {}\n 285\t\n 286\t # Global method index: {(class_name, method_name): [(file_path, symbol_id)]}\n 287\t # in file-insertion order \u2014 replaces the trait-dispatch scan over\n 288\t # every file's method dict with one short-list lookup.\n 289\t self._global_methods: dict[tuple[str, str], list[tuple[str, str]]] = defaultdict(list)\n 290\t\n 291\t # Global symbol index: {name: [symbol_ids]} \u2014 for Tier 3\n 292\t self._global_symbols: dict[str, list[str]] = defaultdict(list)\n 293\t self._symbols_by_id = {\n 294\t symbol.id: symbol for parsed in parsed_files.values() for symbol in parsed.symbols\n 295\t }\n 296\t self._symbol_paths_by_id = {\n 297\t symbol.id: path\n 298\t for path, parsed in parsed_files.items()\n 299\t for symbol in parsed.symbols\n 300\t }\n 301\t self._overload_return_types: dict[tuple[str, str | None, str, int | None], set[str]] = (\n 302\t defaultdict(set)\n 303\t )\n 304\t for path, parsed in parsed_files.items():\n 305\t for symbol in parsed.symbols:\n 306\t raw_return = declared_return_type(symbol.signature or \"\")\n 307\t normalized = (\n 308\t normalize_return_type(raw_return, symbol.language) if raw_return else None\n 309\t )\n 310\t if normalized is not None:\n 311\t key = (\n 312\t path,\n 313\t symbol.parent_name,\n 314\t symbol.name,\n 315\t signature_parameter_count(symbol.signature or \"\"),\n 316\t )\n 317\t self._overload_return_types[key].add(normalized)\n 318\t self._known_type_names = frozenset(\n 319\t symbol.name for symbol in self._symbols_by_id.values() if symbol.kind in _TYPE_KINDS\n 320\t )\n 321\t\n 322\t # Symbols in the index above that are data members, not callables\n 323\t # Held as an id set rather than a full id->kind map: it is the only\n 324\t # kind question asked of it and the set is small.\n 325\t self._non_callable_ids: set[str] = set()\n 326\t self._property_accessor_ids: set[str] = set()\n 327\t\n 328\t # C/C++ forward declaration \u2192 the definition it declares. Populated by\n 329\t # ``_build_indices``; applied to every resolved call so the edge lands\n 330\t # on the body rather than the header line that announced it.\n 331\t self._decl_to_def: dict[str, str] = {}\n 332\t\n 333\t # Import graph: {file_path: set of imported file paths}\n 334\t self._import_targets = import_targets\n 335\t\n 336\t # Shared import-name maps (built once per GraphBuilder.build() and\n 337\t # injected; standalone construction builds them locally).\n 338\t if import_maps is None:\n 339\t from .import_index import build_import_name_maps\n 340\t\n 341\t import_maps = build_import_name_maps(parsed_files)\n 342\t # Import name mapping: {file_path: {local_name: source_file}}\n 343\t self._import_names: dict[str, dict[str, str]] = import_maps.import_names\n 344\t # Full binding data: {file_path: {local_name: NamedBinding}}\n 345\t self._import_bindings: dict[str, dict[str, NamedBinding]] = import_maps.import_bindings\n 346\t # Module alias mapping: {file_path: {alias: source_file}}\n 347\t self._module_aliases: dict[str, dict[str, str]] = import_maps.module_aliases\n 348\t\n 349\t # Lazy per-file merged views of every imported file's symbol /\n 350\t # method tables \u2014 turns the Tier-2b \"scan each imported file\"\n 351\t # loops into single dict lookups. Built on first miss per file;\n 352\t # merge order is sorted(import paths) with first-wins so shadowed\n 353\t # names resolve deterministically (the old set-iteration order was\n 354\t # hash-randomized per process).\n 355\t self._merged_import_symbols: dict[str, dict[str, str]] = {}\n 356\t self._merged_import_methods: dict[str, dict[tuple[str, str], str]] = {}\n 357\t\n 358\t # Lazy per-file set of (line, target) that also carry a receiver.\n 359\t self._member_shaped: dict[str, set[tuple[int, str]]] = {}\n 360\t\n 361\t # Receiver typing reads source text, so both caches are capped rather\n 362\t # than per-repo: files resolve one at a time, so a few slots always\n 363\t # hit, and the cap is what keeps a whole repo's source out of memory.\n 364\t # Scanning is memoised per *function*, not per reference \u2014 one scan\n 365\t # answers every unresolved receiver in a body.\n 366\t self._source_text: dict[str, str] = {}\n 367\t self._declarations: dict[str, tuple[Declaration, ...]] = {}\n 368\t self._symbol_spans: dict[str, dict[str, tuple[int, int]]] = {}\n 369\t self._body_types: dict[tuple[str, str], dict[str, str | None]] = {}\n 370\t self._field_types: dict[str, dict[str, dict[str, str | None]]] = {}\n 371\t self._bindings: dict[str, tuple[tuple[int, str], ...]] = {}\n 372\t self._bound_names: dict[tuple[str, str], frozenset[str]] = {}\n 373\t # {file: {name: type}} \u2014 module-level defs a framework decorator retyped.\n 374\t self._framework_types: dict[str, dict[str, str]] = {}\n 375\t self._external_names: dict[str, frozenset[str]] = {}\n 376\t self._repo_rebound_names: dict[str, frozenset[str]] = {}\n 377\t self._method_name_set: frozenset[str] | None = None\n 378\t self._framework_name_set: frozenset[str] | None = None\n 379\t\n 380\t # Barrel re-export origins: {barrel_file: {name: origin_file}}\n 381\t self._barrel_origins: dict[str, dict[str, str]] = defaultdict(dict)\n 382\t\n 383\t # Keep reference for cross-language checks in Tier 3\n 384\t self._parsed_files = parsed_files\n 385\t\n 386\t # Rust cross-crate resolution\n 387\t self._repo_path = repo_path\n 388\t self._rust_crate_src: dict[str, str] | None = None # lazy\n 389\t\n 390\t # Go package-scoped resolution (lazy GoPackageIndex). ``_go_index``\n 391\t # holds the built index; ``_go_index_built`` distinguishes \"not yet\n 392\t # built\" from \"built but unavailable\" (no repo_path / no go files).\n 393\t self._go_index: Any = None\n 394\t self._go_index_built = False\n 395\t\n 396\t # JVM same-package resolution (lazy JvmWorkspaceIndex)\n 397\t self._jvm_index: Any = None\n 398\t self._jvm_index_built = False\n 399\t\n 400\t # C/C++ same-target resolution (lazy CppWorkspaceIndex)\n 401\t self._cpp_index: Any = None\n 402\t self._cpp_index_built = False\n 403\t\n 404\t self._strategies_by_file: dict[str, _LanguageCallStrategies] = {}\n 405\t\n 406\t self._build_indices(parsed_files)\n 407\t self._follow_barrel_exports()\n 408\t\n 409\t def _follow_barrel_exports(self) -> None:\n 410\t \"\"\"Detect barrel/re-export files and record origin mappings.\n 411\t\n 412\t A barrel file imports a name and re-exports it without defining it\n 413\t locally (e.g., ``__init__.py`` with ``from .calculator import Calculator``).\n 414\t When downstream code imports from the barrel, we follow chains to\n 415\t find the actual defining file.\n 416\t \"\"\"\n 417\t # First pass: identify direct barrel origins\n 418\t for path, name_to_file in self._import_names.items():\n 419\t file_syms = self._file_symbols.get(path, {})\n 420\t for name, source_file in name_to_file.items():\n 421\t # An origin outside the repo names no file any reader of this\n 422\t # map can look up, and the wildcard pass below already refuses\n 423\t # one. Holding the invariant in one pass and not its twin is\n 424\t # what makes a later reader look safe when it is not.\n 425\t if name not in file_syms and not source_file.startswith(\"external:\"):\n 426\t self._barrel_origins[path][name] = source_file\n 427\t\n 428\t # Track wildcard re-exports, which forward every symbol of the imported\n 429\t # module under this file's namespace. Two shapes qualify: Rust\n 430\t # `pub use foo::*` (is_reexport) and Python/JS `from foo import *` (a\n 431\t # \"*\" imported name). The latter is how package ``__init__.py`` barrels\n 432\t # commonly re-export a subpackage \u2014 ``build_import_name_maps`` skips the\n 433\t # \"*\" name (it is not a binding), so without this pass the barrel chain\n 434\t # dead-ends one hop short of the real definition and a call through the\n 435\t # barrel resolves to nothing.\n 436\t wildcard_sources: dict[str, list[str]] = defaultdict(list)\n 437\t for path, parsed in self._parsed_files.items():\n 438\t file_syms = self._file_symbols.get(path, {})\n 439\t for imp in parsed.imports:\n 440\t is_wildcard = imp.is_reexport or \"*\" in imp.imported_names\n 441\t if not is_wildcard or not imp.resolved_file:\n 442\t continue\n 443\t if imp.resolved_file.startswith(\"external:\"):\n 444\t continue\n 445\t # ``export * as ns from \"x\"`` forwards the module under ``ns``,\n 446\t # so x's names are reachable as ``ns.name`` and are NOT this\n 447\t # file's own exports. Flattening them makes a bare ``name``\n 448\t # resolve into a nested namespace it was never in.\n 449\t if any(b.local_name == \"*\" and b.exported_name for b in imp.bindings):\n 450\t continue\n 451\t resolved = imp.resolved_file\n 452\t if resolved != path:\n 453\t wildcard_sources[path].append(resolved)\n 454\t source_syms = self._file_symbols.get(resolved, {})\n 455\t source_parsed = self._parsed_files.get(resolved)\n 456\t published = (\n 457\t (*source_syms, *source_parsed.export_aliases)\n 458\t if source_parsed\n 459\t else tuple(source_syms)\n 460\t )\n 461\t for sym_name in published:\n 462\t if sym_name not in file_syms:\n 463\t self._barrel_origins[path][sym_name] = resolved\n 464\t\n 465\t # The pass above forwards only what the source file DECLARES, so a\n 466\t # barrel over a barrel forwards nothing and the chain breaks at its\n 467\t # first link rather than its last. Forward what the source file\n 468\t # re-exports too, to a fixpoint. The multi-hop pass below cannot do\n 469\t # this job \u2014 it deepens entries that exist, and here none do.\n 470\t #\n 471\t # Sorted so that a name two of this file's barrels both forward lands on\n 472\t # the same origin whatever order the repository was walked in.\n 473\t for _ in range(4):\n 474\t changed = False\n 475\t for path, sources in sorted(wildcard_sources.items()):\n 476\t file_syms = self._file_symbols.get(path, {})\n 477\t origins = self._barrel_origins[path]\n 478\t for source in sorted(sources):\n 479\t source_bindings = self._import_bindings.get(source, {})\n 480\t for name, declaring in sorted(self._barrel_origins.get(source, {}).items()):\n 481\t if name in file_syms or name in origins or declaring == path:\n 482\t continue\n 483\t # The map keys a name as the source file spells it and\n 484\t # records only the declaring file, never the name the\n 485\t # symbol has there. A hop that renames therefore hands\n 486\t # on a key the declaring file may coincidentally\n 487\t # declare as something unrelated, and the receiving\n 488\t # file carries no binding to undo it with. Refuse those\n 489\t # rather than forward a name that means something else\n 490\t # at the far end; it costs reach, never correctness.\n 491\t binding = source_bindings.get(name)\n 492\t if binding is not None and (binding.exported_name or name) != name:\n 493\t continue\n 494\t origins[name] = declaring\n 495\t changed = True\n 496\t if not changed:\n 497\t break\n 498\t\n 499\t # Multi-hop: follow chains up to 5 hops\n 500\t for _ in range(4):\n 501\t changed = False\n 502\t for _path, origins in list(self._barrel_origins.items()):\n 503\t for name, source in list(origins.items()):\n 504\t deeper = self._barrel_origins.get(source, {}).get(name)\n 505\t if deeper and deeper != source:\n 506\t origins[name] = deeper\n 507\t changed = True\n 508\t if not changed:\n 509\t break\n 510\t\n 511\t def _get_rust_crate_src(self) -> dict[str, str]:\n 512\t \"\"\"Lazily build a mapping from normalised crate name to src/ dir.\"\"\"\n 513\t if self._rust_crate_src is not None:\n 514\t return self._rust_crate_src\n 515\t self._rust_crate_src = {}\n 516\t if not self._repo_path:\n 517\t return self._rust_crate_src\n 518\t from .resolvers.rust_workspace import get_or_build_cargo_workspace_index\n 519\t\n 520\t class _Ctx:\n 521\t def __init__(self, rp, pf):\n 522\t self.repo_path = rp\n 523\t self.parsed_files = pf\n 524\t\n 525\t ctx = _Ctx(self._repo_path, self._parsed_files)\n 526\t ws = get_or_build_cargo_workspace_index(ctx)\n 527\t if ws:\n 528\t for crate in ws.crates:\n 529\t normalized = crate.name.replace(\"-\", \"_\")\n 530\t self._rust_crate_src[normalized] = crate.src_dir\n 531\t return self._rust_crate_src\n 532\t\n 533\t def _get_go_index(self) -> Any:\n 534\t \"\"\"Lazily build the GoPackageIndex (or None if unavailable).\n 535\t\n 536\t Mirrors ``_get_rust_crate_src``: the resolver runs without a\n 537\t ``ResolverContext``, so it constructs a minimal stand-in and rebuilds\n 538\t the package index. The build is one walk over the ``.go`` files; the\n 539\t result is cached for the lifetime of the resolver.\n 540\t \"\"\"\n 541\t if self._go_index_built:\n 542\t return self._go_index\n 543\t self._go_index_built = True\n 544\t if not self._repo_path:\n 545\t return None\n 546\t from pathlib import Path\n 547\t\n 548\t from .resolvers.go_workspace import build_go_package_index\n 549\t\n 550\t class _Ctx:\n 551\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 552\t self.repo_path = Path(rp)\n 553\t self.path_set = set(pf.keys())\n 554\t self.sorted_paths = tuple(sorted(self.path_set))\n 555\t self.parsed_files = pf\n 556\t self.go_modules: tuple[tuple[str, str], ...] = ()\n 557\t self.go_module_path: str | None = None\n 558\t\n 559\t self._go_index = build_go_package_index(_Ctx(self._repo_path, self._parsed_files))\n 560\t return self._go_index\n 561\t\n 562\t def _strategies_for(self, file_path: str) -> _LanguageCallStrategies:\n 563\t \"\"\"The extra strategies this file's language gets.\"\"\"\n 564\t parsed = self._parsed_files.get(file_path)\n 565\t language = parsed.file_info.language if parsed else \"\"\n 566\t return _LANGUAGE_CALL_STRATEGIES.get(language, _NO_LANGUAGE_STRATEGIES)\n 567\t\n 568\t def _get_cpp_index(self) -> Any:\n 569\t \"\"\"Lazily build a CppWorkspaceIndex via a minimal stand-in context.\"\"\"\n 570\t if self._cpp_index_built:\n 571\t return self._cpp_index\n 572\t self._cpp_index_built = True\n 573\t if not self._repo_path:\n 574\t return None\n 575\t from pathlib import Path\n 576\t\n 577\t from .resolvers.cpp_workspace import build_cpp_workspace_index\n 578\t\n 579\t class _Ctx:\n 580\t def __init__(self, rp: str, pf: dict[str, ParsedFile]) -> None:\n 581\t self.repo_path = Path(rp)\n 582\t self.path_set = set(pf.keys())\n 583\t self.sorted_paths = tuple(sorted(self.path_set))\n 584\t self.parsed_files = pf\n 585\t self.stem_map: dict[str, list[str]] = {}\n 586\t\n 587\t self._cpp_index = build_cpp_workspace_index(_Ctx(self._repo_path, self._parsed_files))\n 588\t return self._cpp_index\n 589\t\n 590\t def _collapse_declarations(self, sym_ids: list[str]) -> set[str]:\n 591\t \"\"\"Fold each declaration onto the definition it was paired with.\n 592\t\n 593\t Two ids naming one symbol must not read as an ambiguity.\n 594\t \"\"\"\n 595\t return {self._decl_to_def.get(sym_id, sym_id) for sym_id in sym_ids}\n 596\t\n 597\t def _resolve_cpp_scoped_call(\n 598\t self,\n 599\t file_path: str,\n 600\t call: CallSite,\n 601\t caller_id: str,\n 602\t ) -> ResolvedCall | None:\n 603\t \"\"\"Resolve ``Qualifier::name()`` against the class the qualifier names.\n 604\t\n 605\t The qualifier is written at the call site, so this infers nothing: the\n 606\t repository either declares ``Qualifier::name`` or it does not. Before\n 607\t it existed only the leaf name survived ex\n[repowise#c07e342c9b4c: 600 lines omitted (~7978 tokens); restore: repowise expand c07e342c9b4c]","start_line":247,"symbol_id":"packages/core/src/repowise/core/ingestion/call_resolver.py::CallResolver","truncated":true,"verified":true},"get_why:targets":{"_meta":{"completeness":{"capped":true,"reason":"construction_cap","shown":23,"total":173},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#c3d5b15fafd9","repowise#9f8533616584","repowise#5e41015972a5","repowise#9fcc901ca410"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":39053},"response_budget":{"limit_chars":24000,"serialized_chars":22762,"tier":"default"},"state":{"truncated":true}},"alignment":{"active_count":0,"candidate_count":0,"deprecated_count":0,"explanation":"No architectural decisions govern packages/core/src/repowise/core/ingestion/call_resolver.py. This file is ungoverned \u2014 it may be an outlier or simply undocumented.","governing_count":0,"score":"none","sibling_coverage":null,"stale_count":0},"answer_basis":"episode","code_rationale":[{"comment":"Three-tier call resolution engine for the symbol-level dependency graph. Resolves CallSite objects (extracted from AST) to concrete symbol node IDs in the graph, producing CALLS edges with confidence scores. Resolution tiers (checked in order, first match wins): Tier 1 \u2014 Same-file exact match (confidence 0.95) The call target matches a symbol defined in the same file. Tier 2 \u2014 Import-scoped match (confidence 0.90) The call target matches a symbol in a file that the caller imports, optionally scoped by the specific imported names. Tier 3 \u2014 Global unique match (confidence 0.50) The call target matches exactly one symbol across the entire codebase. Only fires when the match is unambiguous to avoid false edges. Each resolved call produces a (source_id, target_id, confidence, origin) tuple that the GraphBuilder converts into a CALLS edge. The tiers above are the headline three; ``ResolutionOrigin`` in ``models`` is the full set, one name per strategy, and it is what the edge carries.","evidence_refs":[{"content_id":"e7b6b95c70b3f8749c12","id":"ev_30e9f5f0c3b34b452e8c","kind":"file_content","line":1,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[1,12],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[1,12],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Languages where a call the caller's own class cannot answer is looked for on its ancestors. Both shapes \u2014 an explicit ``self``/``this`` receiver and an implicit one \u2014 end in the same walk. C++ is absent because its heritage binds a qualified external parent to a same-named local type, which puts unrelated siblings in one hierarchy before this walk even runs. Java is absent because `java.scm`'s bare-call pattern also matches `this.field.m()`, which no receiver-carrying pattern claims, so such a call arrives here indistinguishable from a real implicit receiver \u2014 and its measured population on two Java repos was zero, so the tier could only cost. C# is present, and was once wrongly removed: a name's overloads all share one symbol id, so a declaration line read back out of the graph names an arbitrary overload. That reads as a wrong target and is not one \u2014 the id these calls resolve to is the id C# binds.","evidence_refs":[{"content_id":"e4551f6a4120417a9ac1","id":"ev_4c7480bb5b6fcc223188","kind":"file_content","line":71,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[71,82],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[71,82],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Languages where a bare name is scoped lexically: it can only mean the caller's own module, an explicit ``import``, or the prelude. Elixir's ``alias`` / ``require`` / ``use`` bind a module name, never a function name, so repo-wide uniqueness is no evidence and only wildcard imports may merge names. F# is the same rule with different spelling: a bare name means the enclosing scope, a module the file has ``open``ed, or FSharp.Core, and nothing else -- a name unique across the repo is not thereby in scope.","evidence_refs":[{"content_id":"279bc93ec731b668214a","id":"ev_925a17bc0fec5d8f2f7e","kind":"file_content","line":89,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[89,95],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[89,95],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"What a language resolves that the language-neutral tiers cannot. ``free`` runs after the same-file tier and before the import tiers; ``member`` runs before every receiver strategy; ``member_fallback`` runs after all of them, so a strategy there only ever sees a call nothing else claimed and can only add an edge. All three stop at the first hit. Strategies are named rather than bound so a probe can substitute one.","evidence_refs":[{"content_id":"fa671bfea3e99da6733e","id":"ev_edb4dc3ce42f43aa3355","kind":"file_content","line":108,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[108,115],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[108,115],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"},{"comment":"Kinds that can never be the callee of a call, used to keep the bare-name Tier 3 index from offering a data member as a function. This is deliberately NOT the complement of ``_FUNCTION_KINDS``. Measured over the corpus, plenty of non-function kinds are legitimately called: ``class`` is a constructor in python/java/c#/typescript; ``variable`` is both a rust tuple ``enum_variant`` (309 grounded call edges on goose) and a typescript const whose initialiser is not syntactically a function, such as a factory result or a ``.bind()`` handle (2,173 on zod); ``type_alias`` is a Go conversion. Denying by function-ness would delete thousands of real edges. ``property`` is the one kind in the whole of ``language_configs.py`` that means \"data member\" and nothing else: it is emitted by exactly one mapping, rust's ``field_declaration``. Every other language spells its fields ``variable``, which is why this fix cannot be extended to them \u2014 there a field is indistinguishable from a callable value by kind alone.","evidence_refs":[{"content_id":"8ac00a8632e2a7726d77","id":"ev_603ed9ddc8822602b80c","kind":"file_content","line":132,"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale","range":[132,143],"repository":"default","source":"live_code_rationale","source_kind":"code_comment","verification":"exact","verification_basis":"live"}],"lines":[132,143],"matched_terms":[],"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","provenance":"extracted_rationale"}],"code_rationale_emitted":5,"code_rationale_omitted":49,"code_rationale_reduced_reason":"construction_cap","code_rationale_total":54,"code_rationale_truncated":true,"decisions":[],"episodes":[{"evidence":"commit 0cbe36f70f0d, 2026-08-30, changed 10 files together","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"episode","source_kind":"episode","verification_basis":"historical"}],"kind":"code_fix","provenance":"historical","recorded":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","scope":["packages/core/src/repowise/core/analysis/dead_code/analyzer.py","packages/core/src/repowise/core/analysis/dead_code/jsx_prop_guards.py","packages/core/src/repowise/core/ingestion/call_resolver.py","packages/core/src/repowise/core/ingestion/graph/_rehydrate.py","packages/core/src/repowise/core/ingestion/graph/_resolvers.py","packages/core/src/repowise/core/ingestion/models.py","packages/core/src/repowise/core/ingestion/parser.py","tests/unit/dead_code/_helpers.py","tests/unit/dead_code/test_jsx_prop_guard_dead_code.py","tests/unit/ingestion/test_graph_rehydrate.py"],"still_true":"recorded 2026-08-30 at 0cbe36f70f0d; 10 commits have touched its scope since","subject":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","tier":"git"}],"episodes_emitted":1,"episodes_omitted":20,"episodes_reduced_reason":"construction_cap_and_response_budget","episodes_total":21,"episodes_truncated":true,"git_archaeology":{"cross_references":[],"file_commits":[{"author":"Contributor 19","date":"2026-09-04T18:15:43+00:00","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:file_commits","source_kind":"archaeology:file_commits","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","provenance":"historical","sha":"9af0b5f9"}],"file_commits_emitted":1,"file_commits_omitted":33,"file_commits_reduced_reason":"construction_cap_and_response_budget","file_commits_total":34,"file_commits_truncated":true,"git_log":[{"author":"Contributor 19","commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","date":"2026-09-04","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","provenance":"historical","sha":"9af0b5f9ca65","source":"git_log_follow"},{"author":"Contributor 19","commit":"01e50e2f8475888541745fcbb0d40dd016f77476","date":"2026-09-04","evidence_refs":[{"commit":"01e50e2f8475888541745fcbb0d40dd016f77476","id":"ev_39e60b3a5fcdf4065a36","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(languages): parse Elixir to a full AST and move it to Good (#2127)","provenance":"historical","sha":"01e50e2f8475","source":"git_log_follow"},{"author":"Contributor 20","commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","date":"2026-08-30","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","provenance":"historical","sha":"0cbe36f70f0d","source":"git_log_follow"},{"author":"Contributor 19","commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","date":"2026-08-26","evidence_refs":[{"commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","id":"ev_a162f4fe7b64b188a5a7","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): refuse a data member on the import-merged tier (#1925)","provenance":"historical","sha":"58403ddb6949","source":"git_log_follow"},{"author":"Contributor 19","commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","date":"2026-08-25","evidence_refs":[{"commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","id":"ev_4b18c964f408fa622c84","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): resolve a call to an overload set instead of refusing it (#1923)","provenance":"historical","sha":"f97ced7a4c7b","source":"git_log_follow"},{"author":"Contributor 19","commit":"127e0f1ec4aab7033c5ef1139a0762b1d50a15ac","date":"2026-08-25","evidence_refs":[{"commit":"127e0f1ec4aab7033c5ef1139a0762b1d50a15ac","id":"ev_90dca2153133ec4557c0","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(ingestion): extract C++ in-class method declarations (#1921)","provenance":"historical","sha":"127e0f1ec4aa","source":"git_log_follow"},{"author":"Contributor 19","commit":"0c9faff85da640782783e1f9a1371f1c257ce5aa","date":"2026-08-25","evidence_refs":[{"commit":"0c9faff85da640782783e1f9a1371f1c257ce5aa","id":"ev_c5df10bf3bef8ae640b5","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"feat(ingestion): type C++ receivers from their declarations (#1919)","provenance":"historical","sha":"0c9faff85da6","source":"git_log_follow"},{"author":"Contributor 19","commit":"354269f101dd81be3a681e1e122c17d4b8c81bbc","date":"2026-08-25","evidence_refs":[{"commit":"354269f101dd81be3a681e1e122c17d4b8c81bbc","id":"ev_df55cb0a222f001ebcd4","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(ingestion): resolve C++ scoped calls against their qualifier (#1915)","provenance":"historical","sha":"354269f101dd","source":"git_log_follow"},{"author":"Contributor 19","commit":"08e493b8f932296fc572def1873a6431b3023404","date":"2026-08-23","evidence_refs":[{"commit":"08e493b8f932296fc572def1873a6431b3023404","id":"ev_d3d093332515aa05cb6e","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): a java chain rooted at an external type is not a bare-name call (#1897)","provenance":"historical","sha":"08e493b8f932","source":"git_log_follow"},{"author":"Contributor 19","commit":"330ad6fa13caa842d816b836349bcbe6403e5c79","date":"2026-08-23","evidence_refs":[{"commit":"330ad6fa13caa842d816b836349bcbe6403e5c79","id":"ev_1acf1dcd8778ada4188b","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): stop the repo-wide receiver tier answering for foreign types (#1893)","provenance":"historical","sha":"330ad6fa13ca","source":"git_log_follow"},{"author":"Contributor 19","commit":"d7bd394ca894e0cd68ed2fd429a8c3fa9ff34c5a","date":"2026-08-23","evidence_refs":[{"commit":"d7bd394ca894e0cd68ed2fd429a8c3fa9ff34c5a","id":"ev_a47485b7ddc68ba5486d","kind":"commit","provenance":"historical","repository":"default","source":"archaeology:git_log","source_kind":"archaeology:git_log","verification_basis":"historical"}],"message":"fix(graph): a rust macro invocation is not a function call (#1885)","provenance":"historical","sha":"d7bd394ca894","source":"git_log_follow"}],"git_log_emitted":11,"git_log_omitted":19,"git_log_reduced_reason":"construction_cap_and_response_budget","git_log_total":30,"git_log_truncated":true,"provenance":"historical","summary":"No architectural decisions found for packages/core/src/repowise/core/ingestion/call_resolver.py, but git archaeology recovered 34 direct commit(s), 0 cross-reference(s), and 30 git log result(s). Review these to understand the intent behind this code.","triggered":true},"mode":"path","omission_marker":"[repowise#9fcc901ca410: 369 lines omitted (~2722 tokens); restore: repowise expand 9fcc901ca410]","origin_story":{"age_days":20,"author_commit_pct":0.9412,"available":true,"contributors":[{"commit_count":32,"email":"[email protected]","first_commit_ts":1786882824,"last_commit_ts":1788545743,"name":"Contributor 19"},{"commit_count":1,"email":"[email protected]","first_commit_ts":1788086763,"last_commit_ts":1788086763,"name":"Contributor 20"},{"commit_count":1,"email":"[email protected]","first_commit_ts":1787414540,"last_commit_ts":1787414540,"name":"Contributor 23"}],"first_commit":"2026-08-16","key_commits":[{"author":"Contributor 19","body":"tree-sitter-fsharp 0.3.11 replaces the regex tier for .fs and .fsx.\nModules, namespaces, let bindings including each `and` continuation,\nrecords, unions, classes, interfaces, members and exceptions become\nsymbols; `///` comments become docstrings; `inherit` and\n`interface ... with` become heritage edges. Signature files stay on the\nimport-only path: one grammar per language cannot select the signature\ngrammar, and the implementation grammar mis-parses them.\n\nImports keep the existing resolver and its .fsproj compile-order leg;\n`open` now carries the wildcard sentinel, which is what it means. A bare\nname in F# is lexically scoped, so the resolver refuses the global-unique\ntier for it and merges names only through `open`; an uppercase unqualified\ncallee is a union case or constructor, not a call site.\n\nA registry-parity test pins that every non-passthrough language has a\ngrammar, a query file and a config, and a pipeline-worker test drives the\nreal parse entry point over a .fs file.\n\nNo health markers yet. Docs","date":"2026-09-04T18:15:43+00:00","evidence_refs":[{"commit":"9af0b5f9ca6564bf23be01c50828ad49e25ef060","id":"ev_a42e829967a6e860c041","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"feat(languages): parse F# to a full AST and move it to Good (#2133)","pr_number":2133,"provenance":"historical","sha":"9af0b5f9"},{"author":"Contributor 19","body":"tree-sitter-elixir 0.3.5 replaces the regex tier for .ex and .exs.\ndefmodule, def, defp, defmacro, defguard, defdelegate and defprotocol\nbecome symbols, defimpl becomes an impl symbol named for the module the\ncompiler generates, and @doc / @moduledoc become docstrings. Every one\nof those is a call node in this grammar, so the kind, the parent module\nand the definition-head filter are read from the call's target keyword\nin four small language-gated blocks beside the Pascal and Dart ones.\n\nImports keep the existing resolver: alias, import, require and use yield\none import per named module, including each member of alias Foo.{Bar,\nBaz}, and the resolver's reach is unchanged. Call edges resolve within a\nmodule and through receivers. A bare name in Elixir is lexically scoped,\nso the resolver refuses the global-unique tier for it and merges names\nonly from wildcard imports; alias, require and use bind a module name,\nnever a function name.\n\nNo heritage edges (use and @behaviour are not inheritance) and no health\nmar","date":"2026-09-04T15:42:58+00:00","evidence_refs":[{"commit":"01e50e2f8475888541745fcbb0d40dd016f77476","id":"ev_39e60b3a5fcdf4065a36","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"feat(languages): parse Elixir to a full AST and move it to Good (#2127)","pr_number":2127,"provenance":"historical","sha":"01e50e2f"},{"author":"Contributor 20","date":"2026-08-30T10:46:03+00:00","evidence_refs":[{"commit":"0cbe36f70f0db2dfeddf23d56960506f8872deb6","id":"ev_0c1fdfbf06526d42573a","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(dead-code): detect JSX prop-guard dead code (#1554) (#1570)","pr_number":1554,"provenance":"historical","sha":"0cbe36f7"},{"author":"Contributor 19","date":"2026-08-25T18:42:09+00:00","evidence_refs":[{"commit":"58403ddb69490d0d605ad93b3d6a94d61aadbb51","id":"ev_a162f4fe7b64b188a5a7","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(ingestion): refuse a data member on the import-merged tier (#1925)","pr_number":1925,"provenance":"historical","sha":"58403ddb"},{"author":"Contributor 19","body":"`_global_symbols` holds one entry per declaration, so a method written as\nan overload set is several rows under one symbol id. Tier 3's\nglobal-unique rung gated on `len(candidates) == 1` and read that as an\nambiguity that does not exist: C#'s `AddRetry` is two rows and one\nsymbol, and the call reached nothing.\n\nCollapsing by symbol id is not the candidate filtering this rung already\nrefuses on purpose. A name that a field and a method both declare still\nhas two distinct ids and stays refused.\n\nThe collapsed answer is tried after the implicit-receiver tier rather\nthan in place of the row count. Ahead of it, it answered sites the\ncaller's own class hierarchy already answered, moving 1,027 edges in one\nrepository off `enclosing_inherited` at 0.90 confidence onto this rung at\n0.50 for the same target. Behind it, it can only add an edge.\n\nA getter and its setter are also two declarations under one id, which\nmade an attribute look like a unique callable and bound a local\n`router(...)` parameter invocation to it. Re","date":"2026-08-25T16:53:58+00:00","evidence_refs":[{"commit":"f97ced7a4c7badf3879921b8d42c900753695ce6","id":"ev_4b18c964f408fa622c84","kind":"commit","provenance":"historical","repository":"default","source":"origin","source_kind":"origin","verification_basis":"historical"}],"message":"fix(ingestion): resolve a call to an overload set instead of refusing it (#1923)","pr_number":1923,"provenance":"historical","sha":"f97ced7a"}],"key_commits_emitted":5,"key_commits_omitted":29,"key_commits_reduced_reason":"construction_cap","key_commits_total":34,"key_commits_truncated":true,"last_commit":"2026-09-04","linked_decisions":[],"primary_author":"Contributor 19","provenance":"historical","summary":"Created ~2026-08-16, last modified 2026-09-04 (20 days old). Primary author: Contributor 19 (34 total commits). Earliest key commit: \"fix(cpp): attach a call edge to the definition, not the header declaration (#1626)\" by Contributor 19 on 2026-08-16T12:20:24+00:00. Contributors: Contributor 19, Contributor 20, Contributor 23.","total_commits":34},"path":"packages/core/src/repowise/core/ingestion/call_resolver.py","truncated":true},"list_repos:default":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"response_budget":{"limit_chars":24000,"serialized_chars":462,"tier":"default"}},"default_repo":"default","hint":"This MCP server is serving a single repo; omit repo unless a tool asks for it.","repos":[{"absolute_path":"/repo","alias":"default","is_default":true,"path":"/repo"}],"workspace":false,"workspace_root":null},"search_codebase:limit-5":{"_meta":{"completeness":{"capped":false},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","replaced_tokens":2000,"response_budget":{"limit_chars":24000,"serialized_chars":3288,"tier":"default"},"tokens_saved":1162},"candidates":[{"path":"packages/server/src/repowise/server/schemas/repository.py"},{"path":"packages/api-client/src/types/repository.ts"},{"path":"packages/core/src/repowise/core/persistence/crud/repository.py"},{"path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"}],"results":[{"confidence_score":1.0,"page_type":"file_page","relevance_score":3.958,"snippet":"# packages/server/src/repowise/server/schemas/repository.py\n\n## Overview\n\nRepository request/response models.\n\nIt exposes 9 public symbols and depends on 2 other files.\n\n## Public API\n\n| Symbol | Kind","sources":["fts","vector"],"target_path":"packages/server/src/repowise/server/schemas/repository.py","title":"File: packages/server/src/repowise/server/schemas/repository.py"},{"confidence_score":1.0,"page_type":"file_page","relevance_score":3.951,"snippet":"# packages/api-client/src/types/repository.ts\n\n## Overview\n\nTypes module repository defining RepoCreate, RepoUpdate, RepoResponse. `packages/api-client/src/types/repository.ts` is a typescript source","sources":["fts","vector"],"target_path":"packages/api-client/src/types/repository.ts","title":"File: packages/api-client/src/types/repository.ts"},{"confidence_score":0.94,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","page_type":"symbol_spotlight","relevance_score":3.727,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.upsert_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.upsert_repository"},{"confidence_score":0.67,"page_type":"file_page","relevance_score":2.647,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_meta.py\n\n## Overview\n\nIndexStore mixin: repository, generation jobs, pages, chat, webhooks.\n\nThis mixin covers the \"meta\" surface \u2014 the top-l","sources":["fts"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"confidence_score":0.66,"page_type":"file_page","relevance_score":2.601,"snippet":"# packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py\n\n## Overview\n\nIndex `wiki_symbols` on `(repository_id, file_path)`.\n\nEvery file-scoped symbol lookup joins on this pair, but the o","sources":["fts"],"target_path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","title":"File: packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"}]},"search_codebase:limit-50":{"_meta":{"completeness":{"capped":true,"reason":"response_budget","shown":19,"total":100},"contract_version":1,"embedder_degraded":false,"index_age_days":0,"indexed_commit":"920d1c973d64","omitted":{"refs":["repowise#1cb22af443b7","repowise#5fe350551fca"],"restore":"Run `repowise expand <ref>` from the repo, or call get_symbol(\"repowise#<ref>\", query=...) to retrieve the omitted content.","tokens":6176},"replaced_tokens":5600,"response_budget":{"limit_chars":24000,"serialized_chars":12869,"tier":"default"},"state":{"truncated":true},"targets":["packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py","packages/core/src/repowise/core/persistence/_interfaces/_meta.py","packages/server/src/repowise/server/schemas/repository.py","packages/api-client/src/types/repository.ts","packages/core/src/repowise/core/workspace/repo_index.py","packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/workspace/repo_index.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py","packages/core/src/repowise/core/pipeline/full_index.py","packages/core/src/repowise/core/persistence/_interfaces/_analysis.py","packages/core/src/repowise/core/persistence/models.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/stores/_sql_meta.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/crud/git.py","packages/core/src/repowise/core/persistence/crud/repository.py","packages/core/src/repowise/core/persistence/_interfaces/index_store.py"],"tokens_saved":2296},"candidates_emitted":0,"candidates_reduced_reason":"response_budget","candidates_total":50,"omission_marker":"[repowise#5fe350551fca: 273 lines omitted (~3223 tokens); restore: repowise expand 5fe350551fca]","results":[{"confidence_score":1.0,"page_type":"file_page","relevance_score":4.345,"snippet":"# packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py\n\n## Overview\n\nIndex `graph_nodes` on `(repository_id, node_type)`.\n\n`node_type == \"file\"` is the most-issued predicate on this tabl","sources":["fts","vector"],"target_path":"packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py","title":"File: packages/core/alembic/versions/0051_graph_nodes_repo_type_index.py"},{"confidence_score":0.99,"page_type":"file_page","relevance_score":4.298,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_meta.py\n\n## Overview\n\nIndexStore mixin: repository, generation jobs, pages, chat, webhooks.\n\nThis mixin covers the \"meta\" surface \u2014 the top-l","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_meta.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_meta.py"},{"confidence_score":0.92,"page_type":"file_page","relevance_score":3.983,"snippet":"# packages/server/src/repowise/server/schemas/repository.py\n\n## Overview\n\nRepository request/response models.\n\nIt exposes 9 public symbols and depends on 2 other files.\n\n## Public API\n\n| Symbol | Kind","sources":["fts","vector"],"target_path":"packages/server/src/repowise/server/schemas/repository.py","title":"File: packages/server/src/repowise/server/schemas/repository.py"},{"confidence_score":0.92,"page_type":"file_page","relevance_score":3.977,"snippet":"# packages/api-client/src/types/repository.ts\n\n## Overview\n\nTypes module repository defining RepoCreate, RepoUpdate, RepoResponse. `packages/api-client/src/types/repository.ts` is a typescript source","sources":["fts","vector"],"target_path":"packages/api-client/src/types/repository.ts","title":"File: packages/api-client/src/types/repository.ts"},{"confidence_score":0.91,"file":"packages/core/src/repowise/core/workspace/repo_index.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/workspace/repo_index.py::open_repo_index","page_type":"symbol_spotlight","relevance_score":3.951,"snippet":"# packages.core.src.repowise.core.workspace.repo_index.open_repo_index\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/workspace/repo_index.py` | **Estimated complexity:","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/workspace/repo_index.py::open_repo_index","target_path":"packages/core/src/repowise/core/workspace/repo_index.py","title":"Symbol: packages.core.src.repowise.core.workspace.repo_index.open_repo_index"},{"confidence_score":0.87,"page_type":"file_page","relevance_score":3.801,"snippet":"# packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py\n\n## Overview\n\nIndex `wiki_symbols` on `(repository_id, file_path)`.\n\nEvery file-scoped symbol lookup joins on this pair, but the o","sources":["fts","vector"],"target_path":"packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py","title":"File: packages/core/alembic/versions/0046_wiki_symbols_repo_path_index.py"},{"confidence_score":0.86,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","page_type":"symbol_spotlight","relevance_score":3.75,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.upsert_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::upsert_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.upsert_repository"},{"confidence_score":0.75,"page_type":"file_page","relevance_score":3.246,"snippet":"# packages/core/src/repowise/core/workspace/repo_index.py\n\n## Overview\n\nRead-only index access for the cross-repo hooks.\n\nThe hooks run immediately after ingestion writes each repo's\n`.repowise/wiki.d","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/workspace/repo_index.py","title":"File: packages/core/src/repowise/core/workspace/repo_index.py"},{"confidence_score":0.74,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::get_repository","page_type":"symbol_spotlight","relevance_score":3.225,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.get_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estimate","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::get_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.get_repository"},{"confidence_score":0.73,"page_type":"file_page","relevance_score":3.183,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py\n\n## Overview\n\nIndexStore mixin: relational graph rows, external systems, symbols.\n\nThe \"graph records\" surface of `IndexStor","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_graph_records.py"},{"confidence_score":0.71,"page_type":"file_page","relevance_score":3.082,"snippet":"# packages/core/src/repowise/core/pipeline/full_index.py\n\n## Overview\n\nFull index-only pipeline run + persistence for a single repo.\n\nThe \"index this repo from scratch\" step shared by `repowise worksp","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/pipeline/full_index.py","title":"File: packages/core/src/repowise/core/pipeline/full_index.py"},{"confidence_score":0.71,"page_type":"file_page","relevance_score":3.069,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/_analysis.py\n\n## Overview\n\nIndexStore mixin: git metadata, dead code, decisions, health, coverage.\n\nThe \"analysis\" surface of IndexStore \u2014 any","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/_analysis.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/_analysis.py"},{"confidence_score":0.66,"file":"packages/core/src/repowise/core/persistence/models.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/models.py::Repository","page_type":"symbol_spotlight","relevance_score":2.875,"snippet":"# Repository\n\n**Kind:** class | **Defined in:** `packages/core/src/repowise/core/persistence/models.py` | **Estimated complexity:** 1\n\n```\nclass Repository\n```\n\n## Overview\n\n`Repository` is a class de","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/models.py::Repository","target_path":"packages/core/src/repowise/core/persistence/models.py","title":"Symbol: packages/core/src/repowise/core/persistence/models.py::Repository"},{"confidence_score":0.65,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::delete_repository","page_type":"symbol_spotlight","relevance_score":2.831,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.delete_repository\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estim","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::delete_repository","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.delete_repository"},{"confidence_score":0.65,"page_type":"file_page","relevance_score":2.827,"snippet":"ore/src/repowise/core/persistence/stores/_sql_meta.py\n\n## Overview\n\nMeta-domain delegations for `SqlIndexStore`.\n\nEach method here is a one-to-one delegation to `crud`. Split out from\n`sql_index_store","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/stores/_sql_meta.py","title":"File: packages/core/src/repowise/core/persistence/stores/_sql_meta.py"},{"confidence_score":0.65,"page_type":"file_page","relevance_score":2.817,"snippet":"# packages/core/src/repowise/core/persistence/crud/repository.py\n\n## Overview\n\nCRUD operations for the repository domain (repowise persistence layer).\n\nSplit out of the former monolithic `crud.py`; `c","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"File: packages/core/src/repowise/core/persistence/crud/repository.py"},{"confidence_score":0.64,"page_type":"file_page","relevance_score":2.76,"snippet":"| --- | --- | --- |\n| `upsert_git_metadata` | function | async def upsert_git_metadata(session, *, repository_id, file_path, **kwargs) -> GitMetadata |\n| `get_git_metadata` | function | async def get","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/crud/git.py","title":"File: packages/core/src/repowise/core/persistence/crud/git.py"},{"confidence_score":0.63,"file":"packages/core/src/repowise/core/persistence/crud/repository.py","page_id":"symbol_spotlight:packages/core/src/repowise/core/persistence/crud/repository.py::list_page_ids","page_type":"symbol_spotlight","relevance_score":2.735,"snippet":"# packages.core.src.repowise.core.persistence.crud.repository.list_page_ids\n\n**Kind:** function (async) | **Defined in:** `packages/core/src/repowise/core/persistence/crud/repository.py` | **Estimated","sources":["fts","vector"],"symbol_id":"packages/core/src/repowise/core/persistence/crud/repository.py::list_page_ids","target_path":"packages/core/src/repowise/core/persistence/crud/repository.py","title":"Symbol: packages.core.src.repowise.core.persistence.crud.repository.list_page_ids"},{"confidence_score":0.62,"page_type":"file_page","relevance_score":2.673,"snippet":"# packages/core/src/repowise/core/persistence/_interfaces/index_store.py\n\n## Overview\n\nIndexStore \u2014 aggregate pluggable CRUD facade.\n\n`IndexStore` combines three domain mixins:\n\n- `MetaIndexStore` (re","sources":["fts","vector"],"target_path":"packages/core/src/repowise/core/persistence/_interfaces/index_store.py","title":"File: packages/core/src/repowise/core/persistence/_interfaces/index_store.py"}],"results_emitted":19,"results_reduced_reason":"response_budget","results_total":50,"truncated":true}}
\ No newline at end of file
diff --git a/tests/fixtures/mcp/tool_response_shapes.json b/tests/fixtures/mcp/tool_response_shapes.json
index fb939cba8..09db870fd 100644
--- a/tests/fixtures/mcp/tool_response_shapes.json
+++ b/tests/fixtures/mcp/tool_response_shapes.json
@@ -573,6 +573,7 @@
"get_health": {
"_meta": {
"contract_version": null,
+ "embedder": null,
"embedder_degraded": null,
"health_analysis": {
"analyzed_at": null,
@@ -594,52 +595,25 @@
"health_analyzed_at": null,
"health_analyzed_commit": null,
"health_analyzed_commits_distinct": null,
- "health_semantics": {
- "percentiles": {
- "direction": null,
- "freshness": null,
- "population": null,
- "public_raw_scale": null,
- "stored_scale": null
- },
- "weighted_deficit_points": {
- "denominator": null,
- "direction": null,
- "interpretation": null,
- "numerator": null,
- "scale": {
- "maximum": null,
- "minimum": null,
- "normalized": null
- },
- "unit": null
- }
- },
"index_age_days": null,
+ "index_behind": null,
+ "index_scope": {
+ "content_provenance": null,
+ "fingerprint": null,
+ "full": null,
+ "git_tier": null,
+ "projection": null,
+ "run_mode": null,
+ "status": null,
+ "version": null
+ },
"indexed_commit": null,
+ "live_head": null,
+ "semantic_search": null,
+ "stale_warning": null,
"timing_ms": null
},
- "directive": {
- "fix_first": null,
- "next_action": null,
- "plan_addresses_reason": null,
- "plan_note": null,
- "plan_via": null,
- "reason": null,
- "recovers_points": null,
- "recovers_points_compatibility": {
- "deprecated": null,
- "equivalent_value": null,
- "replacement": null
- },
- "recovers_weighted_deficit_points": null,
- "share_of_repo_gap_pct": null,
- "then": [
- null
- ],
- "then_emitted": null,
- "then_total": null
- },
+ "counts": null,
"distribution": {
"bands": {
"at_risk": {
@@ -671,6 +645,81 @@
"total_files": null,
"total_nloc": null
},
+ "fix_first": {
+ "basis": {
+ "analyzed_commit": null,
+ "health_analyzed_at": null
+ },
+ "by_improves": {
+ "defect": null,
+ "maintainability": null,
+ "performance": null
+ },
+ "detail_call": null,
+ "items": [
+ {
+ "confidence": null,
+ "effort": null,
+ "gain": null,
+ "id": null,
+ "kind": null,
+ "next_call": {
+ "arguments": {
+ "opportunity_id": null
+ },
+ "tool": null
+ },
+ "target": {
+ "file_path": null,
+ "line_end": null,
+ "line_start": null,
+ "symbol": null
+ },
+ "tier": null,
+ "title": null,
+ "why": null
+ }
+ ],
+ "items_emitted": null,
+ "items_total": null,
+ "lead": {
+ "confidence": null,
+ "effort": null,
+ "gain": null,
+ "id": null,
+ "kind": null,
+ "next_call": {
+ "arguments": {
+ "opportunity_id": null
+ },
+ "tool": null
+ },
+ "target": {
+ "file_path": null,
+ "line_end": null,
+ "line_start": null,
+ "symbol": null
+ },
+ "tier": null,
+ "title": null,
+ "why": null
+ },
+ "model_version": null,
+ "totals": {
+ "candidates": null,
+ "eligible": null,
+ "excluded": {
+ "below_min_worth": null,
+ "expected": null,
+ "generated": null,
+ "history_only": null,
+ "no_plan": null,
+ "test": null,
+ "tooling": null
+ },
+ "shown": null
+ }
+ },
"gap_analysis": {
"files_below_target": null,
"files_for_half_gap": null,
@@ -705,14 +754,13 @@
"high_leverage_files_total": null,
"kpis": {
"average_health": null,
- "average_health_code_only": null,
"average_health_unweighted": null,
"average_health_weighting": null,
"band": null,
"file_count": null,
+ "history_average": null,
"hotspot_health": null,
"maintainability_average": null,
- "non_code_files": null,
"performance_analyzed_files": null,
"performance_average": null,
"performance_coverage_pct": null,
@@ -725,45 +773,13 @@
],
"performance_unsupported_languages_emitted": null,
"performance_unsupported_languages_total": null,
+ "structure_average": null,
"worst_performer_path": null,
- "worst_performer_score": null
+ "worst_performer_score": null,
+ "worst_test_path": null,
+ "worst_test_score": null
},
"mode": null,
- "performance_directive": {
- "advisory_total": null,
- "affected_call_sites_total": null,
- "boundary_kind": null,
- "execution_context": null,
- "file_path": null,
- "investigate_total": null,
- "next_action": {
- "arguments": {
- "opportunity_id": null
- },
- "tool": null
- },
- "observations_total": null,
- "opportunities_total": null,
- "opportunity_id": null,
- "performance_model_version": null,
- "plan_ready_total": null,
- "plan_reason": null,
- "plan_state": null,
- "prerequisites": [],
- "prerequisites_emitted": null,
- "prerequisites_total": null,
- "status": null,
- "title": null,
- "why_ranked": [
- {
- "factor": null,
- "points": null,
- "value": null
- }
- ],
- "why_ranked_emitted": null,
- "why_ranked_total": null
- },
"performance_opportunities": [
{
"actionability_reason": null,
@@ -786,7 +802,9 @@
"function_name": null,
"line_end": null,
"line_start": null,
- "path": [],
+ "path": [
+ null
+ ],
"path_emitted": null,
"path_total": null,
"provenance": null,
@@ -794,6 +812,8 @@
}
],
"evidence_emitted": null,
+ "evidence_next_cursor": null,
+ "evidence_reduced_reason": null,
"evidence_total": null,
"evidence_truncated": null,
"execution_context": null,
@@ -802,7 +822,8 @@
"amplification": null,
"change_risk": null,
"exposure": null,
- "leverage": null
+ "leverage": null,
+ "loop_magnitude": null
},
"file_path": null,
"fix": {
@@ -814,11 +835,31 @@
"observations_total": null,
"opportunity_id": null,
"performance_model_version": null,
+ "plan_economics": {
+ "benefit": null,
+ "cost": null,
+ "effort_bucket": null,
+ "risk": null
+ },
"plan_id": null,
"plan_reason": null,
"plan_reference": null,
"plan_status": null,
- "prerequisites": [],
+ "plan_steps": [
+ {
+ "action": null,
+ "applicability": null,
+ "file_path": null,
+ "line": null,
+ "order": null,
+ "symbol": null
+ }
+ ],
+ "plan_steps_emitted": null,
+ "plan_steps_total": null,
+ "prerequisites": [
+ null
+ ],
"prerequisites_emitted": null,
"prerequisites_total": null,
"provenance": null,
@@ -827,6 +868,7 @@
"boundary_kind": null,
"entry_reachability": null,
"execution_context": null,
+ "loop_magnitude": null,
"multiplier_shape": null,
"provenance": null
},
@@ -836,10 +878,30 @@
"resource_fingerprints": [],
"resource_fingerprints_emitted": null,
"resource_fingerprints_total": null,
- "shared_path_suffix": [],
+ "shared_path_suffix": [
+ null
+ ],
"shared_path_suffix_emitted": null,
"shared_path_suffix_total": null,
+ "siblings": [],
+ "siblings_emitted": null,
+ "siblings_total": null,
"terminal_sink": null,
+ "validation": {
+ "basis": null,
+ "commands": [
+ null
+ ],
+ "commands_emitted": null,
+ "commands_total": null,
+ "tests": [
+ null
+ ],
+ "tests_emitted": null,
+ "tests_total": null,
+ "total": null,
+ "via": null
+ },
"why_ranked": [
{
"factor": null,
@@ -857,8 +919,8 @@
"performance_summary": {
"actionability": {
"advisory": null,
- "investigate": null,
- "plan_ready": null
+ "expected": null,
+ "investigate": null
},
"analyzed_commit": null,
"boundary": {
@@ -921,32 +983,6 @@
"total": null,
"with_plan_total": null
},
- "recommendation_lede": {
- "next_call": null,
- "performance_lead": {
- "affected_call_sites_total": null,
- "boundary_kind": null,
- "execution_context": null,
- "intervention_symbol": null,
- "opportunity_id": null,
- "rank_score": null
- },
- "performance_opportunities_total": null,
- "performance_plan_id": null,
- "performance_plan_reason": null,
- "recommendation_lead": {
- "benefit": null,
- "cost": null,
- "file_path": null,
- "id": null,
- "leverage": null,
- "rank_score": null,
- "refactoring_type": null,
- "risk": null,
- "target_symbol": null
- },
- "refactoring_plans_total": null
- },
"recovery": {
"high_leverage_files": {
"call": null,
@@ -959,33 +995,8 @@
"refactoring_opportunities": {
"call": null,
"remaining": null
- },
- "refactoring_plans": {
- "call": null,
- "remaining": null
}
},
- "refactoring_directive": {
- "addresses_primary_problem": null,
- "confidence": null,
- "effort_bucket": null,
- "fix_first": null,
- "judgment_steps": null,
- "lead_refactoring_type": null,
- "mechanical_steps": null,
- "next_action": {
- "arguments": {
- "opportunity_id": null
- },
- "tool": null
- },
- "opportunities_total": null,
- "opportunity_id": null,
- "reason": null,
- "recovers_health_points": null,
- "status": null,
- "steps": null
- },
"refactoring_opportunities": [
{
"addresses_primary_problem": null,
@@ -1022,26 +1033,25 @@
"facts": {
"affected_file_count": null,
"blast_size": null,
- "callers": null,
"confidence": null,
"cross_file": null,
- "framework_registration": null
+ "local_scope": null
},
"reasons": [
null
],
"reasons_emitted": null,
"reasons_total": null,
- "unknowns": [
- null
- ],
+ "unknowns": [],
"unknowns_emitted": null,
"unknowns_total": null
},
"confidence": null,
"effort_bucket": null,
"file_path": null,
- "finding_ids": [],
+ "finding_ids": [
+ null
+ ],
"finding_ids_emitted": null,
"finding_ids_total": null,
"impact_delta": null,
@@ -1056,7 +1066,6 @@
}
],
"steps_emitted": null,
- "steps_reduced_reason": null,
"steps_total": null,
"why_ranked": [
{
@@ -1071,59 +1080,6 @@
"refactoring_opportunities_emitted": null,
"refactoring_opportunities_reduced_reason": null,
"refactoring_opportunities_total": null,
- "refactoring_plans": [
- {
- "benefit": null,
- "blast_radius": {
- "scope": null
- },
- "confidence": null,
- "cost": null,
- "dependents": null,
- "effort_bucket": null,
- "evidence": {
- "ccn_removed": null,
- "slice_nloc": null
- },
- "file_nloc": null,
- "file_path": null,
- "file_weighted_deficit": null,
- "id": null,
- "impact_delta": null,
- "leverage": null,
- "line_end": null,
- "line_start": null,
- "plan": {
- "params": [
- null
- ],
- "params_emitted": null,
- "params_total": null,
- "returns": [],
- "returns_emitted": null,
- "returns_total": null,
- "span": {
- "end": null,
- "start": null
- },
- "suggested_name": null
- },
- "rank_score": null,
- "refactoring_type": null,
- "repository": null,
- "risk": null,
- "source_biomarker": null,
- "target_symbol": null,
- "validation_profile_id": null
- }
- ],
- "refactoring_plans_emitted": null,
- "refactoring_plans_reduced_reason": null,
- "refactoring_plans_status": {
- "reason": null,
- "state": null
- },
- "refactoring_plans_total": null,
"refactoring_summary": {
"addresses_primary_problem": {
"no": null,
@@ -1196,6 +1152,7 @@
"steps_total": null,
"view": null
},
+ "scope": null,
"secondary_rankings": {
"modules": {
"call": null,
@@ -1205,6 +1162,10 @@
"call": null,
"total": null
},
+ "test_worst_files": {
+ "call": null,
+ "total": null
+ },
"top_findings": {
"call": null,
"total": null
@@ -1217,61 +1178,14 @@
"suggestion_legend": {
"hot_path_sync_io": null,
"io_in_loop": null,
- "nested_loop_with_io": null,
- "serial_await_in_loop": null
+ "nested_loop_with_io": null
},
"unknown_include_keys": [
null
],
"unknown_include_keys_emitted": null,
"unknown_include_keys_total": null,
- "validation_profiles": [
- {
- "affected_files": [
- null
- ],
- "affected_files_emitted": null,
- "affected_files_total": null,
- "affected_symbols": [
- null
- ],
- "affected_symbols_emitted": null,
- "affected_symbols_total": null,
- "basis": null,
- "commands": [
- null
- ],
- "commands_emitted": null,
- "commands_total": null,
- "id": null,
- "targets": [
- {
- "basis": null,
- "file_path": null,
- "tests": [
- null
- ],
- "tests_emitted": null,
- "tests_total": null,
- "total": null,
- "truncated": null,
- "via": null
- }
- ],
- "targets_emitted": null,
- "targets_total": null,
- "tests": [
- null
- ],
- "tests_emitted": null,
- "tests_reduced_reason": null,
- "tests_total": null,
- "total": null,
- "via": null
- }
- ],
- "validation_profiles_emitted": null,
- "validation_profiles_total": null
+ "unscored_files": null
},
"get_overview": {
"_meta": {
@@ -1441,7 +1355,6 @@
"co_change_partners_truncated": null,
"commit_count_capped": null,
"contributor_count": null,
- "line_coverage_pct": null,
"defect_profile": {
"bug_magnet": null,
"fix_count": null,
@@ -1458,6 +1371,7 @@
"health_score": null,
"hotspot_score": null,
"is_hotspot": null,
+ "line_coverage_pct": null,
"owner_pct": null,
"primary_owner": null,
"recent_owner": null,
@@ -1746,4 +1660,4 @@
"status_changed_at": null,
"status_reason": null
}
-}
+}
\ No newline at end of file
diff --git a/tests/unit/analysis/test_actions_rules.py b/tests/unit/analysis/test_actions_rules.py
index 41d7b91de..2d224067a 100644
--- a/tests/unit/analysis/test_actions_rules.py
+++ b/tests/unit/analysis/test_actions_rules.py
@@ -18,7 +18,6 @@ from repowise.core.analysis.actions.facts import (
DriftFacts,
FileFacts,
LeadFinding,
- PerfFacts,
RecentFinding,
SecretFacts,
)
@@ -249,53 +248,50 @@ def test_engine_drops_fragile_rows_a_folder_absorbed() -> None:
# ---------------------------------------------------------------------------
-# hot_path_perf
+# fix_first
# ---------------------------------------------------------------------------
-def _perf(**kw) -> PerfFacts:
- base = dict(
- opportunity_id="op1",
- biomarker="n_plus_one",
- boundary="db",
- file_path="src/repo.py",
- symbol="src/repo.py::Repo.load",
- call_sites=1,
- files=1,
- actionability="plan_ready",
- exposure="entry_reachable",
- loop_magnitude="grows_with_data",
- effort="S",
- )
- base.update(kw)
- return PerfFacts(**base)
-
+def _fix_items():
+ """The shared Fix-first fixture's queue: one now, one next, one later."""
+ from repowise.core.analysis.health.fix_first import build_fix_first
+ from tests.unit.health import fix_first_rows as rows
+
+ return build_fix_first(
+ metrics=rows.METRICS,
+ findings=rows.FINDINGS,
+ refactoring=rows.REFACTORING,
+ performance=rows.PERFORMANCE,
+ plans=rows.PLANS,
+ limit=3,
+ ).items
+
+
+def test_fix_first_emits_now_and_next_and_leaves_later() -> None:
+ items = _fix_items()
+ assert [i.tier for i in items] == ["now", "next", "later"]
+ actions = _run(code.fix_first, _facts(fix_first=items)).actions
+ assert [(a.tier, a.title) for a in actions] == [
+ ("act_now", items[0].title),
+ ("plan", items[1].title),
+ ]
+ assert actions[0].horizons == ("week", "quarter") and actions[1].horizons == ("quarter",)
+ assert actions[1].surface == "performance"
+ assert actions[0].commands[0].mcp == f'get_health(fix_id="{items[0].id}")'
+ assert len({a.action_id for a in actions}) == 2
-def test_perf_fires_when_reachable_and_growing() -> None:
- (a,) = _run(code.hot_path_perf, _facts(perf=(_perf(),))).actions
- assert a.title == "Move the database call in `Repo.load` out of its loop"
- assert a.target_symbol == "src/repo.py::Repo.load"
- assert a.confidence == "high"
+def test_fix_first_unavailable_is_named() -> None:
+ outcome = _run(code.fix_first, _facts(unavailable={"fix_first": "Not here."}))
+ assert (outcome.status, outcome.reason) == ("unavailable", "Not here.")
-def test_perf_fires_on_three_call_sites_without_growth() -> None:
- (a,) = _run(
- code.hot_path_perf,
- _facts(perf=(_perf(loop_magnitude=None, call_sites=3, actionability="advisory"),)),
- ).actions
- assert a.title == "Batch the database calls loops make through `Repo.load`"
- assert a.confidence == "medium"
-
-def test_perf_gates() -> None:
- quiet = (
- _perf(loop_magnitude=None, call_sites=2),
- _perf(exposure="internal"),
- _perf(exposure=None),
- _perf(actionability="investigate"),
- )
- for p in quiet:
- assert _run(code.hot_path_perf, _facts(perf=(p,))).actions == (), p
+def test_fragile_file_does_not_repeat_a_file_fix_first_names() -> None:
+ fragile = _file("src/core.py", fix_commits_90d=9, commits_90d=20)
+ ctx = dict(busy_threshold=5, fix_threshold=3)
+ assert _run(code.fragile_file, _facts([fragile]), **ctx).actions
+ named = _facts([fragile], fix_first=_fix_items())
+ assert _run(code.fragile_file, named, **ctx).actions == ()
# ---------------------------------------------------------------------------
@@ -565,13 +561,6 @@ def test_week_rollup_does_not_hide_a_fragile_file_from_the_quarter() -> None:
assert "src/f0.py" in quarter
-def test_two_perf_opportunities_on_one_symbol_keep_distinct_ids() -> None:
- one = _perf(opportunity_id="op1", boundary="db")
- two = _perf(opportunity_id="op2", boundary="network")
- ids = {a.action_id for a in _run(code.hot_path_perf, _facts(perf=(one, two))).actions}
- assert len(ids) == 2
-
-
def test_fragile_id_survives_a_change_of_lead_function() -> None:
lead = LeadFinding("complex_method", "high", "a", 1, "")
before = _file("src/x.py", fix_commits_90d=9, commits_90d=20, line_coverage_pct=90.0, lead=lead)
diff --git a/tests/unit/cli/test_health_cmd_controls.py b/tests/unit/cli/test_health_cmd_controls.py
index b6aac3f05..ea70ddadb 100644
--- a/tests/unit/cli/test_health_cmd_controls.py
+++ b/tests/unit/cli/test_health_cmd_controls.py
@@ -99,3 +99,34 @@ def test_the_trend_stays_quiet_when_no_control_was_passed() -> None:
)
result = runner.invoke(cli, ["health", "--trend"])
assert "do not apply to it" not in result.output
+
+
+def test_the_report_leads_with_fix_first() -> None:
+ """Title, where, why, effort and the verify command, from the shared queue."""
+ from repowise.cli.commands.health_cmd.summary import _render_fix_first
+ from repowise.core.analysis.health.fix_first import build_fix_first
+ from tests.unit.health.fix_first_rows import (
+ FINDINGS,
+ METRICS,
+ PERFORMANCE,
+ PLANS,
+ REFACTORING,
+ )
+
+ queue = build_fix_first(
+ metrics=METRICS,
+ findings=FINDINGS,
+ refactoring=REFACTORING,
+ performance=PERFORMANCE,
+ plans=PLANS,
+ limit=3,
+ )
+ console = Console(file=io.StringIO(), width=400, force_terminal=False)
+ with patch("repowise.cli.commands.health_cmd.summary.console", console):
+ _render_fix_first(queue)
+ _render_fix_first(None)
+ out = console.file.getvalue()
+ assert out.startswith("\nFix first (3 of 3 eligible")
+ assert " 1. Extract lines 20-35 of run into sum_rows (+1 more step) " in out
+ assert "src/core.py:20" in out
+ assert "verify: pytest tests/test_core_0.py" in out
diff --git a/tests/unit/generation/test_editor_file_fetcher.py b/tests/unit/generation/test_editor_file_fetcher.py
index 120201cf2..fb07ec48a 100644
--- a/tests/unit/generation/test_editor_file_fetcher.py
+++ b/tests/unit/generation/test_editor_file_fetcher.py
@@ -607,7 +607,7 @@ async def test_code_health_trend_is_read_from_the_snapshots(session, repo, tmp_p
async def test_code_health_names_production_files_only(session, repo, tmp_path):
- """The worst file and the critical list are a worklist: tests stay out."""
+ """The worst file and Fix first are a worklist: tests stay out."""
from repowise.core.persistence.crud import save_health_findings
from repowise.core.persistence.models import HealthFileMetric
@@ -639,4 +639,5 @@ async def test_code_health_names_production_files_only(session, repo, tmp_path):
data = await EditorFileDataFetcher(session, repo.id, tmp_path).fetch()
assert data.code_health.worst_path == "src/a.py"
- assert [b["path"] for b in data.code_health.critical_biomarkers] == ["src/a.py"]
+ assert [f["where"] for f in data.code_health.fix_first] == ["src/a.py:1"]
+ assert data.code_health.fix_first[0]["title"] == "Split f into smaller functions"
diff --git a/tests/unit/health/fix_first_rows.py b/tests/unit/health/fix_first_rows.py
new file mode 100644
index 000000000..73a7e5d2f
--- /dev/null
+++ b/tests/unit/health/fix_first_rows.py
@@ -0,0 +1,129 @@
+"""One small repository as plain rows, shared by the Fix-first builder and loader tests."""
+
+from __future__ import annotations
+
+from datetime import datetime
+
+AT = datetime(2026, 9, 30, 12, 0)
+
+METRICS = [
+ {"file_path": "src/core.py", "score": 4.0, "nloc": 300, "is_test": False,
+ "commit_count_90d": 12, "dependents": 9, "analyzed_commit": "abc", "updated_at": AT},
+ {"file_path": "src/plain.py", "score": 7.0, "nloc": 80, "is_test": False,
+ "commit_count_90d": 1, "dependents": 1, "analyzed_commit": "abc", "updated_at": AT},
+ {"file_path": "src/hist.py", "score": 6.0, "nloc": 50, "is_test": False,
+ "commit_count_90d": 3, "dependents": 0, "analyzed_commit": "abc", "updated_at": AT},
+ {"file_path": "src/repo.py", "score": 8.0, "nloc": 90, "is_test": False,
+ "commit_count_90d": 2, "dependents": 2, "analyzed_commit": "abc", "updated_at": AT},
+ {"file_path": "tests/test_core.py", "score": 5.0, "nloc": 90, "is_test": True,
+ "commit_count_90d": 4, "dependents": 0, "analyzed_commit": "abc", "updated_at": AT},
+ {"file_path": "scripts/tool.py", "score": 5.0, "nloc": 90, "is_test": False,
+ "commit_count_90d": 1, "dependents": 0, "analyzed_commit": "abc", "updated_at": AT},
+]
+
+FINDINGS = [
+ # A history marker outweighs the code-shape finding on the same file.
+ {"file_path": "src/core.py", "biomarker_type": "change_entropy", "severity": "high",
+ "health_impact": 2.5, "reason": "changes are scattered", "public_id": "finding_h1",
+ "dimension": "defect"},
+ {"file_path": "src/core.py", "biomarker_type": "complex_method", "severity": "high",
+ "function_name": "run", "line_start": 10, "line_end": 60, "health_impact": 1.0,
+ "reason": "run has cyclomatic complexity 14", "public_id": "finding_c1",
+ "dimension": "defect", "details": {"ccn": 14, "nloc": 50, "max_nesting": 4}},
+ {"file_path": "src/plain.py", "biomarker_type": "nested_complexity", "severity": "medium",
+ "function_name": "walk", "line_start": 5, "line_end": 40, "health_impact": 0.6,
+ "reason": "walk nests 5 levels deep", "public_id": "finding_n1", "dimension": "defect"},
+ # Only history: context, never an item.
+ {"file_path": "src/hist.py", "biomarker_type": "co_change_scatter", "severity": "high",
+ "health_impact": 1.2, "reason": "co-changes with 20 files", "public_id": "finding_h2",
+ "dimension": "defect"},
+ {"file_path": "tests/test_core.py", "biomarker_type": "large_method", "severity": "high",
+ "function_name": "test_all", "line_start": 1, "line_end": 90, "health_impact": 0.5,
+ "reason": "test_all is 90 lines long", "public_id": "finding_t1", "dimension": "defect"},
+ {"file_path": "src/plain.py", "biomarker_type": "complex_method", "severity": "high",
+ "function_name": "gone", "health_impact": 3.0, "public_id": "finding_r1",
+ "dimension": "defect", "status": "resolved"},
+]
+
+
+def _step(plan_id: str, kind: str, symbol: str, impact: float, *, mechanical: bool) -> dict:
+ return {
+ "plan_id": plan_id, "refactoring_type": kind, "target_symbol": symbol,
+ "file_path": "src/core.py", "line_start": 10, "line_end": 60, "impact_delta": impact,
+ "applicability": {"classification": "mechanical" if mechanical else "judgment"},
+ "validation_profile_id": "validation_1",
+ }
+
+
+REFACTORING = [
+ {"opportunity_id": "refop2_core", "rank_position": 0, "rank_score": 2.0,
+ "file_path": "src/core.py", "lead_biomarker": "complex_method",
+ "lead_refactoring_type": "extract_method", "effort_bucket": "S", "confidence": "high",
+ "affected_files_total": 1, "recoverable_health": 2.0,
+ "details": {
+ "steps": [_step("refac2_big", "extract_method", "run", 1.6, mechanical=True),
+ _step("refac2_tiny", "extract_method", "run", 0.2, mechanical=True)],
+ "validation_profiles": [{
+ "id": "validation_1", "basis": "inferred", "via": "call-graph", "total": 7,
+ "tests": [f"tests/test_core_{i}.py" for i in range(7)],
+ "commands": ["pytest tests/test_core_0.py"],
+ }],
+ "dependents": 9, "lead_finding_ids": ["finding_c1"],
+ }},
+ # Under the minimum worth: counted, never read further.
+ {"opportunity_id": "refop2_small", "rank_position": 1, "rank_score": 0.3,
+ "file_path": "src/repo.py", "lead_biomarker": "large_method",
+ "lead_refactoring_type": "extract_method", "effort_bucket": "S", "confidence": "high",
+ "affected_files_total": 1, "recoverable_health": 0.3, "details": {"steps": []}},
+ {"opportunity_id": "refop2_test", "rank_position": 2, "rank_score": 1.0,
+ "file_path": "tests/test_core.py", "lead_biomarker": "large_method",
+ "lead_refactoring_type": "extract_method", "effort_bucket": "S", "confidence": "high",
+ "affected_files_total": 1, "recoverable_health": 1.0,
+ "details": {"steps": [{**_step("refac2_t", "extract_method", "test_all", 1.0,
+ mechanical=False), "file_path": "tests/test_core.py"}]}},
+]
+
+PLANS = [
+ {"public_id": "refac2_big", "refactoring_type": "extract_method",
+ "evidence": {"slice_nloc": 12, "ccn_removed": 4},
+ "plan": {"span": {"start": 20, "end": 35}, "params": ["rows", "limit"], "returns": ["total"],
+ "suggested_name": "sum_rows"}},
+ {"public_id": "refac2_tiny", "refactoring_type": "extract_method",
+ "evidence": {"slice_nloc": 2, "ccn_removed": 1}, "plan": {"span": {"start": 40, "end": 41}}},
+]
+
+
+def _perf(opp: str, sink: str, **over) -> dict:
+ row = {
+ "opportunity_id": opp, "rank_position": 0, "rank_score": 20,
+ "execution_context": "production", "boundary_kind": "db", "biomarker_type": "io_in_loop",
+ "actionability_state": "advisory", "plan_state": "available",
+ "fix_strategy": "batch_or_prefetch_io", "fix_safety": "advisory",
+ "file_path": "src/repo.py", "intervention_symbol": "src/repo.py::load_all",
+ "terminal_sink": sink, "affected_call_sites_total": 3, "affected_files_total": 2,
+ "details": {
+ "facets": {"exposure": "entry_reachable", "loop_magnitude": "grows_with_data",
+ "amplification": "per_iteration", "actionability_confidence": "medium"},
+ "plan": {"effort_bucket": "M", "steps": [
+ {"order": 1, "action": "Collect the keys before the loop", "symbol": "load_all",
+ "file_path": "src/repo.py", "line": 12, "applicability": "judgment"}]},
+ "fix_rationale": "The shared sink is proven.",
+ },
+ }
+ return {**row, **over}
+
+
+PERFORMANCE = [
+ # One loop, two sinks: one item.
+ _perf("perf2_a", "src/db.py::fetch"),
+ _perf("perf2_b", "src/db.py::save", rank_position=3),
+ _perf("perf2_expected", "x", intervention_symbol="src/repo.py::other",
+ actionability_state="expected", plan_state="no_safe_plan", fix_strategy=None,
+ rank_position=5),
+ _perf("perf2_noplan", "y", intervention_symbol="src/repo.py::third",
+ actionability_state="investigate", plan_state="no_safe_plan", fix_strategy=None,
+ rank_position=6),
+ _perf("perf2_tool", "z", file_path="scripts/tool.py",
+ intervention_symbol="scripts/tool.py::main", execution_context="tooling",
+ rank_position=7),
+]
diff --git a/tests/unit/health/test_fix_first_build.py b/tests/unit/health/test_fix_first_build.py
new file mode 100644
index 000000000..4a5fdc8d7
--- /dev/null
+++ b/tests/unit/health/test_fix_first_build.py
@@ -0,0 +1,183 @@
+"""The Fix-first builder over plain rows: eligibility, ranking and identity."""
+
+from __future__ import annotations
+
+import copy
+
+from repowise.core.analysis.health.fix_first import FIX_EXCLUSIONS, build_fix_first
+from tests.unit.health.fix_first_rows import (
+ FINDINGS,
+ METRICS,
+ PERFORMANCE,
+ PLANS,
+ REFACTORING,
+ _perf,
+)
+
+
+def _build(**over):
+ rows = {
+ "metrics": METRICS,
+ "findings": FINDINGS,
+ "refactoring": REFACTORING,
+ "performance": PERFORMANCE,
+ "plans": PLANS,
+ }
+ return build_fix_first(**{**rows, **over})
+
+
+def test_empty_repository_has_no_lead() -> None:
+ queue = build_fix_first()
+ assert queue.items == () and queue.lead is None
+ assert queue.totals.candidates == 0
+ assert queue.as_dict()["lead"] is None
+
+
+def test_each_exclusion_is_counted_by_reason() -> None:
+ queue = _build()
+ assert set(queue.totals.excluded) == set(FIX_EXCLUSIONS)
+ assert queue.totals.excluded == {
+ # The test file's plan and its own findings are two candidates.
+ "test": 2,
+ "tooling": 1,
+ "generated": 0,
+ "expected": 1,
+ "no_plan": 1,
+ "below_min_worth": 1,
+ "history_only": 1,
+ }
+ assert queue.totals.eligible == 3
+ assert queue.totals.candidates == 3 + 7
+ assert queue.by_improves == {"defect": 2, "maintainability": 0, "performance": 1}
+
+
+def test_history_never_leads_and_rides_along_as_context() -> None:
+ queue = _build()
+ assert [i.target.file_path for i in queue.items] == [
+ "src/core.py",
+ "src/repo.py",
+ "src/plain.py",
+ ]
+ core = queue.lead
+ assert core.kind == "refactor"
+ assert "change" not in core.title.lower() and "entropy" not in core.why
+ assert [c.label for c in core.context] == ["changes in 90 days", "change entropy"]
+ # The history-only file is no item at all.
+ assert all(i.target.file_path != "src/hist.py" for i in queue.items)
+
+
+def test_text_quotes_the_stored_numbers() -> None:
+ core = _build().lead
+ assert core.title == "Extract lines 20-35 of run into sum_rows (+1 more step)"
+ assert core.why == "run: CCN 14, 50 lines, nests 4 deep; 9 files import it, changed 12 times in 90 days."
+ assert core.action.steps[0].text == "Extract lines 20-35 of run into sum_rows(rows, limit) -> total"
+ assert core.action.steps[1].text == "Extract lines 40-41 of run into a helper"
+ # The model's credit is the gain, with one decimal; the builder does not re-judge it.
+ assert (core.gain.value, core.gain.text) == (2.0, "+2.0 health on this file")
+ assert core.source.plan_ids == ("refac2_big", "refac2_tiny")
+ assert len(core.verify.tests) == 5 and core.verify.tests_total == 7
+ assert core.verify.command == "pytest tests/test_core_0.py"
+
+
+def test_an_excluded_plan_leaves_the_files_findings_to_compete() -> None:
+ """Every candidate lands in exactly one bucket, whatever the other one decided."""
+ small = {**REFACTORING[1], "opportunity_id": "refop2_plain", "file_path": "src/plain.py"}
+ queue = _build(refactoring=[small], performance=[])
+ plain = [i for i in queue.items if i.target.file_path == "src/plain.py"]
+ assert [i.kind for i in plain] == ["finding"]
+ assert queue.totals.excluded["below_min_worth"] == 1
+ assert queue.totals.candidates == queue.totals.eligible + sum(queue.totals.excluded.values())
+
+
+def test_tiers_follow_value_confidence_and_readiness() -> None:
+ by_kind = {i.kind: i for i in _build().items}
+ assert by_kind["refactor"].tier == "now"
+ assert by_kind["perf_fix"].tier == "next" # advisory plan: needs judgment
+ assert by_kind["finding"].tier == "later"
+ assert all(i.why_ranked[-1].factor == "tier" for i in by_kind.values())
+
+
+def test_perf_rows_group_by_intervention() -> None:
+ perf = next(i for i in _build().items if i.kind == "perf_fix")
+ assert perf.source.opportunity_id == "perf2_a"
+ assert ("sinks this fix covers", "2") in [(f.label, f.value) for f in perf.facts]
+ assert perf.gain.text == "one database call per loop iteration, grows with the data"
+ assert perf.title == "Batch the database calls loops make through load_all"
+
+
+def test_ids_are_stable_and_independent_of_rank() -> None:
+ first = _build()
+ moved = copy.deepcopy(REFACTORING)
+ moved[0]["rank_position"] = 9
+ second = _build(refactoring=moved)
+ assert [i.id for i in first.items] == [i.id for i in second.items]
+ assert all(i.id.startswith("fix1_") and len(i.id) == 25 for i in first.items)
+ assert [i.rank for i in first.items] == [0, 1, 2]
+
+
+def test_no_kind_takes_more_than_three_of_the_first_five() -> None:
+ refactors = []
+ for n in range(5):
+ row = copy.deepcopy(REFACTORING[0])
+ row["opportunity_id"] = f"refop2_{n}"
+ row["file_path"] = f"src/core{n}.py"
+ row["details"]["steps"] = row["details"]["steps"][:1]
+ refactors.append(row)
+ # Same value as the refactors (production, loop size unknown), lower tier.
+ perf = _perf("perf2_a", "s")
+ perf["details"] = {**perf["details"], "facets": {"loop_magnitude": "unknown"}}
+ queue = _build(refactoring=refactors, performance=[perf], findings=[])
+ # The fourth place goes to the perf fix; the fifth back to a refactor,
+ # since no other kind has anything left at value 2 or above.
+ assert [i.kind for i in queue.items[:5]] == [*["refactor"] * 3, "perf_fix", "refactor"]
+
+
+def test_scope_all_keeps_tests_and_labels_them() -> None:
+ queue = _build(scope="all")
+ test_item = next(i for i in queue.items if i.target.file_path == "tests/test_core.py")
+ assert ("file kind", "test") in [(c.label, c.value) for c in test_item.context]
+ assert queue.totals.excluded["test"] == 0
+
+
+def test_limit_caps_items_not_totals() -> None:
+ queue = _build(limit=1)
+ assert len(queue.items) == 1 and queue.totals.shown == 1 and queue.totals.eligible == 3
+ assert queue.find(queue.lead.id) is queue.lead
+
+
+def test_titles_and_whys_carry_no_biomarker_ids() -> None:
+ from repowise.core.analysis.health.scoring import _BIOMARKER_CATEGORY
+
+ for item in _build().items:
+ for text in (item.title, item.why, item.gain.text):
+ assert not any(marker in text for marker in _BIOMARKER_CATEGORY), text
+ assert len(item.title) <= 90
+
+
+def test_cli_code_ships_for_code_shape_but_not_for_performance() -> None:
+ from repowise.core.analysis.health.perf.causal import code_context, execution_context
+
+ path = "packages/cli/src/app/cli/commands/update.py"
+ assert (code_context(path), execution_context(path)) == ("production", "tooling")
+ assert code_context("scripts/run.py") == execution_context("scripts/run.py") == "tooling"
+ cli = {**METRICS[0], "file_path": path}
+ finding = {**FINDINGS[1], "file_path": path}
+ queue = _build(metrics=[cli], findings=[finding], refactoring=[], performance=[])
+ assert [i.target.file_path for i in queue.items] == [path]
+
+
+def test_value_leads_tier_and_a_huge_function_says_so() -> None:
+ """A function far past every bar outranks tidy work that is safer to start."""
+ huge = {**FINDINGS[1], "file_path": "src/plain.py", "function_name": "walk",
+ "public_id": "finding_huge", "details": {"ccn": 249, "nloc": 1280, "max_nesting": 5}}
+ queue = _build(findings=[*FINDINGS, huge])
+ lead = queue.lead
+ assert (lead.kind, lead.tier, lead.target.file_path) == ("finding", "next", "src/plain.py")
+ assert lead.title == "Break up walk (CCN 249, 1,280 lines)"
+ assert ("problem size", "4") in [(f.factor, f.value) for f in lead.why_ranked]
+ # With a plan, the title names the problem and the first concrete step.
+ big = {**FINDINGS[1], "details": {"ccn": 120, "nloc": 900, "max_nesting": 6}}
+ planned = _build(findings=[big]).lead
+ assert planned.title == (
+ "Start breaking up run (CCN 120, 900 lines): first lift lines 20-35 into sum_rows"
+ )
diff --git a/tests/unit/persistence/test_actions_build.py b/tests/unit/persistence/test_actions_build.py
index 7d96e4c37..6f15602d5 100644
--- a/tests/unit/persistence/test_actions_build.py
+++ b/tests/unit/persistence/test_actions_build.py
@@ -69,14 +69,17 @@ COMMIT_HEALTH = [
PERFORMANCE = [
{"opportunity_id": "perf1", "execution_context": "production",
- "actionability_state": "plan_ready", "boundary_kind": "db", "biomarker_type": "n_plus_one",
+ "actionability_state": "plan_ready", "plan_state": "available",
+ "fix_strategy": "batch_or_prefetch_io", "boundary_kind": "db",
+ "biomarker_type": "n_plus_one", "rank_position": 0,
"file_path": "src/repo.py", "intervention_symbol": "src/repo.py::Repo.load",
"affected_call_sites_total": 4, "affected_files_total": 2,
- "details": {"facets": {"exposure": "entry_reachable", "loop_magnitude": "grows_with_data"},
+ "details": {"facets": {"exposure": "entry_reachable", "loop_magnitude": "grows_with_data",
+ "actionability_confidence": "medium"},
"plan": {"effort_bucket": "S"}}},
{"opportunity_id": "perf2", "execution_context": "production",
"actionability_state": "plan_ready", "boundary_kind": "db", "biomarker_type": "",
- "file_path": "src/other.py",
+ "file_path": "src/other.py", "rank_position": 0,
"affected_call_sites_total": 9,
"details_json": json.dumps({"facets": {"exposure": "internal"}})},
]
@@ -107,7 +110,13 @@ def _rows(dead_ids: list[str], **overrides):
"health_findings": HEALTH_FINDINGS,
"authors": COMMITS,
"commit_health": COMMIT_HEALTH,
- "performance": PERFORMANCE,
+ "fix_first": {
+ "metrics": FILES,
+ "findings": HEALTH_FINDINGS,
+ "refactoring": [],
+ "performance": PERFORMANCE,
+ "plans": [],
+ },
"security": SECURITY,
"doc_drift": DOC_DRIFT,
"known_paths": ["src/old.py"],
@@ -151,11 +160,14 @@ async def test_builder_on_rows_matches_the_sql_loader(async_session) -> None:
{"file_path": "src/core.py", "biomarker_type": "long_method", "severity": "critical",
"function_name": "gone", "health_impact": 9.0, "status": "resolved"},
]
- rows["performance"] = [
- *PERFORMANCE,
- {**PERFORMANCE[0], "opportunity_id": "perf3", "execution_context": "test"},
- {**PERFORMANCE[0], "opportunity_id": "perf4", "status": "resolved"},
- ]
+ rows["fix_first"] = {
+ **rows["fix_first"],
+ "findings": rows["health_findings"],
+ "performance": [
+ *PERFORMANCE,
+ {**PERFORMANCE[0], "opportunity_id": "perf4", "status": "resolved"},
+ ],
+ }
rows["security"] = [*SECURITY, {**SECURITY[0], "commit_sha": "abc"},
{**SECURITY[0], "severity": "medium"}]
rows["dead_code"] = [
@@ -174,13 +186,14 @@ async def test_builder_on_rows_matches_the_sql_loader(async_session) -> None:
assert built.files["src/core.py"].lead.biomarker == "complex_method"
assert [f.file_path for f in built.recent_findings] == ["src/new.py"]
assert [s.file_path for s in built.secrets] == ["src/settings.py"]
+ assert [i.target.file_path for i in built.fix_first] == ["src/repo.py", "src/core.py", "src/new.py"]
assert (built.fix_commits_90d, built.active_authors_90d, len(built.dead)) == (4, 3, 3)
def test_a_store_passed_as_none_is_unavailable() -> None:
- facts = build_repo_facts(**_rows([], performance=None, security=None))
- assert facts.unavailable == {"performance": ABSENT, "security": ABSENT}
- assert facts.perf == () and facts.secrets == ()
+ facts = build_repo_facts(**_rows([], fix_first=None, security=None))
+ assert facts.unavailable == {"fix_first": ABSENT, "security": ABSENT}
+ assert facts.fix_first == () and facts.secrets == ()
assert facts.drift
diff --git a/tests/unit/persistence/test_actions_loader.py b/tests/unit/persistence/test_actions_loader.py
index ac3e99959..7d5b11883 100644
--- a/tests/unit/persistence/test_actions_loader.py
+++ b/tests/unit/persistence/test_actions_loader.py
@@ -108,11 +108,13 @@ async def _seed(session) -> str:
PerformanceOpportunity(
repository_id=rid, opportunity_id="perf1", status="open",
execution_context="production", actionability_state="plan_ready",
+ plan_state="available", fix_strategy="batch_or_prefetch_io",
boundary_kind="db", biomarker_type="n_plus_one", file_path="src/repo.py",
intervention_symbol="src/repo.py::Repo.load", affected_call_sites_total=4,
affected_files_total=2,
details_json=json.dumps(
- {"facets": {"exposure": "entry_reachable", "loop_magnitude": "grows_with_data"},
+ {"facets": {"exposure": "entry_reachable", "loop_magnitude": "grows_with_data",
+ "actionability_confidence": "medium"},
"plan": {"effort_bucket": "S"}}
),
),
@@ -177,15 +179,14 @@ async def test_load_actions_view_composes_every_store(async_session) -> None:
assert view["context"]["fix_commits_90d"] == 4
rules = _by_rule(view)
- (fragile,) = rules["fragile_file"]
- assert fragile["target"]["path"] == "src/core.py"
- assert fragile["title"].startswith("Add tests around `src/core.py`")
- # The code-shape finding leads, not the higher-impact history marker.
- assert fragile["marker"] == "complex_method"
-
- (perf,) = rules["hot_path_perf"]
- assert perf["title"] == "Batch the database calls loops make through `Repo.load`"
- assert perf["effort"] == "S"
+ # Fix first names the busy bug magnet by its code-shape finding, not the
+ # higher-impact history marker, and the plan-ready loop; the fragile-file
+ # rule does not repeat the file it already names.
+ fixes = {a["target"]["path"]: a for a in rules["fix_first"]}
+ assert fixes["src/core.py"]["title"] == "Reduce the branching in run"
+ assert fixes["src/repo.py"]["title"] == "Batch the database calls loops make through Repo.load"
+ assert fixes["src/repo.py"]["effort"] == "S"
+ assert "fragile_file" not in rules
(secret,) = rules["live_secret"]
assert secret["target"]["path"] == "src/settings.py"
@@ -206,12 +207,12 @@ async def test_a_missing_store_is_reported_and_the_rest_still_load(async_session
await async_session.commit()
view = await load_actions_view(async_session, rid, now=NOW)
- assert set(view["unavailable"]) == {"performance"}
+ assert set(view["unavailable"]) == {"fix_first"}
status = {r["rule"]: r["status"] for r in view["rules"]}
- assert status["hot_path_perf"] == "unavailable"
+ assert status["fix_first"] == "unavailable"
assert status["live_secret"] == "evaluated"
rules = _by_rule(view)
- assert "hot_path_perf" not in rules
+ assert "fix_first" not in rules
assert {"fragile_file", "live_secret", "broken_doc_refs"} <= set(rules)
diff --git a/tests/unit/persistence/test_fix_first_loader.py b/tests/unit/persistence/test_fix_first_loader.py
new file mode 100644
index 000000000..d5fba798f
--- /dev/null
+++ b/tests/unit/persistence/test_fix_first_loader.py
@@ -0,0 +1,102 @@
+"""The Fix-first loader agrees with the pure builder over the same rows."""
+
+from __future__ import annotations
+
+import json
+
+from repowise.core.analysis.health.fix_first import build_fix_first
+from repowise.core.persistence.crud.analysis.fix_first import load_fix_first
+from repowise.core.persistence.models import (
+ GitMetadata,
+ GraphMetric,
+ HealthFileMetric,
+ HealthFinding,
+ PerformanceOpportunity,
+ RefactoringOpportunity,
+ RefactoringSuggestion,
+)
+from tests.unit.health.fix_first_rows import FINDINGS, METRICS, PERFORMANCE, PLANS, REFACTORING
+from tests.unit.persistence.helpers import insert_repo
+
+
+def _with_json(row: dict, name: str) -> dict:
+ out = {k: v for k, v in row.items() if k != name}
+ out[f"{name}_json"] = json.dumps(row.get(name) or {})
+ return out
+
+
+async def seed_fix_first(session, rid: str | None = None) -> str:
+ rid = rid or (await insert_repo(session)).id
+ for m in METRICS:
+ session.add(
+ HealthFileMetric(
+ repository_id=rid,
+ **{k: m[k] for k in ("file_path", "score", "nloc", "is_test",
+ "analyzed_commit", "updated_at")},
+ )
+ )
+ session.add(GitMetadata(repository_id=rid, file_path=m["file_path"],
+ commit_count_90d=m["commit_count_90d"]))
+ session.add(GraphMetric(repository_id=rid, node_id=m["file_path"],
+ in_degree=m["dependents"]))
+ session.add_all(HealthFinding(repository_id=rid, **_with_json(f, "details")) for f in FINDINGS)
+ session.add_all(
+ RefactoringOpportunity(repository_id=rid, **_with_json(r, "details")) for r in REFACTORING
+ )
+ session.add_all(
+ PerformanceOpportunity(repository_id=rid, **_with_json(p, "details")) for p in PERFORMANCE
+ )
+ for p in PLANS:
+ session.add(
+ RefactoringSuggestion(
+ repository_id=rid,
+ file_path="src/core.py",
+ public_id=p["public_id"],
+ refactoring_type=p["refactoring_type"],
+ evidence_json=json.dumps(p["evidence"]),
+ plan_json=json.dumps(p["plan"]),
+ )
+ )
+ await session.flush()
+ return rid
+
+
+async def test_loader_matches_the_builder_over_rows(async_session) -> None:
+ rid = await seed_fix_first(async_session)
+ loaded = await load_fix_first(async_session, rid)
+ built = build_fix_first(
+ metrics=METRICS,
+ findings=FINDINGS,
+ refactoring=REFACTORING,
+ performance=PERFORMANCE,
+ plans=PLANS,
+ )
+ assert loaded == built
+ # The seed exercises every kind, so equality is not over an empty queue.
+ assert {i.kind for i in loaded.items} == {"refactor", "perf_fix", "finding"}
+ assert loaded.basis["analyzed_commit"] == "abc"
+
+
+async def test_loader_on_an_empty_repository(async_session) -> None:
+ rid = (await insert_repo(async_session)).id
+ queue = await load_fix_first(async_session, rid)
+ assert queue.items == () and queue.totals.candidates == 0
+
+
+async def test_the_queue_is_cached_until_a_store_changes(async_session) -> None:
+ from sqlalchemy import select
+
+ rid = await seed_fix_first(async_session)
+ first = await load_fix_first(async_session, rid)
+ assert await load_fix_first(async_session, rid) is first
+ # Triage moves a finding's updated_at, so the next read rebuilds.
+ row = (
+ await async_session.execute(
+ select(HealthFinding).where(HealthFinding.public_id == "finding_n1")
+ )
+ ).scalar_one()
+ row.status = "acknowledged"
+ await async_session.flush()
+ rebuilt = await load_fix_first(async_session, rid)
+ assert rebuilt is not first
+ assert all(i.target.file_path != "src/plain.py" for i in rebuilt.items)
diff --git a/tests/unit/server/mcp/test_health.py b/tests/unit/server/mcp/test_health.py
index c53745374..ed1627a30 100644
--- a/tests/unit/server/mcp/test_health.py
+++ b/tests/unit/server/mcp/test_health.py
@@ -21,21 +21,16 @@ async def test_get_health_dashboard(setup_mcp, health_data):
assert result["mode"] == "dashboard"
assert result["kpis"]["file_count"] == 2
assert result["kpis"]["worst_performer_path"] == "src/auth/service.py"
- # Three leads, all first: the defect one, and one per pillar that carries
- # no defect impact and so never competed for it.
- assert list(result)[:4] == [
- "directive",
- "refactoring_directive",
- "performance_directive",
- "mode",
- ]
+ # One lead, first: the Fix-first queue. No rival directive rides beside it.
+ assert list(result)[:2] == ["fix_first", "mode"]
+ assert not {"directive", "refactoring_directive", "performance_directive"} & set(result)
+ assert "health_semantics" not in result["_meta"]
assert "high_leverage_files" in result
assert "worst_files" not in result
assert result["secondary_rankings"]["worst_files"]["total"] == 2
# Three, not four: the impact ranking carries defect and maintainability
# work. The performance finding scores zero impact by construction, and a
- # row that cannot rank is not a rank. It leads the response instead, in
- # `performance_directive`.
+ # row that cannot rank is not a rank. Its fix ranks in `fix_first`.
assert result["secondary_rankings"]["top_findings"]["total"] == 3
assert "omitted" not in result["_meta"]
@@ -208,7 +203,7 @@ async def test_get_health_refactoring_capped_and_leverage_ranked(setup_mcp, heal
async def _seed_plans(session, rid, plans):
- """Store refactoring suggestions for the directive / ranking tests."""
+ """Store refactoring suggestions for the plan ranking tests."""
from repowise.core.persistence import crud
await crud.save_refactoring_suggestions(
@@ -244,7 +239,9 @@ async def test_entity_recovery_retains_health_semantics_and_freshness(
finding = (await get_health(only=["top_findings"], limit=1))["top_findings"][0]
finding_detail = await get_health(finding_id=finding["id"])
assert finding_detail["finding"] == finding
- assert finding_detail["_meta"]["health_semantics"]
+ assert "health_semantics" not in finding_detail["_meta"]
+ asked = await get_health(finding_id=finding["id"], include=["semantics"])
+ assert asked["_meta"]["health_semantics"]
assert finding_detail["_meta"]["health_analysis"]["recomputed_this_call"] is False
await _seed_plans(
@@ -269,7 +266,6 @@ async def test_entity_recovery_retains_health_semantics_and_freshness(
plan_detail = await get_health(plan_id=plan["id"])
assert plan_detail["plan"]["id"] == plan["id"]
assert plan_detail["plan"]["file_path"] == plan["file_path"]
- assert plan_detail["_meta"]["health_semantics"]
assert plan_detail["_meta"]["health_analysis"]["recomputed_this_call"] is False
@@ -340,175 +336,6 @@ async def test_freshness_is_a_repository_fact_in_every_mode(setup_mcp, health_da
)
-async def test_directive_admits_when_the_file_has_no_plans_at_all(setup_mcp, health_data):
- """``plan_via`` promised a fix for ``reason``; with no plans it cannot deliver one."""
- from repowise.server.mcp_server import get_health
-
- result = await get_health(only=["directive"])
- directive = result["directive"]
- # The seeded worst file leads with complex_method and carries no plans.
- assert directive["fix_first"] == "src/auth/service.py"
- assert directive["plan_addresses_reason"] is False
- assert "has no plans" in directive["plan_note"]
- assert directive["next_action"] == "investigate complex_method"
-
-
-async def test_directive_admits_when_plans_target_a_different_biomarker(
- setup_mcp, health_data, session
-):
- """The failure this ships for: plans exist, for a cause other than the one named."""
- from repowise.server.mcp_server import get_health
-
- await _seed_plans(
- session,
- health_data,
- [
- {
- "file_path": "src/auth/service.py",
- "source_biomarker": "dry_violation",
- "impact_delta": 1.0,
- }
- ],
- )
-
- directive = (await get_health(only=["directive"]))["directive"]
- assert directive["plan_addresses_reason"] is False
- # Names the gap on both sides: the unaddressed cause and what is on offer.
- assert "complex_method" in directive["plan_note"]
- assert "dry_violation" in directive["plan_note"]
-
-
-async def test_directive_confirms_when_a_plan_addresses_the_reason(setup_mcp, health_data, session):
- """The true branch has to be reachable, or the flag is decoration."""
- from repowise.server.mcp_server import get_health
-
- await _seed_plans(
- session,
- health_data,
- [
- {
- "file_path": "src/auth/service.py",
- "source_biomarker": "complex_method",
- "impact_delta": 1.0,
- }
- ],
- )
-
- directive = (await get_health(only=["directive"]))["directive"]
- assert directive["plan_addresses_reason"] is True
- assert "plan_note" not in directive
- assert directive["next_action"] == "inspect matching plan via plan_via"
-
-
-async def test_combined_recommendation_lede_is_compact_and_self_directing(
- setup_mcp, health_data, session
-):
- from repowise.server.mcp_server import get_health
-
- await _seed_plans(
- session,
- health_data,
- [
- {
- "file_path": "src/auth/service.py",
- "source_biomarker": "complex_method",
- "impact_delta": 1.0,
- }
- ],
- )
- # The queue is materialized, so the fixture's findings only reach the lede
- # once the writer both index paths use has grouped them.
- from repowise.core.persistence.crud import finalize_performance_opportunities
-
- await finalize_performance_opportunities(session, health_data)
- await session.commit()
-
- result = await get_health(include=["performance", "refactoring"], only=["recommendation_lede"])
- lede = result["recommendation_lede"]
- assert set(result) <= {"mode", "recommendation_lede", "_meta"}
- assert lede["performance_opportunities_total"] == 1
- # Two: the seeded extract-class plan, and the authoritative performance
- # plan the finalizer generated for the fixture's own opportunity.
- assert lede["refactoring_plans_total"] == 2
- assert lede["performance_lead"]["boundary_kind"] == "db"
- assert {"benefit", "leverage", "cost", "risk"} <= set(lede["recommendation_lead"])
- assert "validation" not in lede["recommendation_lead"]
- assert "only=['performance_opportunities','refactoring_plans']" in lede["next_call"]
-
-
-async def test_directive_does_not_claim_a_file_is_planless_over_an_unattributed_plan(
- setup_mcp, health_data, session
-):
- """``split_file`` and ``break_cycle`` store an empty ``source_biomarker``.
-
- Keying "has plans" off the biomarker set would tell the caller this file has
- no plans while the highest-leverage plan kind sits on it — a false statement
- in the one field that exists to stop the tool over-promising.
- """
- from repowise.server.mcp_server import get_health
-
- await _seed_plans(
- session,
- health_data,
- [
- {
- "file_path": "src/auth/service.py",
- "refactoring_type": "split_file",
- "source_biomarker": "",
- "impact_delta": 2.0,
- }
- ],
- )
-
- directive = (await get_health(only=["directive"]))["directive"]
- assert directive["plan_addresses_reason"] is False
- assert "has no plans" not in directive["plan_note"]
- assert "record no source biomarker" in directive["plan_note"]
-
-
-async def test_directive_stays_silent_when_the_file_has_no_named_cause(
- setup_mcp, health_data, session
-):
- """No lead biomarker means nothing to report a plan gap *about*.
-
- ``reason`` already degrades to the bare score here, so a note would read
- "No stored plan addresses None".
- """
- from repowise.core.persistence.crud import save_health_metrics
- from repowise.server.mcp_server import get_health
-
- # Big and low-scoring, so it outranks the seeded worst file on leverage —
- # but with no findings at all, so it has no lead.
- await save_health_metrics(
- session,
- health_data,
- [
- {
- "file_path": "src/legacy/blob.py",
- "score": 2.0,
- "max_ccn": 1,
- "max_nesting": 1,
- "nloc": 5000,
- "has_test_file": False,
- "module": "legacy",
- }
- ],
- )
- await session.commit()
-
- directive = (await get_health(only=["directive"]))["directive"]
- assert directive["fix_first"] == "src/legacy/blob.py"
- assert directive["plan_addresses_reason"] is False
- assert "plan_note" not in directive
- assert "None" not in directive["reason"]
-
-
@pytest.mark.asyncio
async def test_get_health_targeted(setup_mcp, health_data):
from repowise.server.mcp_server import get_health
@@ -565,7 +392,7 @@ async def test_unmatched_module_does_not_serve_repo_wide_refactoring(
``file_paths`` reaches the queue as a tuple, and an empty tuple is falsy, so
it was read as "no scope" and answered with the repository's worst files.
The neighbouring queues do not have that hole: plans and coverage are gated
- on ``nothing_resolved``, the dashboard directive on ``not scoped``, and the
+ on ``nothing_resolved``, the dashboard's fix_first on ``not scoped``, and the
performance queue passes its tuple through to an ``IN ()`` that matches
nothing.
@@ -662,30 +489,41 @@ async def test_get_health_suggestion_text_emitted_once_as_legend(setup_mcp, heal
@pytest.mark.asyncio
-async def test_get_health_dashboard_leads_with_a_directive(setup_mcp, health_data):
- """The dashboard recommends, not just ranks — the D2 gap."""
+async def test_get_health_dashboard_leads_with_fix_first(setup_mcp, health_data):
+ """The dashboard recommends, not just ranks: one queue, one lead."""
from repowise.server.mcp_server import get_health
- d = (await get_health())["directive"]
- # Ranked by weighted_deficit, so the big low-scoring file leads.
- assert d["fix_first"] == "src/auth/service.py"
- assert d["reason"] == "authenticate has cyclomatic complexity 15"
- assert d["recovers_points"] == 700 # (8.0 - 4.5) * 200
- assert d["recovers_weighted_deficit_points"] == d["recovers_points"]
- assert d["recovers_points_compatibility"] == {
- "deprecated": True,
- "replacement": "recovers_weighted_deficit_points",
- "equivalent_value": True,
+ block = (await get_health())["fix_first"]
+ lead = block["lead"]
+ assert lead == block["items"][0]
+ # The file's strongest code-shape finding, said in plain words.
+ assert lead["kind"] == "finding"
+ assert lead["target"]["file_path"] == "src/auth/service.py"
+ assert lead["title"] == "Reduce the branching in authenticate"
+ assert set(lead) == {
+ "id", "tier", "kind", "title", "target", "why", "gain", "effort", "confidence",
+ "next_call",
}
- # The only below-target file holds the whole gross deficit (700/700), so
- # the share is 100% by construction — the net gap (675) is not the
- # denominator, since healthy files would cushion it (issue #1437).
- assert d["share_of_repo_gap_pct"] == pytest.approx(100.0)
- assert d["then"] == [] # only one below-target file in the fixture
+ assert block["detail_call"] == f"get_health(fix_id={lead['id']!r})"
+
+ full = await get_health(fix_id=lead["id"])
+ assert full["mode"] == "fix_item" and full["found"] is True
+ assert full["item"]["id"] == lead["id"] and full["item"]["action"]["steps"]
+ missing = await get_health(fix_id="fix1_00000000000000000000")
+ assert missing["found"] is False and missing["item"] is None
@pytest.mark.asyncio
-async def test_directive_share_bounded_when_gross_exceeds_net_gap(session, setup_mcp):
+async def test_fix_id_is_one_selector_among_the_others(setup_mcp, health_data):
+ from repowise.server.mcp_server import get_health
+
+ result = await get_health(fix_id="fix1_x", finding_id="finding_x")
+ assert result["mode"] == "conflict"
+ assert result["selectors"] == ["finding_id", "fix_id"]
+
+
+async def test_gap_share_bounded_when_gross_exceeds_net_gap(session, setup_mcp):
"""Regression guard for #1437: the share uses the gross deficit of all
below-target files as its denominator, so it is bounded by 100% and sums to
100% by construction — the net gap (which healthy files cushion) would let
@@ -731,50 +569,15 @@ async def test_directive_share_bounded_when_gross_exceeds_net_gap(session, setup
)
result = await get_health()
- d = result["directive"]
+ row = result["high_leverage_files"][0]
# Net gap = 8.0*800 - (3.0*400 + 8.5*400) = 6400 - 4600 = 1800, and the
# single below-target file owns the whole gross deficit: 2000/2000 = 100%.
- assert d["recovers_points"] == 2000
- assert d["share_of_repo_gap_pct"] == pytest.approx(100.0)
+ assert row["share_of_repo_gap_pct"] == pytest.approx(100.0)
# The gross gap is the reported denominator.
assert result["gap_analysis"]["weighted_gross_gap_points"] == 2000
assert result["gap_analysis"]["weighted_gap_points"] == 1800
-async def test_directive_absent_when_no_file_below_target(session, setup_mcp):
- """When no file is below the Healthy floor there is no gross gap, nothing to
- recommend, and no share to report — the directive is absent entirely."""
- from repowise.core.persistence.crud import save_health_metrics
- from repowise.server.mcp_server import get_health
-
- rid = setup_mcp
- await save_health_metrics(
- session,
- rid,
- [
- {
- "file_path": "src/ok/module.py",
- "score": 8.5,
- "max_ccn": 3,
- "max_nesting": 1,
- "nloc": 100,
- "has_test_file": True,
- "module": "ok",
- "defect_score": 8.5,
- "maintainability_score": 9.0,
- "performance_score": 10.0,
- }
- ],
- )
-
- result = await get_health()
- # No file is below the Healthy floor, so there is nothing to recommend and
- # no gross gap to share — the directive is absent entirely.
- assert result["directive"] is None
- assert result["gap_analysis"]["weighted_gross_gap_points"] == 0
-
-
@pytest.mark.asyncio
async def test_high_leverage_rows_sum_to_100_with_negative_net_gap(session, setup_mcp):
"""The microdot scenario from #1437: several files below target against a
@@ -863,10 +666,6 @@ async def test_high_leverage_rows_sum_to_100_with_negative_net_gap(session, setu
)
assert len({v for v in shares.values()}) == 3 # distinct, not collapsed
assert sum(shares.values()) == pytest.approx(100.0, abs=0.1)
- # The directive quotes the same lead-file share.
- assert result["directive"]["share_of_repo_gap_pct"] == pytest.approx(
- shares["src/a/big.py"], abs=0.1
- )
@pytest.mark.asyncio
@@ -877,11 +676,11 @@ async def test_get_health_only_projects_the_response(setup_mcp, health_data):
full = await get_health()
assert len(full) > 4
- slim = await get_health(only=["directive"])
+ slim = await get_health(only=["fix_first"])
# mode and _meta always survive — a response you cannot orient in is not
# a saving.
- assert set(slim) == {"directive", "mode", "_meta"}
- assert slim["directive"] == full["directive"]
+ assert set(slim) == {"fix_first", "mode", "_meta"}
+ assert slim["fix_first"] == full["fix_first"]
@pytest.mark.asyncio
@@ -889,11 +688,11 @@ async def test_get_health_only_names_unknown_keys(setup_mcp, health_data):
"""A misspelled projection is named, not silently answered with nothing."""
from repowise.server.mcp_server import get_health
- result = await get_health(only=["directive", "kpiz"])
+ result = await get_health(only=["fix_first", "kpiz"])
assert result["unknown_only_keys"] == ["kpiz"]
assert result["unknown_only_keys_total"] == 1
assert result["unknown_only_keys_emitted"] == 1
- assert "directive" in result
+ assert "fix_first" in result
@pytest.mark.asyncio
@@ -1336,27 +1135,18 @@ async def test_limit_zero_means_no_rows_not_one_row(setup_mcp, health_data):
@pytest.mark.asyncio
-async def test_the_directive_is_identical_at_every_limit(setup_mcp, health_data):
- """``limit`` caps ranked lists. The directive is not one, so it must not move.
-
- Regression, and it was introduced by making ``limit=0`` reachable: the
- per-file lead reduction was scoped to ``metric_rows[:limit] |
- by_leverage[:limit]``, so at ``limit=0`` the directive's own candidates had
- no lead. ``fix_first`` survived (it reads ``by_leverage[0]``, not the
- leads), which is exactly why asserting ``fix_first`` alone was not enough —
- ``reason`` fell back to "scores N", ``plan_note`` vanished, and
- ``plan_addresses_reason`` became an unconditional ``False``: a wrong claim
- rather than a missing one.
- """
+async def test_the_fix_first_lead_is_identical_at_every_limit(setup_mcp, health_data):
+ """``limit`` caps how many items show, never which one leads."""
from repowise.server.mcp_server import get_health
- baseline = (await get_health())["directive"]
- assert baseline["reason"]
- for limit in (0, 1, 2, 50):
- directive = (await get_health(limit=limit))["directive"]
- assert directive == baseline, f"directive moved at limit={limit}"
- # And through the projection that makes it the cheapest call.
- assert (await get_health(only=["directive"], limit=0))["directive"] == baseline
+ baseline = (await get_health())["fix_first"]["lead"]
+ assert baseline
+ for limit in (1, 2, 50):
+ assert (await get_health(limit=limit))["fix_first"]["lead"] == baseline
+ assert (await get_health(only=["fix_first"], limit=1))["fix_first"]["lead"] == baseline
+ # ``limit=0`` means no rows, as everywhere else; the totals still count.
+ empty = (await get_health(limit=0))["fix_first"]
+ assert empty["items"] == [] and empty["totals"]["eligible"] >= 1
# ---------------------------------------------------------------------------
@@ -1728,7 +1518,7 @@ async def test_refactoring_plans_spread_across_files(setup_mcp, health_data, ses
# Both files are represented rather than the worst file owning the list.
assert len({p["file_path"] for p in plans}) == 2
# The worst file still leads — spreading reorders within the cap, it does
- # not demote the file the directive names.
+ # not demote the worst file.
assert plans[0]["file_path"] == "src/auth/service.py"
# Within a file, the higher-impact plan still comes first.
worst = [p["target_symbol"] for p in plans if p["file_path"] == "src/auth/service.py"]
@@ -1764,21 +1554,6 @@ async def test_refactoring_spread_is_exhaustive_when_one_file_has_them_all(
assert {p["file_path"] for p in plans} == {"src/auth/service.py"}
-async def test_directive_plan_via_is_projected(setup_mcp, health_data):
- """``plan_via`` must name a call that can actually complete.
-
- The bare ``include=['refactoring']`` measured 70,776 chars on this repo and
- fails the MCP token cap: five ranked lists at the default limit compose, and
- ``include`` adds a block without subtracting the dashboard. The directive
- told an agent to make the one call it could not finish.
- """
- from repowise.server.mcp_server import get_health
-
- directive = (await get_health(only=["directive"]))["directive"]
- assert "only=['refactoring_plans']" in directive["plan_via"]
-
-
@pytest.mark.asyncio
async def test_only_projection_keeps_unresolved(setup_mcp, health_data):
"""A typo'd target stays named however the response is projected.
@@ -1844,15 +1619,6 @@ async def test_high_leverage_rows_carry_share_of_repo_gap(setup_mcp, health_data
# Shares are bounded by 100% and sum to 100% by construction: the gross
# deficit of all below-target files is the denominator (issue #1437).
assert row["share_of_repo_gap_pct"] == pytest.approx(expected, abs=0.11)
- # The lead file's share is the same number the directive quotes. Not exact
- # equality: `_directive` rounds `recovers_points` to an integer before
- # dividing, the row divides the raw deficit, so the two agree to the
- # rounding and not below it. (Flagged in review as a fixture coincidence —
- # the fixture's deficit happens to be whole, which would have hidden a real
- # divergence.)
- assert rows[0]["share_of_repo_gap_pct"] == pytest.approx(
- result["directive"]["share_of_repo_gap_pct"], abs=0.1
- )
@pytest.fixture
@@ -2208,25 +1974,14 @@ async def test_a_narrowed_target_is_not_reported_as_config_excluded(
@pytest.mark.asyncio
-async def test_the_directive_names_a_cause_an_edit_can_remove(setup_mcp, health_data):
- """``fix_first`` is an instruction, so its ``reason`` has to be actionable.
-
- History markers carry the largest caps, so the highest-leverage file is
- often led by one. Naming it there tells the caller to fix something no edit
- resolves; it belongs in ``watch``.
- """
- from repowise.core.analysis.health.models import split_by_origin
+async def test_the_fix_first_lead_names_a_cause_an_edit_can_remove(setup_mcp, health_data):
+ """An instruction must be actionable: history markers are context, never the lead."""
from repowise.server.mcp_server import get_health
- directive = (await get_health())["directive"]
- reason_marker = directive.get("reason")
- assert directive["fix_first"]
- watch = directive.get("watch")
- if watch is not None:
- marker = type("F", (), {"biomarker_type": watch["biomarker"]})
- code_shape, _ = split_by_origin([marker])
- assert not code_shape, "watch must carry a history marker, never a code-shape one"
- assert watch["biomarker"] not in (reason_marker or "")
+ lead_id = (await get_health())["fix_first"]["lead"]["id"]
+ item = (await get_health(fix_id=lead_id))["item"]
+ assert item["kind"] in {"refactor", "perf_fix", "finding"}
+ assert all(f["value"] != "change_entropy" for f in item["facts"])
@pytest.mark.asyncio
@@ -2246,7 +2001,7 @@ async def test_default_dashboard_is_compact_before_final_delivery(
result = await get_health()
assert len(json.dumps(result, separators=(",", ":"), default=str)) <= 24_000
assert "truncated_to_fit" not in result["_meta"]
- assert result["directive"]["fix_first"]
+ assert result["fix_first"]["lead"]
@pytest.mark.asyncio
@@ -2268,7 +2023,7 @@ async def test_tool_local_budget_does_not_preempt_final_delivery(
monkeypatch.setenv("MAX_MCP_OUTPUT_TOKENS", "400")
result = await get_health()
- assert result["directive"]["fix_first"]
+ assert result["fix_first"]["lead"]
assert "truncated_to_fit" not in result["_meta"]
@@ -2379,9 +2134,11 @@ async def test_meta_omits_the_commit_when_no_row_records_one(setup_mcp, health_d
async def test_health_semantics_survive_narrow_projection(setup_mcp, health_data):
from repowise.server.mcp_server import get_health
- broad = await get_health()
- narrow = await get_health(only=["directive"])
- assert narrow["directive"] == broad["directive"]
+ # The legend is the same on every call, so it rides only when asked for.
+ assert "health_semantics" not in (await get_health())["_meta"]
+ broad = await get_health(include=["semantics"])
+ narrow = await get_health(only=["fix_first"], include=["semantics"])
+ assert narrow["fix_first"] == broad["fix_first"]
assert narrow["_meta"]["health_semantics"] == broad["_meta"]["health_semantics"]
contract = narrow["_meta"]["health_semantics"]["weighted_deficit_points"]
assert contract["unit"] == "health_score_points_x_nloc"
@@ -2452,9 +2209,9 @@ async def test_unresolved_and_missing_analysis_never_read_as_healthy(
missing = await get_health(
include=["refactoring"],
- only=["directive", "kpis", "refactoring_plans"],
+ only=["fix_first", "kpis", "refactoring_plans"],
)
- assert missing["directive"] is None
+ assert missing["fix_first"]["lead"] is None
assert missing["kpis"]["average_health"] is None
assert missing["kpis"]["analysis_status"] == "unavailable"
assert missing["refactoring_plans_status"]["reason"] == "analysis_unavailable"
diff --git a/tests/unit/server/mcp/test_health_semantics_matrix.py b/tests/unit/server/mcp/test_health_semantics_matrix.py
index 6d51ebe7c..305e059cd 100644
--- a/tests/unit/server/mcp/test_health_semantics_matrix.py
+++ b/tests/unit/server/mcp/test_health_semantics_matrix.py
@@ -45,9 +45,9 @@ def _frozen(**kwargs: Any) -> MappingProxyType[str, Any]:
SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
HealthSemanticsCase(
- name="repository directive",
- call='get_health(only=["directive"], limit=0)',
- kwargs=_frozen(only=("directive",), limit=0),
+ name="repository fix first",
+ call='get_health(only=["fix_first"], limit=1)',
+ kwargs=_frozen(only=("fix_first",), limit=1),
comparison="default dashboard and limit=50",
comparison_kwargs=_frozen(limit=50),
plans_requested=False,
@@ -55,7 +55,7 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
expected_empty_reason=None,
next_action=None,
recovery="none",
- invariant_paths=("directive", "_meta.health_analysis", "_meta.health_semantics"),
+ invariant_paths=("fix_first.lead", "fix_first.totals", "_meta.health_analysis"),
),
HealthSemanticsCase(
name="healthy file self-check",
@@ -81,7 +81,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
"metrics",
"findings",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -108,7 +107,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
"metrics",
"findings",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -138,7 +136,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
"modules_total",
"metrics_total",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -152,7 +149,7 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
expected_empty_reason=None,
next_action=None,
recovery="none",
- invariant_paths=("trend", "_meta.health_analysis", "_meta.health_semantics"),
+ invariant_paths=("trend", "_meta.health_analysis"),
),
HealthSemanticsCase(
name="accuracy",
@@ -168,7 +165,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
invariant_paths=(
"defect_accuracy",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -188,7 +184,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
"coverage.summary",
"coverage.files_total",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -219,7 +214,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
"refactoring_plans",
"refactoring_plans_total",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -245,7 +239,6 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
invariant_paths=(
"findings",
"_meta.health_analysis",
- "_meta.health_semantics",
),
),
HealthSemanticsCase(
@@ -259,7 +252,7 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
expected_empty_reason=None,
next_action=None,
recovery="none",
- invariant_paths=("targets", "unresolved", "_meta.health_semantics"),
+ invariant_paths=("targets", "unresolved"),
),
HealthSemanticsCase(
name="stale indexed analysis with live source",
@@ -272,33 +265,33 @@ SEALED_HEALTH_SEMANTICS: tuple[HealthSemanticsCase, ...] = (
expected_empty_reason=None,
next_action="repowise update",
recovery="none",
- invariant_paths=("metrics", "_meta.health_analysis", "_meta.health_semantics"),
+ invariant_paths=("metrics", "_meta.health_analysis"),
),
HealthSemanticsCase(
name="degraded or missing analysis",
call=(
'get_health(include=["refactoring"], '
- 'only=["directive", "kpis", "refactoring_plans"])'
+ 'only=["fix_first", "kpis", "refactoring_plans"])'
),
kwargs=_frozen(
include=("refactoring",),
- only=("directive", "kpis", "refactoring_plans"),
+ only=("fix_first", "kpis", "refactoring_plans"),
),
comparison="missing-analysis narrow projection",
- comparison_kwargs=_frozen(only=("directive", "kpis")),
+ comparison_kwargs=_frozen(only=("fix_first", "kpis")),
plans_requested=True,
expected_plan_count=0,
expected_empty_reason="analysis_unavailable",
next_action="repowise update",
recovery="none",
- invariant_paths=("directive", "kpis", "_meta.health_analysis", "_meta.health_semantics"),
+ invariant_paths=("fix_first", "kpis", "_meta.health_analysis"),
),
)
def test_sealed_health_semantics_matrix_has_every_independent_oracle() -> None:
assert tuple(case.name for case in SEALED_HEALTH_SEMANTICS) == (
- "repository directive",
+ "repository fix first",
"healthy file self-check",
"unhealthy file self-check",
"module triage",
@@ -470,7 +463,7 @@ async def test_sealed_missing_analysis_row_executes_without_fabricating_health(
result = await call(**_mutable_kwargs(case.kwargs))
comparison = await call(**_mutable_kwargs(case.comparison_kwargs))
- assert result["directive"] is None
+ assert result["fix_first"]["lead"] is None
assert result["kpis"]["average_health"] is None
assert result["kpis"]["analysis_status"] == "unavailable"
assert result["refactoring_plans"] == []
@@ -488,10 +481,9 @@ async def test_sealed_projection_invariance_uses_independent_calls(setup_mcp, he
from repowise.server.mcp_server import get_health
dashboard = await get_health()
- directive = await get_health(only=["directive"], limit=0)
- assert directive["directive"] == dashboard["directive"]
- assert directive["_meta"]["health_semantics"] == dashboard["_meta"]["health_semantics"]
- assert directive["_meta"]["health_analysis"] == dashboard["_meta"]["health_analysis"]
+ lead = await get_health(only=["fix_first"])
+ assert lead["fix_first"] == dashboard["fix_first"]
+ assert lead["_meta"]["health_analysis"] == dashboard["_meta"]["health_analysis"]
broad = await get_health(
targets=["src/auth/service.py"],
@@ -545,7 +537,7 @@ async def test_seven_registry_health_recipes_are_bounded_and_self_describing(
call = tool_middleware(get_health)
recipes = (
- ({"only": ["directive"]}, "directive"),
+ ({"only": ["fix_first"]}, "fix_first"),
({"targets": ["src/auth/service.py"], "include": ["refactoring"]}, "metrics"),
(
{"targets": ["module:auth"], "only": ["modules", "metrics"]},
@@ -565,7 +557,8 @@ async def test_seven_registry_health_recipes_are_bounded_and_self_describing(
for kwargs, answer_key in recipes:
result = await call(**kwargs)
assert answer_key in result
- assert result["_meta"]["health_semantics"]
+ # The unit legend rides only when ``include=["semantics"]`` asks.
+ assert "health_semantics" not in result["_meta"]
assert result["_meta"]["health_analysis"]
size = len(json.dumps(result, separators=(",", ":"), default=str))
budget = 32_000 if kwargs.get("include") else 24_000
diff --git a/tests/unit/server/mcp/test_overview_surface.py b/tests/unit/server/mcp/test_overview_surface.py
index 63880b880..421fb2450 100644
--- a/tests/unit/server/mcp/test_overview_surface.py
+++ b/tests/unit/server/mcp/test_overview_surface.py
@@ -195,7 +195,8 @@ async def test_live_registry_recipe_calls_bind_to_current_tool_signatures(setup_
if recipe["name"].startswith("health_")
}
assert health_recipes == {
- "health_directive": 'get_health(only=["directive"])',
+ "health_fix_first": 'get_health(only=["fix_first"])',
+ "health_fix_item": 'get_health(fix_id="fix1_...")',
"health_file_self_check": (
'get_health(targets=["path"], include=["refactoring"])'
),
diff --git a/tests/unit/server/mcp/test_performance_levels.py b/tests/unit/server/mcp/test_performance_levels.py
index b604777b9..f084f4d05 100644
--- a/tests/unit/server/mcp/test_performance_levels.py
+++ b/tests/unit/server/mcp/test_performance_levels.py
@@ -79,67 +79,39 @@ class _Statements:
self.n += 1
+async def _lead_id(get_health) -> str:
+ """The top performance opportunity, from the queue the dashboard links to."""
+ page = await get_health(include=["performance"], only=["performance_opportunities"], limit=1)
+ return page["performance_opportunities"][0]["opportunity_id"]
+
+
@pytest.mark.asyncio
async def test_a_bare_dashboard_leads_with_something_to_do(setup_mcp, materialized):
- """Performance carries no defect impact, so it never won the main lead.
+ """Performance carries no defect impact, so it used to lead nowhere.
- The dashboard reported counts and nothing an agent could act on. The
- additive lead is one primary-key read of the current summary row.
+ Fix first ranks the intervention beside the code-shape work, with the call
+ that opens its plan.
"""
from repowise.server.mcp_server import get_health
result = await get_health()
- directive = result["performance_directive"]
- # A fan-out at a db boundary is advisory until something bounds it.
- assert directive["status"] == "advisory"
- assert directive["prerequisites"] == ["bounded_concurrency"]
- assert directive["validation"]["basis"] in {"measured", "inferred", "mixed", "unknown"}
- assert directive["opportunity_id"].startswith("perf")
- assert directive["plan_state"] == "available"
- assert directive["next_action"] == {
- "tool": "get_health",
- "arguments": {"opportunity_id": directive["opportunity_id"]},
- }
- assert 0 < len(json.dumps(directive)) <= 1500
- # The existing lead is untouched.
- assert "directive" in result
-
-
-async def test_the_cheapest_documented_call_stays_cheap(setup_mcp, materialized):
- """``only=["directive"]`` must not start paying for the second lead."""
- from repowise.server.mcp_server import get_health
-
- result = await get_health(only=["directive"])
assert "performance_directive" not in result
- assert "directive" in result
-
-
-async def test_a_clear_repository_never_reports_that_it_is_fast(setup_mcp, health_data):
- """No supported pattern is not a measurement of how the code runs."""
- from repowise.core.persistence.crud import finalize_performance_opportunities as finalize
- from repowise.server.mcp_server import _state, get_health
-
- async with _state._session_factory() as session:
- await session.execute(
- HealthFinding.__table__.delete().where(HealthFinding.dimension == "performance")
- )
- await finalize(session, health_data)
- await session.commit()
- directive = (await get_health())["performance_directive"]
- assert directive["status"] == "clear"
- assert "fast" not in directive["detail"].lower()
+ perf = [i for i in result["fix_first"]["items"] if i["kind"] == "perf_fix"]
+ assert perf, result["fix_first"]
+ # The five callers behind one shared helper are one intervention, one item.
+ shared = [i for i in perf if i["target"]["symbol"] == "load"]
+ assert len(shared) == 1, perf
+ assert shared[0]["next_call"]["arguments"]["opportunity_id"].startswith("perf")
+ assert 0 < len(json.dumps(shared[0])) <= 1500
@pytest.mark.asyncio
-async def test_an_unanalyzed_index_is_unavailable_not_clear(setup_mcp, health_data):
- """A missing materialization must not read as a clean repository."""
+async def test_the_cheapest_documented_call_stays_cheap(setup_mcp, materialized):
+ """``only=["fix_first"]`` pays for the lead and nothing else."""
from repowise.server.mcp_server import get_health
- directive = (await get_health())["performance_directive"]
- assert directive["status"] == "unavailable"
- assert directive["reason"] == "no_materialized_analysis"
+ result = await get_health(only=["fix_first"])
+ assert set(result) == {"fix_first", "mode", "_meta"}
@pytest.mark.asyncio
@@ -283,7 +255,7 @@ async def test_one_id_returns_the_cause_its_plan_and_its_rank_rationale(
):
from repowise.server.mcp_server import get_health
- lead = (await get_health())["performance_directive"]["opportunity_id"]
+ lead = await _lead_id(get_health)
result = await get_health(opportunity_id=lead)
assert result["mode"] == "performance_opportunity"
@@ -314,7 +286,7 @@ async def test_evidence_pages_to_exhaustion_with_no_duplicate_or_missing_row(
):
from repowise.server.mcp_server import get_health
- lead = (await get_health())["performance_directive"]["opportunity_id"]
+ lead = await _lead_id(get_health)
seen: list[str] = []
cursor: int | None = 0
while cursor is not None:
@@ -333,7 +305,7 @@ async def test_every_evidence_reference_round_trips_through_the_finding_selector
"""Evidence used to carry the storage row id, which a reindex replaces."""
from repowise.server.mcp_server import get_health
- lead = (await get_health())["performance_directive"]["opportunity_id"]
+ lead = await _lead_id(get_health)
page = await get_health(opportunity_id=lead, only=["performance_evidence"], limit=50)
for item in page["evidence"]:
resolved = await get_health(finding_id=item["finding_id"])
@@ -351,7 +323,7 @@ async def test_asking_for_no_rows_returns_no_rows(setup_mcp, materialized):
"""
from repowise.server.mcp_server import get_health
- lead = (await get_health())["performance_directive"]["opportunity_id"]
+ lead = await _lead_id(get_health)
page = await get_health(
opportunity_id=lead, only=["performance_evidence"], limit=0
)
@@ -419,17 +391,14 @@ async def test_two_detail_selectors_conflict_explicitly(setup_mcp, materialized)
@pytest.mark.asyncio
-async def test_the_lede_links_the_exact_plan_for_the_exact_lead(setup_mcp, materialized):
+async def test_the_lead_links_the_exact_plan_for_the_exact_lead(setup_mcp, materialized):
"""This used to match on a key the plan writer never wrote, so it was null."""
from repowise.server.mcp_server import get_health
- result = await get_health(
- include=["performance", "refactoring"], only=["recommendation_lede"]
- )
- lede = result["recommendation_lede"]
- assert lede["performance_plan_id"] is not None
- assert lede["performance_plan_id"].startswith("refac3_")
- plan = await get_health(plan_id=lede["performance_plan_id"])
+ page = await get_health(include=["performance"], only=["performance_opportunities"], limit=1)
+ lead = page["performance_opportunities"][0]
+ assert lead["plan_reference"].startswith("refac3_")
+ plan = await get_health(plan_id=lead["plan_reference"])
assert plan["resolved"] is True
@@ -531,9 +500,8 @@ async def test_a_plan_is_validated_by_a_test_named_for_its_file_when_no_edge_rea
await finalize_performance_opportunities(session, health_data, analyzed_commit="c" * 40)
await session.commit()
- lead = (await get_health())["performance_directive"]
- assert lead["validation"]["via"] == "name-match"
- opportunity = await get_health(opportunity_id=lead["opportunity_id"])
+ opportunity = await get_health(opportunity_id=await _lead_id(get_health))
+ assert opportunity["validation"]["via"] == "name-match"
plan = (await get_health(plan_id=opportunity["plan_reference"]))["plan"]
assert "tests/test_a.py" in opportunity["validation"]["tests"]
diff --git a/tests/unit/server/test_fix_first_routes.py b/tests/unit/server/test_fix_first_routes.py
new file mode 100644
index 000000000..dffb9c3d4
--- /dev/null
+++ b/tests/unit/server/test_fix_first_routes.py
@@ -0,0 +1,37 @@
+"""The Fix-first REST routes: the queue, one item by id, and the scope control."""
+
+from __future__ import annotations
+
+from repowise.core.persistence.crud import upsert_repository
+from tests.unit.persistence.test_fix_first_loader import seed_fix_first
+
+from .conftest import create_test_repo
+
+
+async def _repo(client, session, tmp_path) -> str:
+ repo = await create_test_repo(client, tmp_path)
+ await upsert_repository(session, name="r", local_path=repo["local_path"])
+ return repo["id"]
+
+
+async def test_queue_then_one_item_by_id(client, session, tmp_path) -> None:
+ repo_id = await _repo(client, session, tmp_path)
+ await seed_fix_first(session, repo_id)
+ await session.commit()
+
+ body = (await client.get(f"/api/repos/{repo_id}/health/fix-first?limit=2")).json()
+ assert body["totals"]["shown"] == 2 and body["totals"]["eligible"] == 3
+ assert body["lead"] == body["items"][0]
+ lead_id = body["lead"]["id"]
+
+ item = (await client.get(f"/api/repos/{repo_id}/health/fix-first/{lead_id}")).json()
+ assert item["id"] == lead_id and item["rank"] == 0
+ missing = await client.get(f"/api/repos/{repo_id}/health/fix-first/fix1_missing")
+ assert missing.status_code == 404
+
+
+async def test_unknown_scope_is_rejected(client, session, tmp_path) -> None:
+ repo_id = await _repo(client, session, tmp_path)
+ await session.commit()
+ resp = await client.get(f"/api/repos/{repo_id}/health/fix-first?scope=tests")
+ assert resp.status_code == 422
diff --git a/tests/unit/server/test_health_work_queue_controls.py b/tests/unit/server/test_health_work_queue_controls.py
index cf4f896a7..9b76a412c 100644
--- a/tests/unit/server/test_health_work_queue_controls.py
+++ b/tests/unit/server/test_health_work_queue_controls.py
@@ -304,3 +304,25 @@ async def test_exact_severity_beats_the_threshold_on_the_findings_list(
both = (await client.get(f"{url}&severity=low&min_severity=critical")).json()
assert [f["severity"] for f in both] == ["low"]
+
+
+async def test_history_only_files_are_left_out_and_counted(client, session, tmp_path) -> None:
+ """A file whose only findings are history has nothing an edit can fix."""
+ repo_id = await _repo(
+ client,
+ session,
+ tmp_path,
+ [_metric("a.py", 4.0), _metric("b.py", 5.0)],
+ [_finding("a.py", "change_entropy"), _finding("b.py")],
+ )
+
+ body = await _queue(client, repo_id)
+ assert [t["file_path"] for t in body["targets"]] == ["b.py"]
+ assert (body["total"], body["history_only_excluded"]) == (1, 1)
+
+ kept = await _queue(client, repo_id, "history=include")
+ assert {t["file_path"] for t in kept["targets"]} == {"a.py", "b.py"}
+ assert kept["history_only_excluded"] == 0
+ # Naming the marker reaches it, as naming a zero-impact dimension does.
+ named = await _queue(client, repo_id, "biomarker=change_entropy")
+ assert [t["file_path"] for t in named["targets"]] == ["a.py"]
diff --git a/tests/unit/server/test_performance_opportunities.py b/tests/unit/server/test_performance_opportunities.py
index a5429ba30..0c42940f3 100644
--- a/tests/unit/server/test_performance_opportunities.py
+++ b/tests/unit/server/test_performance_opportunities.py
@@ -290,15 +290,16 @@ async def test_expected_sits_out_of_the_default_queue_but_not_the_facet(
assert only_expected["items"][0]["actionability_reason"] == "inherent_to_boundary"
-async def test_an_expected_row_never_leads_the_directive(app, client: AsyncClient) -> None:
- from repowise.server.services.performance_health import PerformanceHealthService
+async def test_an_expected_row_never_leads(app, client: AsyncClient) -> None:
+ import json
finding = _filesystem_finding("src/fs.py", 1, ["src/fs.py::run", "src/fs.py::read"])
repo_id, _ = await _seed(app, client, [finding])
async with app.state.session_factory() as session:
- directive = await PerformanceHealthService(session, repo_id, "repo").directive()
- assert directive["status"] == "clear"
- assert directive["expected_total"] == 1
+ row = await crud.get_performance_summary(session, repo_id)
+ summary = json.loads(row.summary_json)
+ assert summary["lead"] is None
+ assert summary["actionability"] == {"expected": 1}
async def test_an_id_from_an_older_model_reports_stale_rather_than_no_plan(
diff --git a/tests/unit/server/test_refactoring_opportunities.py b/tests/unit/server/test_refactoring_opportunities.py
index f98804f77..0f0586d12 100644
--- a/tests/unit/server/test_refactoring_opportunities.py
+++ b/tests/unit/server/test_refactoring_opportunities.py
@@ -370,21 +370,21 @@ async def test_a_files_opportunities_are_one_indexed_lookup(client, app, test_en
@pytest.mark.asyncio
-async def test_bare_get_health_carries_one_bounded_refactoring_directive(client, app):
+async def test_bare_get_health_leads_with_fix_first_and_links_the_opportunity(client, app):
repo_id = await _seed(client, app, files=12)
get_health = await _mcp(app)
result = await get_health()
- directive = result["refactoring_directive"]
- assert directive["status"] == "available"
- assert directive["opportunity_id"].startswith("refop3_")
- assert directive["next_action"]["arguments"]["opportunity_id"] == directive["opportunity_id"]
- assert directive["opportunities_total"] == 12
- # Level 0 is a lead, not a queue: it must stay small enough to survive.
- assert len(str(directive)) < 1536
+ assert "refactoring_directive" not in result
assert "refactoring_opportunities" not in result
+ lead = result["fix_first"]["lead"]
+ assert lead["kind"] == "refactor"
+ opportunity_id = lead["next_call"]["arguments"]["opportunity_id"]
+ assert opportunity_id.startswith("refop3_")
+ # Level 0 is a lead, not a queue: it must stay small enough to survive.
+ assert len(str(result["fix_first"])) < 6000
# And the id it names resolves in one call.
- detail = await get_health(opportunity_id=directive["opportunity_id"])
+ detail = await get_health(opportunity_id=opportunity_id)
assert detail["found"] is True
# The lookup flag never shares a name with the lifecycle it sits beside:
# ``resolved: true`` next to ``status: "open"`` read as a contradiction.
@@ -396,13 +396,15 @@ async def test_bare_get_health_carries_one_bounded_refactoring_directive(client,
@pytest.mark.asyncio
-async def test_the_directive_is_clear_rather_than_absent_with_no_opportunities(client, app):
+async def test_the_rest_rollup_lead_is_clear_not_absent_with_no_opportunities(
+ client, app
+):
repo_id = await _repo(client)
async with app.state.session_factory() as session:
await crud.finalize_refactoring_opportunities(session, repo_id)
await session.commit()
- get_health = await _mcp(app)
- assert (await get_health())["refactoring_directive"]["status"] == "clear"
+ body = (await client.get(f"/api/repos/{repo_id}/refactoring/summary")).json()
+ assert body["directive"]["status"] == "clear"
@pytest.mark.asyncio
diff --git a/tests/unit/server/test_wire_vocabulary_parity.py b/tests/unit/server/test_wire_vocabulary_parity.py
index 24a844573..c36d94042 100644
--- a/tests/unit/server/test_wire_vocabulary_parity.py
+++ b/tests/unit/server/test_wire_vocabulary_parity.py
@@ -83,3 +83,33 @@ def test_action_vocabularies_match_python() -> None:
}
for alias, values in pairs.items():
assert _union_members(alias, "actions.ts") == set(values), alias
+
+
+def test_fix_first_vocabularies_match_python() -> None:
+ from repowise.core.analysis.health.fix_first import (
+ FIX_EFFORTS,
+ FIX_EXCLUSIONS,
+ FIX_FACT_BASES,
+ FIX_GAIN_KINDS,
+ FIX_IMPROVES,
+ FIX_KINDS,
+ FIX_LEVELS,
+ FIX_SCOPES,
+ FIX_TIERS,
+ )
+
+ pairs = {
+ "FixTier": FIX_TIERS,
+ "FixKind": FIX_KINDS,
+ "FixImproves": FIX_IMPROVES,
+ "FixGainKind": FIX_GAIN_KINDS,
+ "FixLevel": FIX_LEVELS,
+ "FixFactBasis": FIX_FACT_BASES,
+ "FixExclusion": FIX_EXCLUSIONS,
+ "FixScope": FIX_SCOPES,
+ }
+ for alias, values in pairs.items():
+ assert _union_members(alias, "fix-first.ts") == set(values), alias
+ # Upper-case members fall outside the lower-case member regex.
+ match = re.search(r'export type FixEffort =(.*?);', (_TYPES_SRC / "fix-first.ts").read_text(encoding="utf-8"))
+ assert match and set(re.findall(r'"([A-Z]+)"', match.group(1))) == set(FIX_EFFORTS)