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): name the analyzer version beside health scores (#4370)

Raghav Chamadiya280b650d417e
diff --git a/docs/layers/CODE_HEALTH.md b/docs/layers/CODE_HEALTH.md
index 826eb2225..4f1dd14bd 100644
--- a/docs/layers/CODE_HEALTH.md
+++ b/docs/layers/CODE_HEALTH.md
@@ -174,6 +174,10 @@ Every id with its threshold and weight:
- Every `init`, `update` and `health --recompute` stores a snapshot (the last 50 per
repository); `repowise health --trend` prints the last 10 with declining, predicted
decline and history-drag alerts ([rules](../architecture/code-health.md#8-trends-trendspy)).
+- `analyzer_version` names the scoring a number came from, in `health --format json`,
+ `health check --format json`, each `--trend` row and `get_health`'s
+ `_meta.health_analysis`. A score that moves while it changes may reflect new scoring,
+ not new code; it is `null` (or absent on MCP) for analysis stored before it was recorded.
- Coverage reports feed the coverage detectors (`repowise coverage add coverage.lcov`);
with none, only `untested_hotspot` and the reach-tier `untested_complexity` (hidden by
default) run, and no file is treated as uncovered
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 0e2ef44e3..bf56589ae 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/command.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/command.py
@@ -51,6 +51,7 @@ from .persist import (
_load_queue_counts,
_load_recommendations,
_load_short_history,
+ _load_stored_analyzer_version,
_load_stored_report,
_persist_health,
)
@@ -345,6 +346,11 @@ class _Options:
counts: str
trend_view: bool
+ @property
+ def live(self) -> bool:
+ """The report is analysed in-process rather than read from the index."""
+ return self.recompute or self.generate_code is not None
+
@property
def controls_set(self) -> bool:
"""``--scope`` or ``--counts`` asks for other than the stored reading."""
@@ -434,7 +440,7 @@ def _render_stored_view(repo_path: Path, status: Any, opts: _Options) -> bool:
def _load_report(repo_path: Path, opts: _Options) -> tuple[Any, set[str], dict[str, str]]:
"""``(report, hotspot paths, language by path)``, recomputed or as stored."""
- if opts.recompute or opts.generate_code is not None:
+ if opts.live:
# Written back only for a whole-repo table: json/md are read by scripts
# and CI, and a file or module run is an inspection, not repo state.
return _recompute_report(
@@ -509,12 +515,21 @@ def _scoped_suggestions(report: Any, opts: _Options) -> list[Any]:
def _render_json(
repo_path: Path, report: Any, metrics_sorted: list[Any], findings: list[Any], opts: _Options
) -> None:
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+
excluded = excluded_types()
short_history = _load_short_history(repo_path)
click.echo(
json.dumps(
{
"kpis": report.kpis,
+ # Which scoring produced these numbers: a score that moves
+ # across a version change may not mean the code changed.
+ "analyzer_version": (
+ HEALTH_ANALYZER_VERSION
+ if opts.live
+ else _load_stored_analyzer_version(repo_path)
+ ),
"scope": parse_scope(opts.scope),
"counts": parse_counts(opts.counts),
# Findings, causes, plans and Fix first items, as every
diff --git a/packages/cli/src/repowise/cli/commands/health_cmd/live_score.py b/packages/cli/src/repowise/cli/commands/health_cmd/live_score.py
index adb819aa8..b6602f904 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/live_score.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/live_score.py
@@ -144,9 +144,12 @@ def render_live(scores: LiveScores, fmt: str) -> None:
def live_payload(scores: LiveScores) -> dict[str, Any]:
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+
change = score_change(scores.rows)
return {
"basis": "live",
+ "analyzer_version": HEALTH_ANALYZER_VERSION,
"history_source": "index" if scores.indexed else "none",
"against": scores.against,
"files": [
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 27facc8d7..04f175600 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/persist.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/persist.py
@@ -115,25 +115,37 @@ def _load_queue_counts(repo_path: object) -> dict[str, Any] | None:
return None
-def _load_short_history(repo_path: object) -> set[str]:
- """Files whose recorded history is too thin to count; empty when the store cannot answer."""
+def _read_beside_score(repo_path: object, read: Any, empty: Any) -> Any:
+ """``read(session, repo_id)`` off the index; *empty* when the store cannot answer."""
from sqlalchemy.exc import SQLAlchemyError
from repowise.cli.helpers import repo_index_session
- from repowise.core.persistence.crud import get_short_history_paths
- async def _do() -> set[str]:
+ async def _do() -> Any:
async with repo_index_session(Path(str(repo_path))) as opened:
if opened is None:
- return set()
- session, repo_id = opened
- return await get_short_history_paths(session, repo_id)
+ return empty
+ return await read(*opened)
try:
return run_async(_do())
except (SQLAlchemyError, OSError):
# A marker beside the score, never a reason to fail the report.
- return set()
+ return empty
+
+
+def _load_short_history(repo_path: object) -> set[str]:
+ """Files whose recorded history is too thin to count; empty when the store cannot answer."""
+ from repowise.core.persistence.crud import get_short_history_paths
+
+ return _read_beside_score(repo_path, get_short_history_paths, set())
+
+
+def _load_stored_analyzer_version(repo_path: object) -> int | None:
+ """The analyzer version the stored scores were snapshotted under; ``None`` if unrecorded."""
+ from repowise.core.persistence.crud import get_latest_snapshot_analyzer_version
+
+ return _read_beside_score(repo_path, get_latest_snapshot_analyzer_version, None)
def _load_stored_report(repo_path: object) -> tuple[Any, set[str], dict[str, str]] | None:
diff --git a/packages/cli/src/repowise/cli/commands/health_cmd/trends.py b/packages/cli/src/repowise/cli/commands/health_cmd/trends.py
index ed33893ab..4490dc485 100644
--- a/packages/cli/src/repowise/cli/commands/health_cmd/trends.py
+++ b/packages/cli/src/repowise/cli/commands/health_cmd/trends.py
@@ -47,7 +47,8 @@ def _render_trend(repo_path: object, *, fmt: str) -> None:
if repo is None:
return [], None
snaps = await list_health_snapshots(session, repo.id)
- return recent_kpis(snaps, limit=10, doc_drift=True), diff_snapshots(snaps)
+ rows = recent_kpis(snaps, limit=10, doc_drift=True, analyzer_version=True)
+ return rows, diff_snapshots(snaps)
rows, summary = run_async(_fetch())
if not rows:
diff --git a/packages/core/alembic/versions/0117_health_snapshot_analyzer_version.py b/packages/core/alembic/versions/0117_health_snapshot_analyzer_version.py
new file mode 100644
index 000000000..4ed80a059
--- /dev/null
+++ b/packages/core/alembic/versions/0117_health_snapshot_analyzer_version.py
@@ -0,0 +1,45 @@
+"""Record the health analyzer version on each health snapshot.
+
+``health_snapshots.analyzer_version`` is the ``HEALTH_ANALYZER_VERSION`` that
+wrote the row, so a trend can tell a scoring change from a code change.
+Nullable: null means "not recorded".
+
+Local SQLite stores never run Alembic -- ``init_db``'s reconciler issues
+additive DDL for missing columns -- so this migration exists for managed
+Postgres.
+
+Revision ID: 0117
+Revises: 0116
+Create Date: 2026-10-22
+"""
+
+from __future__ import annotations
+
+from collections.abc import Sequence
+
+import sqlalchemy as sa
+from alembic import op
+
+# revision identifiers
+revision: str = "0117"
+down_revision: str | None = "0116"
+branch_labels: str | Sequence[str] | None = None
+depends_on: str | Sequence[str] | None = None
+
+
+def _columns() -> set[str]:
+ inspector = sa.inspect(op.get_bind())
+ return {c["name"] for c in inspector.get_columns("health_snapshots")}
+
+
+def upgrade() -> None:
+ # Guarded: ``init_db``'s reconciler may already have added it on Postgres.
+ if "analyzer_version" not in _columns():
+ op.add_column(
+ "health_snapshots", sa.Column("analyzer_version", sa.Integer(), nullable=True)
+ )
+
+
+def downgrade() -> None:
+ if "analyzer_version" in _columns():
+ op.drop_column("health_snapshots", "analyzer_version")
diff --git a/packages/core/src/repowise/core/analysis/health/trends.py b/packages/core/src/repowise/core/analysis/health/trends.py
index 43ce74f53..cdefc2f1f 100644
--- a/packages/core/src/repowise/core/analysis/health/trends.py
+++ b/packages/core/src/repowise/core/analysis/health/trends.py
@@ -424,14 +424,19 @@ def _point(snap: Any, attr: str) -> float | None:
def recent_kpis(
- history: list[Any], limit: int = 10, *, doc_drift: bool = False
+ history: list[Any],
+ limit: int = 10,
+ *,
+ doc_drift: bool = False,
+ analyzer_version: bool = False,
) -> list[dict[str, Any]]:
"""Serialize the most-recent *limit* snapshots for CLI / API consumers.
Newest first (so the CLI table reads top-down chronologically when
flipped, which matches user expectation for "recent runs"). Each row
- is a plain dict — no ORM leakage. *doc_drift* adds ``doc_drift_count``;
- off by default so agent-facing trend rows stay as they were.
+ is a plain dict — no ORM leakage. *doc_drift* adds ``doc_drift_count`` and
+ *analyzer_version* the row's ``analyzer_version``; both off by default so
+ agent-facing trend rows stay as they were.
"""
if not history:
return []
@@ -460,6 +465,8 @@ def recent_kpis(
)
if doc_drift:
rows[-1]["doc_drift_count"] = getattr(snap, "doc_drift_count", None)
+ if analyzer_version:
+ rows[-1]["analyzer_version"] = getattr(snap, "analyzer_version", None)
return rows
diff --git a/packages/core/src/repowise/core/analysis/health_gate.py b/packages/core/src/repowise/core/analysis/health_gate.py
index 251143d4b..c2f30e789 100644
--- a/packages/core/src/repowise/core/analysis/health_gate.py
+++ b/packages/core/src/repowise/core/analysis/health_gate.py
@@ -438,8 +438,11 @@ def render_gitlab(result: GateResult) -> list[dict]:
def as_json(result: GateResult, delta: ChangeHealthDelta, *, label: str) -> dict[str, Any]:
"""The JSON document: the comparison's scope, every finding, the gate."""
+ from .health import HEALTH_ANALYZER_VERSION
+
return {
"revspec": label,
+ "analyzer_version": HEALTH_ANALYZER_VERSION,
"status": delta.status,
"explanation": delta.explanation,
"scope": delta.scope.as_dict(),
diff --git a/packages/core/src/repowise/core/persistence/crud/analysis/__init__.py b/packages/core/src/repowise/core/persistence/crud/analysis/__init__.py
index bf129e6d0..d494f3363 100644
--- a/packages/core/src/repowise/core/persistence/crud/analysis/__init__.py
+++ b/packages/core/src/repowise/core/persistence/crud/analysis/__init__.py
@@ -84,6 +84,7 @@ from .health import (
get_health_snapshot_file_counts,
get_health_snapshot_headline,
get_health_summary,
+ get_latest_snapshot_analyzer_version,
get_perf_coverage,
get_scored_file_paths,
health_finding_priorities,
@@ -177,6 +178,7 @@ __all__ = [
"get_health_snapshot_file_counts",
"get_health_snapshot_headline",
"get_health_summary",
+ "get_latest_snapshot_analyzer_version",
"get_perf_coverage",
"get_performance_opportunity",
"get_performance_plan_rows",
diff --git a/packages/core/src/repowise/core/persistence/crud/analysis/health/__init__.py b/packages/core/src/repowise/core/persistence/crud/analysis/health/__init__.py
index 6296a498b..a4b3ce7a3 100644
--- a/packages/core/src/repowise/core/persistence/crud/analysis/health/__init__.py
+++ b/packages/core/src/repowise/core/persistence/crud/analysis/health/__init__.py
@@ -50,6 +50,7 @@ from .snapshots import (
_doc_drift_count, # noqa: F401
get_health_snapshot_file_counts,
get_health_snapshot_headline,
+ get_latest_snapshot_analyzer_version,
list_health_snapshots,
save_health_snapshot,
)
@@ -77,6 +78,7 @@ __all__ = [
"get_health_snapshot_file_counts",
"get_health_snapshot_headline",
"get_health_summary",
+ "get_latest_snapshot_analyzer_version",
"get_perf_coverage",
"get_scored_file_paths",
"health_exclude_spec",
diff --git a/packages/core/src/repowise/core/persistence/crud/analysis/health/snapshots.py b/packages/core/src/repowise/core/persistence/crud/analysis/health/snapshots.py
index 4c033fa7f..5d580f082 100644
--- a/packages/core/src/repowise/core/persistence/crud/analysis/health/snapshots.py
+++ b/packages/core/src/repowise/core/persistence/crud/analysis/health/snapshots.py
@@ -79,9 +79,12 @@ async def save_health_snapshot(
``structure_average`` / ``history_average`` are ``average_health``'s two
halves in deduction points, so a later trend can name which one moved.
- The stored doc drift count is read here rather than passed in, so every
- writer records it without a new argument; write drift before calling this.
+ The stored doc drift count and the analyzer version are read here rather
+ than passed in, so every writer records them without a new argument; write
+ drift before calling this.
"""
+ from repowise.core.analysis.health.engine import HEALTH_ANALYZER_VERSION
+
snap = HealthSnapshot(
id=_new_uuid(),
repository_id=repository_id,
@@ -99,6 +102,7 @@ async def save_health_snapshot(
production_average=production_average,
maintainability_average=maintainability_average,
doc_drift_count=await _doc_drift_count(session, repository_id),
+ analyzer_version=HEALTH_ANALYZER_VERSION,
)
session.add(snap)
await session.flush()
@@ -228,6 +232,18 @@ async def get_health_snapshot_headline(
)
+async def get_latest_snapshot_analyzer_version(
+ session: AsyncSession, repository_id: str
+) -> int | None:
+ """The analyzer version of the newest snapshot; ``None`` when unrecorded."""
+ return await session.scalar(
+ select(HealthSnapshot.analyzer_version)
+ .where(HealthSnapshot.repository_id == repository_id)
+ .order_by(HealthSnapshot.taken_at.desc(), HealthSnapshot.id.desc())
+ .limit(1)
+ )
+
+
async def get_health_snapshot_file_counts(
session: AsyncSession,
repository_id: str,
diff --git a/packages/core/src/repowise/core/persistence/models.py b/packages/core/src/repowise/core/persistence/models.py
index 2a1b3f34b..44840e652 100644
--- a/packages/core/src/repowise/core/persistence/models.py
+++ b/packages/core/src/repowise/core/persistence/models.py
@@ -2521,6 +2521,9 @@ class HealthSnapshot(Base):
maintainability_average: Mapped[float | None] = mapped_column(Float, nullable=True)
# Stored documentation drift findings at this instant. NULL before recorded.
doc_drift_count: Mapped[int | None] = mapped_column(Integer, nullable=True)
+ # ``HEALTH_ANALYZER_VERSION`` of the writer, so a trend can tell a scoring
+ # change from a code change. NULL on snapshots taken before it was recorded.
+ analyzer_version: Mapped[int | None] = mapped_column(Integer, nullable=True)
class SnapshotRun(Base):
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 a8545c789..f4c6ab93d 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,6 +6,7 @@ from typing import Any
from sqlalchemy import func, select
+from repowise.core.persistence.crud import get_latest_snapshot_analyzer_version
from repowise.core.persistence.models import HealthFileMetric
@@ -59,6 +60,15 @@ async def _attach_repository_analysis_meta(
latest_commit=latest[1] if latest else None,
distinct_commits=distinct,
)
+ await _attach_analyzer_version(session, repository, meta)
+
+
+async def _attach_analyzer_version(session: Any, repository: Any, meta: dict[str, Any]) -> None:
+ """Which scoring the stored figures came from, so a moved score can be told
+ apart from a scoring change. Absent when no snapshot recorded it."""
+ version = await get_latest_snapshot_analyzer_version(session, repository.id)
+ if version is not None:
+ meta["health_analysis"]["analyzer_version"] = version
def _write_health_analysis_meta(
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 a940546bc..bc70373af 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
@@ -43,6 +43,7 @@ from repowise.server.mcp_server._workspace_routing import (
single_repo,
)
from repowise.server.mcp_server.tool_health.analysis_meta import (
+ _attach_analyzer_version,
_attach_health_analysis_meta,
_attach_repository_analysis_meta,
)
@@ -280,6 +281,7 @@ async def get_health(
await _attach_repository_analysis_meta(session, repository, result["_meta"])
else:
_attach_health_analysis_meta(result["_meta"], data.pop.all_metrics)
+ await _attach_analyzer_version(session, repository, result["_meta"])
_attach_gated(result["_meta"], data)
_attach_preview(result)
_attach_withheld(result, data)
diff --git a/tests/unit/analysis/test_health_gate.py b/tests/unit/analysis/test_health_gate.py
index bf93b0aac..9046ba049 100644
--- a/tests/unit/analysis/test_health_gate.py
+++ b/tests/unit/analysis/test_health_gate.py
@@ -204,6 +204,9 @@ def test_json_carries_the_gate_shape_policy_rules_read():
d = delta(finding())
doc = as_json(evaluate(d), d, label="main...HEAD")
json.dumps(doc)
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+
+ assert doc["analyzer_version"] == HEALTH_ANALYZER_VERSION
gate = doc["gate"]
assert gate["passed"] is False and gate["verdict"] == "fail"
(row,) = gate["failing"]
diff --git a/tests/unit/cli/test_health_cmd_score_live.py b/tests/unit/cli/test_health_cmd_score_live.py
index 5ae81bb28..f913d5d5e 100644
--- a/tests/unit/cli/test_health_cmd_score_live.py
+++ b/tests/unit/cli/test_health_cmd_score_live.py
@@ -50,6 +50,9 @@ def test_score_compares_the_file_on_disk_with_a_revision(tmp_path: Path) -> None
assert result.exit_code == 0, result.output
payload = json.loads(result.stdout[result.stdout.index("{") :])
assert payload["history_source"] == "none"
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+
+ assert payload["analyzer_version"] == HEALTH_ANALYZER_VERSION
row = payload["files"][0]
assert row["path"] == "app.py"
assert row["head_score"] > row["base_score"]
diff --git a/tests/unit/cli/test_health_cmd_withheld.py b/tests/unit/cli/test_health_cmd_withheld.py
index d96c43fe7..e6fec385a 100644
--- a/tests/unit/cli/test_health_cmd_withheld.py
+++ b/tests/unit/cli/test_health_cmd_withheld.py
@@ -71,6 +71,7 @@ def _run(monkeypatch, *args: str) -> tuple[str, str]:
patch.object(health_module, "_load_fix_first", return_value=None),
patch.object(health_module, "_load_queue_counts", return_value=None),
patch.object(health_module, "_load_short_history", return_value=set()),
+ patch.object(health_module, "_load_stored_analyzer_version", return_value=41),
patch.object(health_module, "console", console),
):
resolve.return_value = SimpleNamespace(
@@ -86,6 +87,8 @@ def test_json_keeps_withheld_findings_so_it_explains_its_score(monkeypatch) -> N
payload = json.loads(stdout[stdout.index("{"):])
by_kind = {f["biomarker_type"]: f for f in payload["findings"]}
assert set(by_kind) == {"complex_method", "dry_violation"}
+ # A stored reading names the analyzer its snapshot recorded, not this binary's.
+ assert payload["analyzer_version"] == 41
assert by_kind["dry_violation"]["withheld"] is True
assert "withheld" not in by_kind["complex_method"]
diff --git a/tests/unit/health/test_trends.py b/tests/unit/health/test_trends.py
index 68cb8a675..a5c584b5f 100644
--- a/tests/unit/health/test_trends.py
+++ b/tests/unit/health/test_trends.py
@@ -700,3 +700,11 @@ def test_the_memo_needs_nothing_of_the_snapshot_object():
snaps = [_Slotted(_ts(0), {"a.py": 9.0}), _Slotted(_ts(1), {"a.py": 7.0})]
assert file_trend(snaps, "a.py").delta == -2.0
+
+
+def test_recent_kpis_carries_the_analyzer_version_only_when_asked():
+ snaps = _series([5.0, 6.0])
+ snaps[1].analyzer_version = 42
+ assert "analyzer_version" not in recent_kpis(snaps)[0]
+ rows = recent_kpis(snaps, analyzer_version=True)
+ assert [r["analyzer_version"] for r in rows] == [42, None]
diff --git a/tests/unit/persistence/test_health_snapshot_deductions.py b/tests/unit/persistence/test_health_snapshot_deductions.py
index 4e571f0f4..2f1879ec4 100644
--- a/tests/unit/persistence/test_health_snapshot_deductions.py
+++ b/tests/unit/persistence/test_health_snapshot_deductions.py
@@ -107,3 +107,20 @@ async def test_stored_depth_reaches_the_trend_reader(async_session, tmp_path) ->
assert [p.unclamped_score for p in trend.points] == [-2.9, -0.4]
assert trend.delta == 0.0
assert trend.unclamped_delta == 2.5
+
+
+async def test_each_snapshot_records_the_analyzer_that_wrote_it(async_session, tmp_path) -> None:
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+ from repowise.core.persistence.crud import get_latest_snapshot_analyzer_version
+
+ repo = await upsert_repository(async_session, name="repo", local_path=str(tmp_path))
+ assert await get_latest_snapshot_analyzer_version(async_session, repo.id) is None
+ older = await _snapshot(async_session, repo.id, scores={"a.py": 5.0})
+ older.analyzer_version = None # a row written before the column existed
+ await _snapshot(async_session, repo.id, scores={"a.py": 5.0}, day=1)
+ await async_session.flush()
+
+ assert (
+ await get_latest_snapshot_analyzer_version(async_session, repo.id)
+ == HEALTH_ANALYZER_VERSION
+ )
diff --git a/tests/unit/server/mcp/test_health.py b/tests/unit/server/mcp/test_health.py
index d999f4818..baaeb8c48 100644
--- a/tests/unit/server/mcp/test_health.py
+++ b/tests/unit/server/mcp/test_health.py
@@ -3027,3 +3027,30 @@ async def test_workspace_rows_count_the_files_the_overview_counts(setup_mcp, hea
overview = await _build_code_health(session, SimpleNamespace(id=health_data))
assert await _code_files(session, health_data) == overview["code_files"]
+
+
+async def test_meta_names_the_analyzer_the_stored_scores_came_from(
+ setup_mcp, session, health_data
+):
+ """Both modes report the newest snapshot's stamp, and omit it when none recorded it."""
+ from repowise.core.persistence.crud import save_health_snapshot
+ from repowise.server.mcp_server import get_health
+
+ assert "analyzer_version" not in (await get_health(only=["kpis"]))["_meta"]["health_analysis"]
+ await save_health_snapshot(
+ session,
+ health_data,
+ hotspot_health=5.0,
+ average_health=6.0,
+ worst_performer_path=None,
+ worst_performer_score=None,
+ )
+ await session.flush()
+
+ from repowise.core.analysis.health import HEALTH_ANALYZER_VERSION
+
+ scoped = await get_health(targets=["src/auth/service.py"], only=["metrics"])
+ dashboard = await get_health(only=["kpis"])
+ for result in (scoped, dashboard):
+ assert result["_meta"]["health_analysis"]["analyzer_version"] == HEALTH_ANALYZER_VERSION