Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.
Python aicode-complexitycode-healthcode-intelligencecode-qualitydead-codedeveloper-toolsdocumentationgit-analyticsmcpopen-sourcepythonrefactoringstatic-analysistechnical-debt
fix(health): show the open performance count from older health summaries (#4304)
Raghav Chamadiya4901f121d0cc
diff --git a/packages/types/src/health.ts b/packages/types/src/health.tsindex 81e92f1e5..1423cc552 100644--- a/packages/types/src/health.ts+++ b/packages/types/src/health.ts@@ -296,6 +296,11 @@ export interface HealthFileMetric {* before the column existed; absent on payloads that do not carry it.*/code_origin?: string | null;+ /**+ * @deprecated Open performance findings on this file, as payloads from the+ * previous release carry them. Read `performance_opportunities` instead.+ */+ performance_findings?: number | null;/*** Whether a performance detector actually ran on this file (its language has a* registered perf dialect). `false` = unsupported language, the perf pass never@@ -861,6 +866,11 @@ export interface HealthOverviewSummary {maintainability_findings?: number;/** Open performance causes, as every surface counts them; `null` with no files. */performance_causes?: PerformanceCauses | null;+ /**+ * @deprecated Every open performance finding, as payloads from the previous+ * release carry it. The lede shows it only when `performance_causes` is absent.+ */+ performance_findings?: number;/** Lowest-scoring file by performance risk, surfaced only when score < 10* (a clean repo returns `null` rather than a misleading "worst" at 10.0). */worst_performance_path?: string | null;diff --git a/packages/ui/__tests__/dashboard/health-overview-card.test.tsx b/packages/ui/__tests__/dashboard/health-overview-card.test.tsxindex b1420469c..8361008e3 100644--- a/packages/ui/__tests__/dashboard/health-overview-card.test.tsx+++ b/packages/ui/__tests__/dashboard/health-overview-card.test.tsx@@ -64,4 +64,14 @@ describe("HealthOverviewCard performance", () => {);expect(waiting.container.textContent).toContain("0worth fixing now");});++ it("shows an older payload's open count rather than all clear", () => {+ const { container } = render(+ <HealthOverviewCard data={data({ ...perf, performance_findings: 942 })} repoId="r" />,+ );+ const text = container.textContent ?? "";+ expect(text).toContain("942open");+ expect(text).not.toContain("worth fixing now");+ expect(text).not.toContain("in production");+ });});diff --git a/packages/ui/__tests__/health/code-health-lede.test.tsx b/packages/ui/__tests__/health/code-health-lede.test.tsxindex 29adcef92..6786624f9 100644--- a/packages/ui/__tests__/health/code-health-lede.test.tsx+++ b/packages/ui/__tests__/health/code-health-lede.test.tsx@@ -65,6 +65,13 @@ describe("CodeHealthLede — how many scores the first screen carries", () => {expect(container.textContent).toContain("Performance, fix now4");});+ it("shows an older summary's open count instead of a fix-now zero", () => {+ const { performance_causes: _causes, ...older } = summary({ performance_findings: 942 });+ const { container } = render(<CodeHealthLede summary={older} />);+ expect(container.textContent).toContain("Performance risk942");+ expect(container.textContent).not.toContain("Performance, fix now");+ });+it("says nothing when the split was never recorded", () => {const { container } = render(<CodeHealthLede summary={summary({ structure_average: null, history_average: null })} />,diff --git a/packages/ui/src/dashboard/health-overview-card.tsx b/packages/ui/src/dashboard/health-overview-card.tsxindex a15967f2d..a5dbea563 100644--- a/packages/ui/src/dashboard/health-overview-card.tsx+++ b/packages/ui/src/dashboard/health-overview-card.tsx@@ -45,6 +45,11 @@ export interface HealthOverviewData {/** Open performance causes: worth fixing now (the default queue), in* production code, and overall. */performance_causes?: PerformanceCauses | null;+ /**+ * @deprecated Every open performance finding, as payloads from the previous+ * release carry it. Shown only when `performance_causes` is absent.+ */+ performance_findings?: number | null;/** Snapshot history, oldest→newest, for the trend sparkline. */history: HealthOverviewPoint[];snapshot_count: number;@@ -384,6 +389,7 @@ export function HealthOverviewCard({href={`${reportHref}?pillar=performance`}score={data.performance_average ?? null}causes={data.performance_causes ?? null}+ open={data.performance_findings ?? null}/></div>)}@@ -443,13 +449,17 @@ function PerformancePillarStat({href,score,causes,+ open,}: {href: string;score: number | null;causes: PerformanceCauses | null;+ /** The raw open count an older payload carries in place of `causes`. */+ open: number | null;}) {- const now = causes?.now ?? 0;- const production = causes?.production ?? 0;+ const openOnly = causes == null ? open : null;+ const now = causes?.now ?? openOnly ?? 0;+ const production = causes?.production ?? openOnly ?? 0;const clear = score != null && now === 0 && production === 0;return (<a@@ -469,9 +479,11 @@ function PerformancePillarStat({<span className="text-xl font-bold tabular-nums leading-none text-[var(--color-text-primary)]">{now.toLocaleString()}</span>- <span className="text-xs text-[var(--color-text-secondary)]">worth fixing now</span>+ <span className="text-xs text-[var(--color-text-secondary)]">+ {openOnly != null ? "open" : "worth fixing now"}+ </span><span className="text-[10px] tabular-nums text-[var(--color-text-tertiary)]">- · {production.toLocaleString()} in production · {formatScore(score)}/10+ {openOnly == null && <>· {production.toLocaleString()} in production </>}· {formatScore(score)}/10</span></span>)}diff --git a/packages/ui/src/health/code-health-lede.tsx b/packages/ui/src/health/code-health-lede.tsxindex 7576f46f1..99b076d9a 100644--- a/packages/ui/src/health/code-health-lede.tsx+++ b/packages/ui/src/health/code-health-lede.tsx@@ -78,6 +78,12 @@ function performanceHint(causes: PerformanceCauses | null | undefined): string {);}+/** For a summary that predates `performance_causes` and carries only the raw count. */+const OPEN_PERFORMANCE_HINT =+ "A count of open performance risks, not a score. Each one is a database, " ++ "network, filesystem or subprocess call inside a loop, traced across function " ++ "boundaries. Never blended into the health score.";+const HOTSPOT_HINT ="Code health averaged over the repo's churn hotspots — the files you change " +"most often. Lower than the overall figure on most repos, because " +@@ -155,6 +161,9 @@ export function CodeHealthLede({const maint = summary.maintainability_average;const perf = summary.performance_average;const perfCauses = summary.performance_causes;+ // An older summary carries only the raw open count; show it under its own+ // label rather than a "fix now" zero.+ const perfOpen = perfCauses == null ? (summary.performance_findings ?? null) : null;const hotspot = summary.hotspot_health;const worstTestPath = summary.worst_test_path;const worstTestScore = summary.worst_test_score;@@ -201,11 +210,17 @@ export function CodeHealthLede({// the page was describing something else.highlighted: pillar === "maintainability",},- {- label: "Performance, fix now",- value: perf == null ? "" : formatNumber(perfCauses?.now ?? 0),- hint: performanceHint(perfCauses),- },+ perfOpen != null+ ? {+ label: "Performance risk",+ value: perf == null ? "" : formatNumber(perfOpen),+ hint: OPEN_PERFORMANCE_HINT,+ }+ : {+ label: "Performance, fix now",+ value: perf == null ? "" : formatNumber(perfCauses?.now ?? 0),+ hint: performanceHint(perfCauses),+ },{label: "Hotspot health",value: hotspot == null ? "" : formatScore(hotspot),