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.

fix(ui): number the performance queue from 1 (#3248)

Alexis5c2ab5dc8809
diff --git a/packages/ui/__tests__/health/fixtures/performance.ts b/packages/ui/__tests__/health/fixtures/performance.ts
index e041b242a..4473211ce 100644
--- a/packages/ui/__tests__/health/fixtures/performance.ts
+++ b/packages/ui/__tests__/health/fixtures/performance.ts
@@ -91,7 +91,7 @@ export function opportunity(
actionability_reason: "strategy_requires_validation",
prerequisites: ["batch_api_contract"],
rank_score: 12.5,
- rank_position: 1,
+ rank_position: 0,
rank_factors: { boundary_kind: 4 },
why_ranked: [{ factor: "boundary_kind", value: "db", points: 4 }],
fix: {
@@ -139,7 +139,7 @@ export function page(overrides: Partial<PerformanceOpportunityPage> = {}): Perfo
opportunity_id: "perf2_planready",
actionability_state: "plan_ready",
actionability_reason: "proven_strategy",
- rank_position: 1,
+ rank_position: 0,
confidence: "high",
fix: {
strategy: "parallelize_independent_awaits",
@@ -151,12 +151,12 @@ export function page(overrides: Partial<PerformanceOpportunityPage> = {}): Perfo
opportunity({
opportunity_id: "perf2_advisory",
actionability_state: "advisory",
- rank_position: 2,
+ rank_position: 1,
}),
opportunity({
opportunity_id: "perf2_investigate",
actionability_state: "investigate",
- rank_position: 3,
+ rank_position: 2,
boundary_kind: null,
terminal_sink: null,
intervention_symbol: null,
diff --git a/packages/ui/__tests__/health/performance-view.test.tsx b/packages/ui/__tests__/health/performance-view.test.tsx
index c10ef0da6..c57be8995 100644
--- a/packages/ui/__tests__/health/performance-view.test.tsx
+++ b/packages/ui/__tests__/health/performance-view.test.tsx
@@ -214,6 +214,14 @@ describe("PerformanceView states", () => {
});
describe("PerformanceView drawer", () => {
+ it("numbers the queue from 1 although rank_position is stored 0-based", async () => {
+ render(<PerformanceView adapter={adapter()} />);
+ const first = await openFirstRow();
+ expect(within(first).getByText("1")).toBeTruthy();
+ const panel = await screen.findByRole("dialog");
+ expect(within(panel).getByText(/Position/).textContent).toMatch(/^Position 1 in the queue/);
+ });
+
it("separates evidence confidence, actionability, and fix safety", async () => {
render(<PerformanceView adapter={adapter()} />);
await openFirstRow();
diff --git a/packages/ui/src/health/performance/drawer.tsx b/packages/ui/src/health/performance/drawer.tsx
index 8a1c7731d..d5d4f194c 100644
--- a/packages/ui/src/health/performance/drawer.tsx
+++ b/packages/ui/src/health/performance/drawer.tsx
@@ -564,7 +564,7 @@ export function OpportunityDrawer({
<CollapsibleSection title="Why it ranks here">
<p className="text-sm text-[var(--color-text-secondary)]">
- Position <span className="tabular-nums">{current.rank_position.toLocaleString()}</span>{" "}
+ Position <span className="tabular-nums">{(current.rank_position + 1).toLocaleString()}</span>{" "}
in the queue.
</p>
{current.why_ranked.length > 0 ? (
diff --git a/packages/ui/src/health/performance/queue.tsx b/packages/ui/src/health/performance/queue.tsx
index 50c019cf7..49d87045c 100644
--- a/packages/ui/src/health/performance/queue.tsx
+++ b/packages/ui/src/health/performance/queue.tsx
@@ -166,7 +166,7 @@ const OpportunityRow = memo(function OpportunityRow({
{...clickableRowProps(() => onInspect(opportunity))}
>
<span className="mt-0.5 w-7 shrink-0 text-right font-mono text-xs tabular-nums text-[var(--color-text-tertiary)]">
- {opportunity.rank_position.toLocaleString()}
+ {(opportunity.rank_position + 1).toLocaleString()}
</span>
<div className="min-w-0 flex-1">