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
perf(ui): virtualize large tables with a shared windowing primitive (#598)
Swati Ahuja3144abcea646
diff --git a/package-lock.json b/package-lock.jsonindex 0a00abeaf..f24b5da20 100644--- a/package-lock.json+++ b/package-lock.json@@ -1293,7 +1293,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1316,7 +1315,6 @@"os": ["darwin"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1339,7 +1337,6 @@"os": ["darwin"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1356,7 +1353,6 @@"os": ["darwin"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1373,7 +1369,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1390,7 +1385,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1407,7 +1401,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1424,7 +1417,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1441,7 +1433,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1458,7 +1449,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1475,7 +1465,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1492,7 +1481,6 @@"os": ["linux"],- "peer": true,"funding": {"url": "https://opencollective.com/libvips"}@@ -1509,7 +1497,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1532,7 +1519,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1555,7 +1541,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1578,7 +1563,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1601,7 +1585,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1624,7 +1607,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1647,7 +1629,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1670,7 +1651,6 @@"os": ["linux"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1690,7 +1670,6 @@],"license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT","optional": true,- "peer": true,"dependencies": {"@emnapi/runtime": "^1.7.0"},@@ -1713,7 +1692,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1733,7 +1711,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -1753,7 +1730,6 @@"os": ["win32"],- "peer": true,"engines": {"node": "^18.17.0 || ^20.3.0 || >=21.0.0"},@@ -4269,6 +4245,33 @@"tailwindcss": ">=3.0.0 || insiders || >=4.0.0-alpha.20 || >=4.0.0-beta.1"}},+ "node_modules/@tanstack/react-virtual": {+ "version": "3.14.3",+ "resolved": "https://registry.npmjs.org/@tanstack/react-virtual/-/react-virtual-3.14.3.tgz",+ "integrity": "sha512-k/cnHPVaOfn46hSbiY6n4Dzf4QjCGWSF40zR5QIIYUqPAjpA6TN7InfYmcMiDVQGP2iUn9xsRbAl8u1v3UmeVQ==",+ "license": "MIT",+ "dependencies": {+ "@tanstack/virtual-core": "3.17.1"+ },+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ },+ "peerDependencies": {+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",+ "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"+ }+ },+ "node_modules/@tanstack/virtual-core": {+ "version": "3.17.1",+ "resolved": "https://registry.npmjs.org/@tanstack/virtual-core/-/virtual-core-3.17.1.tgz",+ "integrity": "sha512-VZyW2Uiml5tmBZwPGrSD3Sz73OxzljQMCmzYHsUTPEuTsERf5xwa+uWb01xEzkz3ZSYTjj8NEb/mKHvgKxyZdA==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/tannerlinsley"+ }+ },"node_modules/@testing-library/dom": {"version": "10.4.1","resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",@@ -14478,11 +14481,13 @@"@radix-ui/react-tooltip": "^1.2.8","@repowise-dev/types": "*","@sigma/edge-curve": "^3.1.0",+ "@tanstack/react-virtual": "^3.13.12","@xyflow/react": "^12.10.2","class-variance-authority": "^0.7.1","clsx": "^2.1.1","d3-force": "^3.0.0","d3-hierarchy": "^3.1.2",+ "d3-shape": "^3.2.0","elkjs": "^0.11.1","framer-motion": "^11.11.0","fuse.js": "^7.0.0",@@ -14509,6 +14514,7 @@"devDependencies": {"@testing-library/jest-dom": "^6.5.0","@testing-library/react": "^16.0.0",+ "@types/d3-shape": "^3.1.8","@types/react": "^19.0.0","@types/react-dom": "^19.0.0","@vitejs/plugin-react": "^4.3.0",@@ -14522,7 +14528,8 @@"peerDependencies": {"next-themes": "^0.4.0","react": "^19.0.0",- "react-dom": "^19.0.0"+ "react-dom": "^19.0.0",+ "swr": "^2.2.5"}},"packages/ui/node_modules/@shikijs/core": {diff --git a/packages/ui/__tests__/coupling/coupling-table.test.tsx b/packages/ui/__tests__/coupling/coupling-table.test.tsxnew file mode 100644index 000000000..fa91e715b--- /dev/null+++ b/packages/ui/__tests__/coupling/coupling-table.test.tsx@@ -0,0 +1,55 @@+import { describe, it, expect, vi } from "vitest";+import { render, screen, fireEvent } from "@testing-library/react";+import type { CouplingEdge } from "@repowise-dev/types/coupling";+import { CouplingTable } from "../../src/coupling/coupling-table.js";++function edge(+ s: string,+ t: string,+ strength = 3,+ last: string | null = "2026-06-01",+): CouplingEdge {+ return { source: s, target: t, strength, last_co_change: last };+}++describe("CouplingTable (virtualized)", () => {+ it("renders a row per coupling with the file basenames", () => {+ const edges = [edge("api/a.py", "core/b.py", 4), edge("core/c.py", "ui/d.py", 1)];+ render(<CouplingTable edges={edges} />);+ expect(screen.getByText("a.py")).toBeInTheDocument();+ expect(screen.getByText("↔ b.py")).toBeInTheDocument();+ expect(screen.getByText("c.py")).toBeInTheDocument();+ expect(screen.getByText("↔ d.py")).toBeInTheDocument();+ });++ it("shows the strength value cell", () => {+ render(<CouplingTable edges={[edge("a.py", "b.py", 7)]} />);+ expect(screen.getByText("7")).toBeInTheDocument();+ });++ it("toggles focus on row click", () => {+ let focus: string | null = null;+ render(+ <CouplingTable+ edges={[edge("a.py", "b.py", 4)]}+ focusedPath={focus}+ onFocusChange={(p) => (focus = p)}+ />,+ );+ fireEvent.click(screen.getByText("a.py"));+ expect(focus).toBe("a.py");+ });++ it("shows the empty state when there are no couplings", () => {+ render(<CouplingTable edges={[]} />);+ expect(screen.getByText(/no couplings detected/i)).toBeInTheDocument();+ });++ it("renders the AI decouple action when onGeneratePrompt is provided", () => {+ const onGenerate = vi.fn();+ render(<CouplingTable edges={[edge("a.py", "b.py")]} onGeneratePrompt={onGenerate} />);+ const btn = screen.getByRole("button", { name: /ai decouple prompt/i });+ fireEvent.click(btn);+ expect(onGenerate).toHaveBeenCalledTimes(1);+ });+});diff --git a/packages/ui/__tests__/files/file-health-tab.test.tsx b/packages/ui/__tests__/files/file-health-tab.test.tsxnew file mode 100644index 000000000..829e812f0--- /dev/null+++ b/packages/ui/__tests__/files/file-health-tab.test.tsx@@ -0,0 +1,95 @@+import { describe, it, expect } from "vitest";+import { render, screen } from "@testing-library/react";+import { FileHealthTab } from "../../src/files/file-health-tab.js";+import type {+ FileDetailHealth,+ FileHealthFinding,+ FunctionBlameRow,+} from "@repowise-dev/types/files";++function makeFinding(i: number): FileHealthFinding {+ return {+ id: `f${i}`,+ file_path: "src/app.ts",+ biomarker_type: "long_function",+ severity: "warning",+ function_name: `fn_${i}`,+ line_start: 10 + i,+ line_end: 40 + i,+ health_impact: 1.25,+ reason: `Finding reason ${i}`,+ details: {},+ status: "open",+ };+}++function makeBlame(i: number): FunctionBlameRow {+ return {+ symbol_id: `sym${i}`,+ function_name: `func_${i}`,+ start_line: 100 + i,+ end_line: 120 + i,+ line_count: 20,+ mod_count: 5 + i,+ recent_mod_count: i,+ median_author_time: i % 2 === 0 ? Math.floor(Date.now() / 1000) - 86400 * 3 : null,+ owner_name: `Owner ${i}`,+ owner_email: `owner${i}@example.com`,+ owner_line_pct: 0.5,+ };+}++function makeHealth(findings: FileHealthFinding[]): FileDetailHealth {+ return {+ metric: null,+ breakdown: null,+ findings,+ trend: null,+ signals: null,+ };+}++describe("FileHealthTab", () => {+ it("renders every finding card and blame row for a small dataset", () => {+ const findings = Array.from({ length: 5 }, (_, i) => makeFinding(i));+ const blame = Array.from({ length: 6 }, (_, i) => makeBlame(i));+ render(<FileHealthTab health={makeHealth(findings)} functionBlame={blame} />);++ for (let i = 0; i < 5; i++) {+ expect(screen.getByText(`Finding reason ${i}`)).toBeTruthy();+ }+ for (let i = 0; i < 6; i++) {+ expect(screen.getByText(`func_${i}`)).toBeTruthy();+ expect(screen.getByText(`Owner ${i}`)).toBeTruthy();+ }+ });++ it("renders the median-age cell from hoisted compute and the blame header", () => {+ const blame = [makeBlame(0)]; // even index => has author time => age in days+ // One finding so the component renders past the no-data empty state and+ // shows the blame table whose median-age cell comes from the hoisted compute.+ render(<FileHealthTab health={makeHealth([makeFinding(0)])} functionBlame={blame} />);++ expect(screen.getByText("Function")).toBeTruthy();+ expect(screen.getByText("Median age")).toBeTruthy();+ expect(screen.getByText("3d")).toBeTruthy(); // 3 days old+ });++ it("shows finding status buttons when a change handler is provided", () => {+ const findings = [makeFinding(0)];+ render(+ <FileHealthTab+ health={makeHealth(findings)}+ functionBlame={[]}+ onFindingStatusChange={() => {}}+ />,+ );+ expect(screen.getByText("Acknowledged")).toBeTruthy();+ expect(screen.getByText("Resolved")).toBeTruthy();+ });++ it("renders an empty state when there is no metric and no findings", () => {+ render(<FileHealthTab health={makeHealth([])} functionBlame={[]} />);+ expect(screen.getByText("No health data")).toBeTruthy();+ });+});diff --git a/packages/ui/__tests__/git/hotspot-table.test.tsx b/packages/ui/__tests__/git/hotspot-table.test.tsxnew file mode 100644index 000000000..11752cbc4--- /dev/null+++ b/packages/ui/__tests__/git/hotspot-table.test.tsx@@ -0,0 +1,76 @@+import { describe, it, expect } from "vitest";+import { render, screen, fireEvent } from "@testing-library/react";+import { HotspotTable } from "../../src/git/hotspot-table.js";+import type { Hotspot } from "@repowise-dev/types/git";++const hotspot = (overrides: Partial<Hotspot> = {}): Hotspot => ({+ file_path: "src/foo.ts",+ commit_count_90d: 12,+ commit_count_30d: 3,+ churn_percentile: 80,+ temporal_hotspot_score: 4.2,+ primary_owner: "Ada",+ is_hotspot: true,+ is_stable: false,+ bus_factor: 1,+ contributor_count: 2,+ lines_added_90d: 100,+ lines_deleted_90d: 40,+ avg_commit_size: 50,+ commit_categories: {},+ ...overrides,+});++// Small dataset (< 60 rows) so the shared virtualizer renders every row+// unwindowed — assertions stay deterministic under jsdom.+const rows: Hotspot[] = Array.from({ length: 10 }, (_, i) =>+ hotspot({+ file_path: `src/file-${i}.ts`,+ commit_count_90d: 20 - i,+ is_hotspot: i % 2 === 0,+ bus_factor: i % 3,+ }),+);++describe("HotspotTable virtualization", () => {+ it("renders every row in a small dataset", () => {+ render(<HotspotTable hotspots={rows} />);+ for (const h of rows) {+ expect(screen.getByText(h.file_path)).toBeInTheDocument();+ }+ });++ it("memoized filter chips show correct counts", () => {+ render(<HotspotTable hotspots={rows} />);+ // All = 10, Hot = 5 (even indices). The filter chips are <button>s whose+ // accessible name folds in the count span ("All (10)", "Hot (5)").+ expect(screen.getByRole("button", { name: /^All \(10\)$/ })).toBeInTheDocument();+ expect(screen.getByRole("button", { name: /^Hot \(5\)$/ })).toBeInTheDocument();+ });++ it("expands a row to reveal its detail content", () => {+ render(+ <HotspotTable+ hotspots={rows}+ renderExpandedRow={(h) => <div>detail for {h.file_path}</div>}+ />,+ );+ expect(screen.queryByText("detail for src/file-0.ts")).not.toBeInTheDocument();+ const toggle = screen.getAllByRole("button", { name: "Expand symbols" })[0]!;+ fireEvent.click(toggle);+ expect(screen.getByText("detail for src/file-0.ts")).toBeInTheDocument();+ });++ it("filters rows by the active filter chip", () => {+ render(<HotspotTable hotspots={rows} />);+ fireEvent.click(screen.getByRole("button", { name: /^Hot \(5\)$/ }));+ // Only the 5 hot files (even indices) should remain.+ expect(screen.getByText("src/file-0.ts")).toBeInTheDocument();+ expect(screen.queryByText("src/file-1.ts")).not.toBeInTheDocument();+ });++ it("renders the empty state when there are no hotspots", () => {+ render(<HotspotTable hotspots={[]} />);+ expect(screen.getByText("No hotspots found")).toBeInTheDocument();+ });+});diff --git a/packages/ui/__tests__/shared/virtualized-table.test.tsx b/packages/ui/__tests__/shared/virtualized-table.test.tsxnew file mode 100644index 000000000..77731c65c--- /dev/null+++ b/packages/ui/__tests__/shared/virtualized-table.test.tsx@@ -0,0 +1,71 @@+import { describe, it, expect } from "vitest";+import { render, screen, renderHook } from "@testing-library/react";+import { VirtualizedTable } from "../../src/shared/virtualized-table/virtualized-table.js";+import { useVirtualRows } from "../../src/shared/virtualized-table/use-virtual-rows.js";++interface Row {+ id: string;+ name: string;+}++function makeRows(n: number): Row[] {+ return Array.from({ length: n }, (_, i) => ({ id: `r${i}`, name: `row-${i}` }));+}++function renderTable(rows: Row[]) {+ return render(+ <VirtualizedTable+ rows={rows}+ rowKey={(r) => r.id}+ header={+ <tr>+ <th>Name</th>+ </tr>+ }+ renderRow={(r) => (+ <tr>+ <td>{r.name}</td>+ </tr>+ )}+ empty={<div>No rows</div>}+ />,+ );+}++describe("VirtualizedTable", () => {+ it("renders the header and every row below the windowing threshold", () => {+ renderTable(makeRows(5));+ expect(screen.getByText("Name")).toBeTruthy();+ for (let i = 0; i < 5; i++) {+ expect(screen.getByText(`row-${i}`)).toBeTruthy();+ }+ });++ it("renders the empty slot when there are no rows", () => {+ renderTable([]);+ expect(screen.getByText("No rows")).toBeTruthy();+ });+});++describe("useVirtualRows", () => {+ it("returns every row with no padding below the threshold", () => {+ const { result } = renderHook(() =>+ useVirtualRows({ count: 10, estimateSize: 40, threshold: 60 }),+ );+ expect(result.current.isVirtualized).toBe(false);+ expect(result.current.virtualRows).toHaveLength(10);+ expect(result.current.virtualRows[0]).toEqual({ index: 0, start: 0, size: 40 });+ expect(result.current.virtualRows[9]?.start).toBe(360); // 9 * 40+ expect(result.current.paddingTop).toBe(0);+ expect(result.current.paddingBottom).toBe(0);+ });++ it("activates windowing above the threshold", () => {+ const { result } = renderHook(() =>+ useVirtualRows({ count: 500, estimateSize: 40, threshold: 60 }),+ );+ expect(result.current.isVirtualized).toBe(true);+ // Windowed: far fewer rows rendered than the full 500.+ expect(result.current.virtualRows.length).toBeLessThan(500);+ });+});diff --git a/packages/ui/__tests__/symbols/symbol-table.test.tsx b/packages/ui/__tests__/symbols/symbol-table.test.tsxindex c56d124f8..9ef4abb14 100644--- a/packages/ui/__tests__/symbols/symbol-table.test.tsx+++ b/packages/ui/__tests__/symbols/symbol-table.test.tsx@@ -71,4 +71,41 @@ describe("SymbolTable", () => {// ResultsFooter renders "Showing 2 of 2 symbols"expect(screen.getByText(/Showing/)).toBeTruthy();});++ it("windows rows through VirtualizedTable while keeping the footer outside the scroll area", () => {+ // A small (sub-threshold) dataset so every row renders and assertions stay+ // deterministic — the windowing wrapper renders all rows below its threshold.+ const items = Array.from({ length: 30 }, (_, i) =>+ sym({ id: `s${i}`, name: `sym_${i}`, file_path: `src/file_${i}.ts` }),+ );+ const { container } = render(+ <SymbolTable+ items={items}+ isLoading={false}+ isValidating={false}+ hasMore={true}+ total={5000}+ filters={defaultFilters}+ onFiltersChange={vi.fn()}+ onLoadMore={vi.fn()}+ onSelect={vi.fn()}+ />,+ );++ // Every loaded row is present (sub-threshold ⇒ no off-screen omission).+ expect(screen.getByText("sym_0")).toBeTruthy();+ expect(screen.getByText("sym_29")).toBeTruthy();++ // The pagination footer reports the authoritative total and lives outside+ // the virtualized scroll container (so it stays visible as rows scroll).+ const scroller = container.querySelector(".overflow-x-auto");+ expect(scroller).not.toBeNull();+ // ResultsFooter renders the total via toLocaleString ("5,000") in its own node.+ const totalNode = screen.getByText("5,000");+ expect(totalNode).toBeTruthy();+ expect(scroller?.contains(totalNode)).toBe(false);+ // The "Load more" affordance also lives in the footer, outside the scroller.+ const loadMore = screen.getByRole("button", { name: "Load more" });+ expect(scroller?.contains(loadMore)).toBe(false);+ });});diff --git a/packages/ui/package.json b/packages/ui/package.jsonindex 08c4a9c50..65b5ae3e9 100644--- a/packages/ui/package.json+++ b/packages/ui/package.json@@ -87,6 +87,7 @@"./shared": "./src/shared/index.ts","./shared/entity": "./src/shared/entity/index.ts","./shared/responsive-table": "./src/shared/responsive-table/index.ts",+ "./shared/virtualized-table": "./src/shared/virtualized-table/index.ts","./shared/context-drawer": "./src/shared/context-drawer/index.ts","./shared/file-card": "./src/shared/file-card/index.ts","./shared/related": "./src/shared/related/index.ts",@@ -124,6 +125,7 @@"@radix-ui/react-tooltip": "^1.2.8","@repowise-dev/types": "*","@sigma/edge-curve": "^3.1.0",+ "@tanstack/react-virtual": "^3.13.12","@xyflow/react": "^12.10.2","class-variance-authority": "^0.7.1","clsx": "^2.1.1",diff --git a/packages/ui/src/coupling/coupling-graph.tsx b/packages/ui/src/coupling/coupling-graph.tsxindex 78c8821cb..a074e6bed 100644--- a/packages/ui/src/coupling/coupling-graph.tsx+++ b/packages/ui/src/coupling/coupling-graph.tsx@@ -35,6 +35,9 @@ function inkFor(score: number | null): string {return score == null ? NEUTRAL_INK : BAND_INK[bandForScore(score)];}+/** Shared empty neighbor set so the no-focus path allocates nothing. */+const EMPTY_SET: ReadonlySet<string> = new Set<string>();+/** A leaf in the radial cluster: a file, plus its layout angle/radius. */interface TreeDatum {name: string; // path segment (display)@@ -132,6 +135,17 @@ export function CouplingGraph({const leafByPath = new Map<string, HierarchyNode<TreeDatum>>();for (const leaf of leaves) if (leaf.data.path) leafByPath.set(leaf.data.path, leaf);+ // O(1) lookups for the render/hover paths: file_path -> node, and a+ // symmetric adjacency map built once from the edge list. These replace the+ // former O(N) `nodes.find(...)` per edge and the O(E) per-focus rescan.+ const nodeByPath = new Map<string, CouplingNode>();+ for (const n of nodes) nodeByPath.set(n.file_path, n);+ const adjacency = new Map<string, Set<string>>();+ for (const e of edges) {+ (adjacency.get(e.source) ?? adjacency.set(e.source, new Set()).get(e.source)!).add(e.target);+ (adjacency.get(e.target) ?? adjacency.set(e.target, new Set()).get(e.target)!).add(e.source);+ }+const line = lineRadial<HierarchyNode<TreeDatum>>().curve(curveBundle.beta(0.82)).radius((d) => d.y!)@@ -169,7 +183,18 @@ export function CouplingGraph({}}- return { radius, leaves, leafByPath, drawn, degree, maxNloc, maxStrength, groups };+ return {+ radius,+ leaves,+ leafByPath,+ nodeByPath,+ adjacency,+ drawn,+ degree,+ maxNloc,+ maxStrength,+ groups,+ };}, [nodes, edges, size]);if (!layout) {@@ -184,7 +209,8 @@ export function CouplingGraph({);}- const { radius, leaves, drawn, degree, maxNloc, maxStrength, groups } = layout;+ const { radius, leaves, nodeByPath, adjacency, drawn, degree, maxNloc, maxStrength, groups } =+ layout;const c = size / 2;// Top-degree hubs are always labelled; the rest reveal on hover. This replaces@@ -214,14 +240,9 @@ export function CouplingGraph({return base;};- // Neighbors of the focused file (for dimming + dot emphasis).- const neighbors = new Set<string>();- if (focus) {- for (const e of edges) {- if (e.source === focus) neighbors.add(e.target);- if (e.target === focus) neighbors.add(e.source);- }- }+ // Neighbors of the focused file (for dimming + dot emphasis). O(1) lookup+ // into the precomputed adjacency map instead of an O(E) rescan per focus.+ const neighbors = (focus ? adjacency.get(focus) : undefined) ?? EMPTY_SET;const dotR = (n: CouplingNode) =>2 + Math.sqrt(n.nloc / maxNloc) * 2.4 + Math.min((degree.get(n.file_path) ?? 0) / 6, 2.6);@@ -280,9 +301,7 @@ export function CouplingGraph({const incident = focus === edge.source || focus === edge.target;const dim = focus != null && !incident;const partnerPath = focus === edge.source ? edge.target : edge.source;- const partnerNode = incident- ? nodes.find((n) => n.file_path === partnerPath)- : undefined;+ const partnerNode = incident ? nodeByPath.get(partnerPath) : undefined;const strengthFrac = edge.strength / maxStrength;const stroke = incident ? inkFor(partnerNode?.score ?? null) : NEUTRAL_INK;return (diff --git a/packages/ui/src/coupling/coupling-table.tsx b/packages/ui/src/coupling/coupling-table.tsxindex 381ac701a..bed1d4a71 100644--- a/packages/ui/src/coupling/coupling-table.tsx+++ b/packages/ui/src/coupling/coupling-table.tsx@@ -1,10 +1,8 @@"use client";+import { useMemo } from "react";import { EmptyState } from "../shared/empty-state";-import {- ResponsiveTable,- type ResponsiveColumn,-} from "../shared/responsive-table";+import { VirtualizedTable } from "../shared/virtualized-table";import { AiPromptButton } from "../health/ai-prompt-button";import type { CouplingEdge } from "@repowise-dev/types/coupling";@@ -21,13 +19,26 @@ function basename(path: string): string {return path.split("/").pop() ?? path;}+// Column-priority hide classes, mirroring the shared ResponsiveTable scale:+// priority 2 hides below md (768px), priority 3 hides below lg (1024px). The+// "pair" identity column (priority 1) is always visible.+const HIDE_BELOW_MD = "max-md:hidden";+const HIDE_BELOW_LG = "max-lg:hidden";+/*** The precise, sortable companion to the coupling diagram: one row per* coupling, strongest first. Clicking a row focuses that file in the ring;* rows touching the focused file are emphasized.+ *+ * The body is virtualized (windowed `<tbody>`) so long coupling lists stay+ * cheap to render; below the wrapper's threshold every row renders, so the+ * common short list behaves exactly as a plain table.*/export function CouplingTable({ edges, focusedPath, onFocusChange, onGeneratePrompt }: CouplingTableProps) {- const maxStrength = Math.max(...edges.map((e) => e.strength), 1);+ // The strength bars are normalized to the strongest coupling; recompute only+ // when the edge list changes rather than on every render.+ const maxStrength = useMemo(() => Math.max(...edges.map((e) => e.strength), 1), [edges]);+const incident = (e: CouplingEdge) =>focusedPath != null && (e.source === focusedPath || e.target === focusedPath);@@ -46,92 +57,91 @@ export function CouplingTable({ edges, focusedPath, onFocusChange, onGeneratePro);};- const columns: ResponsiveColumn<CouplingEdge>[] = [- {- key: "pair",- header: "Coupled files",- priority: 1,- cellClassName: "min-w-[200px]",- render: (e) => (- <div className="flex flex-col gap-0.5">- {fileCell(e.source, e)}- {fileCell(e.target, e, "↔ ")}- </div>- ),- },- {- key: "strength",- header: (+ if (edges.length === 0) {+ return (+ <EmptyState+ title="No couplings detected"+ description="No files in this repository have a history of changing together yet."+ />+ );+ }++ const header = (+ <tr className="bg-[var(--color-bg-elevated)] text-[var(--color-text-tertiary)] text-xs uppercase tracking-wider">+ <th className="px-3 py-2 text-left font-medium whitespace-nowrap min-w-[200px]">+ Coupled files+ </th>+ <th className={`px-3 py-2 text-left font-medium whitespace-nowrap w-36 ${HIDE_BELOW_MD}`}><spantitle="Recency-weighted count of commits that touched both files. Higher means more or more-recent shared changes. It is not a percentage or a verified dependency."className="cursor-help underline decoration-dotted underline-offset-2">Strength</span>- ),- mobileLabel: "Strength",- priority: 2,- headerClassName: "w-36",- render: (e) => (- <div className="flex items-center gap-2 min-w-[100px]">- <div className="h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--color-bg-inset)]">- <div- className="h-full rounded-full bg-[var(--color-accent-primary)]"- style={{ width: `${Math.max(6, Math.round((e.strength / maxStrength) * 100))}%` }}- />+ </th>+ <th className={`px-3 py-2 text-left font-medium whitespace-nowrap ${HIDE_BELOW_LG}`}>Last</th>+ {onGeneratePrompt ? (+ <th className={`px-3 py-2 text-left font-medium whitespace-nowrap w-10 ${HIDE_BELOW_LG}`} />+ ) : null}+ </tr>+ );++ const renderRow = (e: CouplingEdge) => {+ const onClick = onFocusChange+ ? () => onFocusChange(focusedPath === e.source ? null : e.source)+ : undefined;+ const isSelected = focusedPath != null && focusedPath === e.source;+ return (+ <tr+ className={`border-t border-[var(--color-border-default)] hover:bg-[var(--color-bg-elevated)] ${+ isSelected ? "bg-[var(--color-accent-muted)]/30 " : ""+ }${onClick ? "cursor-pointer" : ""}`}+ onClick={onClick}+ >+ <td className="px-3 py-2 text-left min-w-[200px]">+ <div className="flex flex-col gap-0.5">+ {fileCell(e.source, e)}+ {fileCell(e.target, e, "↔ ")}</div>- <span className="w-8 text-right text-xs tabular-nums text-[var(--color-text-tertiary)]">- {e.strength}- </span>- </div>- ),- mobileRender: (e) => e.strength,- },- {- key: "last",- header: "Last",- priority: 3,- cellClassName: "text-xs text-[var(--color-text-tertiary)]",- render: (e) => (- <span title={e.last_co_change ? new Date(e.last_co_change).toLocaleString() : undefined}>- {e.last_co_change ? new Date(e.last_co_change).toLocaleDateString() : "—"}- </span>- ),- },- ...(onGeneratePrompt- ? [- {- key: "ai",- header: "",- priority: 3,- headerClassName: "w-10",- render: (e: CouplingEdge) => (- <AiPromptButton- variant="icon"- label="AI decouple prompt"- onClick={() => onGeneratePrompt(e)}+ </td>+ <td className={`px-3 py-2 text-left ${HIDE_BELOW_MD}`}>+ <div className="flex items-center gap-2 min-w-[100px]">+ <div className="h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--color-bg-inset)]">+ <div+ className="h-full rounded-full bg-[var(--color-accent-primary)]"+ style={{ width: `${Math.max(6, Math.round((e.strength / maxStrength) * 100))}%` }}/>- ),- } as ResponsiveColumn<CouplingEdge>,- ]- : []),- ];+ </div>+ <span className="w-8 text-right text-xs tabular-nums text-[var(--color-text-tertiary)]">+ {e.strength}+ </span>+ </div>+ </td>+ <td className={`px-3 py-2 text-left text-xs text-[var(--color-text-tertiary)] ${HIDE_BELOW_LG}`}>+ <span title={e.last_co_change ? new Date(e.last_co_change).toLocaleString() : undefined}>+ {e.last_co_change ? new Date(e.last_co_change).toLocaleDateString() : "—"}+ </span>+ </td>+ {onGeneratePrompt ? (+ <td className={`px-3 py-2 text-left w-10 ${HIDE_BELOW_LG}`}>+ <AiPromptButton+ variant="icon"+ label="AI decouple prompt"+ onClick={() => onGeneratePrompt(e)}+ />+ </td>+ ) : null}+ </tr>+ );+ };return (- <ResponsiveTable- columns={columns}+ <VirtualizedTable<CouplingEdge>rows={edges}rowKey={(e) => `${e.source}|${e.target}`}- bare- onRowClick={- onFocusChange ? (e) => onFocusChange(focusedPath === e.source ? null : e.source) : undefined- }- empty={- <EmptyState- title="No couplings detected"- description="No files in this repository have a history of changing together yet."- />- }+ header={header}+ renderRow={renderRow}+ aria-label="Change-coupling pairs"/>);}diff --git a/packages/ui/src/coverage/freshness-table.tsx b/packages/ui/src/coverage/freshness-table.tsxindex 36f713cb4..0b903f715 100644--- a/packages/ui/src/coverage/freshness-table.tsx+++ b/packages/ui/src/coverage/freshness-table.tsx@@ -1,8 +1,9 @@"use client";-import { useState } from "react";+import { useMemo, useState } from "react";import { Button } from "../ui/button";import { EmptyState } from "../shared/empty-state";+import { VirtualizedTable } from "../shared/virtualized-table";import { cn } from "../lib/cn";import {statusBadgeClasses,@@ -33,10 +34,30 @@ export function FreshnessTable({ pages, onRegenerate }: FreshnessTableProps) {const [filter, setFilter] = useState<Filter>("all");const [regenerating, setRegenerating] = useState<Set<string>>(new Set());- const filtered =- filter === "all"- ? pages- : pages.filter((p) => p.freshness_status === filter);+ // The filter is a set of discrete status toggle buttons, not a free-text+ // search input, so there are no rapid keystroke updates to debounce — each+ // click is a single discrete state change. We only need to memoize the+ // derived data so the four count scans and the filter scan don't re-run on+ // unrelated re-renders (e.g. per-row regenerate state changes).+ const counts = useMemo<Record<Filter, number>>(() => {+ let fresh = 0;+ let stale = 0;+ let outdated = 0;+ for (const p of pages) {+ if (p.freshness_status === "fresh") fresh += 1;+ else if (p.freshness_status === "stale") stale += 1;+ else if (p.freshness_status === "outdated") outdated += 1;+ }+ return { all: pages.length, fresh, stale, outdated };+ }, [pages]);++ const filtered = useMemo(+ () =>+ filter === "all"+ ? pages+ : pages.filter((p) => p.freshness_status === filter),+ [pages, filter],+ );const handleRegenerate = async (pageId: string) => {if (!onRegenerate) return;@@ -56,10 +77,7 @@ export function FreshnessTable({ pages, onRegenerate }: FreshnessTableProps) {<div className="space-y-4"><div role="tablist" aria-label="Freshness filter" className="flex items-center gap-1">{(["all", "fresh", "stale", "outdated"] as Filter[]).map((f) => {- const count =- f === "all"- ? pages.length- : pages.filter((p) => p.freshness_status === f).length;+ const count = counts[f];return (<buttonkey={f}@@ -83,99 +101,100 @@ export function FreshnessTable({ pages, onRegenerate }: FreshnessTableProps) {{filtered.length === 0 ? (<EmptyState title="No pages" description="No pages match this filter." />) : (- <div className="border border-[var(--color-border-default)] overflow-hidden overflow-x-auto">- <table className="w-full text-sm">- <caption className="sr-only">Documentation freshness</caption>- <thead className="sticky top-0 z-10 bg-[var(--color-bg-surface)]">- <tr className="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]">- <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">- Page- </th>- <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-24">- Status- </th>- <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-24">- Confidence- </th>- <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden md:table-cell">- Model- </th>- <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-28 hidden md:table-cell">- Updated- </th>- <th scope="col" className="px-4 py-2.5 w-24">- <span className="sr-only">Action</span>- </th>- </tr>- </thead>- <tbody>- {filtered.map((page) => {- const status = page.freshness_status as FreshnessStatus;- return (- <tr- key={page.id}- className="group border-b border-[var(--color-table-divider)] hover:bg-[var(--color-bg-elevated)] transition-colors last:border-0"+ <VirtualizedTable<DocPage>+ rows={filtered}+ rowKey={(page) => page.id}+ estimateRowHeight={56}+ aria-label="Documentation freshness"+ className="border border-[var(--color-border-default)]"+ tableClassName="w-full text-sm"+ headerClassName="bg-[var(--color-bg-surface)]"+ header={+ <tr className="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]">+ <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">+ Page+ </th>+ <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-24">+ Status+ </th>+ <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-24">+ Confidence+ </th>+ <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden md:table-cell">+ Model+ </th>+ <th scope="col" className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-28 hidden md:table-cell">+ Updated+ </th>+ <th scope="col" className="px-4 py-2.5 w-24">+ <span className="sr-only">Action</span>+ </th>+ </tr>+ }+ renderRow={(page) => {+ const status = page.freshness_status as FreshnessStatus;+ return (+ <tr+ className="group border-b border-[var(--color-table-divider)] hover:bg-[var(--color-bg-elevated)] transition-colors last:border-0"+ >+ <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-primary)] min-w-[220px] max-w-[480px]">+ <div className="truncate group-hover:underline underline-offset-2" title={page.target_path}>{page.target_path}</div>+ {(() => { const TypeIcon = getPageTypeIcon(page.page_type); return (+ <div className="flex items-center gap-1 truncate text-[var(--color-text-tertiary)]" title={page.page_type}>+ <TypeIcon className="h-3 w-3 shrink-0" />+ <span>{getPageTypeLabel(page.page_type)}</span>+ </div>+ ); })()}+ </td>+ <td className="px-4 py-2.5">+ <span+ className={cn(+ "inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium",+ statusBadgeClasses(status),+ )}+ >+ {statusLabel(status)}+ </span>+ </td>+ <td className="px-4 py-2.5 text-xs tabular-nums">+ <span+ className={cn(+ page.confidence >= 0.8+ ? "text-[var(--color-success)]"+ : page.confidence >= 0.6+ ? "text-[var(--color-warning)]"+ : "text-[var(--color-error)]",+ )}>- <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-primary)] min-w-[220px] max-w-[480px]">- <div className="truncate group-hover:underline underline-offset-2" title={page.target_path}>{page.target_path}</div>- {(() => { const TypeIcon = getPageTypeIcon(page.page_type); return (- <div className="flex items-center gap-1 truncate text-[var(--color-text-tertiary)]" title={page.page_type}>- <TypeIcon className="h-3 w-3 shrink-0" />- <span>{getPageTypeLabel(page.page_type)}</span>- </div>- ); })()}- </td>- <td className="px-4 py-2.5">- <span- className={cn(- "inline-flex items-center rounded border px-2 py-0.5 text-xs font-medium",- statusBadgeClasses(status),- )}- >- {statusLabel(status)}- </span>- </td>- <td className="px-4 py-2.5 text-xs tabular-nums">- <span- className={cn(- page.confidence >= 0.8- ? "text-[var(--color-success)]"- : page.confidence >= 0.6- ? "text-[var(--color-warning)]"- : "text-[var(--color-error)]",- )}- >- {formatConfidence(page.confidence)}- </span>- </td>- <td className="px-4 py-2.5 text-xs text-[var(--color-text-tertiary)] max-w-[200px] hidden md:table-cell">- <span className="block truncate" title={page.model_name}>{page.model_name}</span>- </td>- <td- className="px-4 py-2.5 text-xs text-[var(--color-text-tertiary)] hidden md:table-cell"- title={new Date(page.updated_at).toLocaleString()}+ {formatConfidence(page.confidence)}+ </span>+ </td>+ <td className="px-4 py-2.5 text-xs text-[var(--color-text-tertiary)] max-w-[200px] hidden md:table-cell">+ <span className="block truncate" title={page.model_name}>{page.model_name}</span>+ </td>+ <td+ className="px-4 py-2.5 text-xs text-[var(--color-text-tertiary)] hidden md:table-cell"+ title={new Date(page.updated_at).toLocaleString()}+ >+ {formatRelativeTime(page.updated_at)}+ </td>+ <td className="px-4 py-2.5">+ {onRegenerate && (+ <Button+ size="sm"+ variant="ghost"+ disabled={regenerating.has(page.id)}+ onClick={() => handleRegenerate(page.id)}+ className="h-6 px-2 text-xs">- {formatRelativeTime(page.updated_at)}- </td>- <td className="px-4 py-2.5">- {onRegenerate && (- <Button- size="sm"- variant="ghost"- disabled={regenerating.has(page.id)}- onClick={() => handleRegenerate(page.id)}- className="h-6 px-2 text-xs"- >- {regenerating.has(page.id) ? "…" : "Regenerate"}- </Button>- )}- </td>- </tr>- );- })}- </tbody>- </table>- </div>+ {regenerating.has(page.id) ? "…" : "Regenerate"}+ </Button>+ )}+ </td>+ </tr>+ );+ }}+ />)}</div>);diff --git a/packages/ui/src/files/file-health-tab.tsx b/packages/ui/src/files/file-health-tab.tsxindex b4a4ee0c6..2ae305338 100644--- a/packages/ui/src/files/file-health-tab.tsx+++ b/packages/ui/src/files/file-health-tab.tsx@@ -1,8 +1,9 @@"use client";-import { useState } from "react";+import { useMemo, useState, type ReactNode } from "react";import { HeartPulse } from "lucide-react";import { EmptyState } from "../shared/empty-state";+import { VirtualizedTable, useVirtualRows } from "../shared/virtualized-table";import { ScoreBreakdown, type ScoreBreakdownCategory } from "../health/score-breakdown";import { BiomarkerDetails, type BiomarkerDetailsRecord } from "../health/biomarker-details";import {@@ -41,6 +42,11 @@ interface FileHealthTabProps {symbolHref?: ((symbolId: string) => string) | undefined;}+/** Collapsed finding-card height guess; cards expand and are measured live. */+const FINDING_CARD_ESTIMATE = 120;+/** Blame table row height (compact `py-1.5` rows). */+const BLAME_ROW_ESTIMATE = 32;+function medianAgeDays(medianAuthorTime: number | null): number | null {if (!medianAuthorTime) return null;return Math.max(0, Math.round((Date.now() / 1000 - medianAuthorTime) / 86400));@@ -57,6 +63,30 @@ export function FileHealthTab({const [savingId, setSavingId] = useState<string | null>(null);const { metric, breakdown, findings, trend, signals } = health;+ // Window the findings card list. Cards expand, so this is variable-height —+ // FINDING_CARD_ESTIMATE is the collapsed-card guess; real heights are measured.+ const findingsVirtual = useVirtualRows<HTMLUListElement>({+ count: findings.length,+ estimateSize: FINDING_CARD_ESTIMATE,+ });++ // Hoist medianAgeDays + the row-name JSX out of the blame render loop so they+ // run once per dataset change instead of on every render.+ const blameRows = useMemo(+ () =>+ functionBlame.map((row) => ({+ row,+ age: medianAgeDays(row.median_author_time),+ name: (+ <span className="font-mono">+ {row.function_name}+ <span className="text-[var(--color-text-tertiary)]">:{row.start_line}</span>+ </span>+ ) as ReactNode,+ })),+ [functionBlame],+ );+if (!metric && findings.length === 0) {return (<EmptyState@@ -141,13 +171,24 @@ export function FileHealthTab({<h3 className="text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">Findings ({findings.length})</h3>- <ul className="space-y-2">- {findings.map((f) => {+ <ul+ ref={findingsVirtual.scrollRef}+ className="space-y-2 overflow-auto"+ style={{ maxHeight: 600 }}+ >+ {findingsVirtual.paddingTop > 0 && (+ <li aria-hidden style={{ height: findingsVirtual.paddingTop }} />+ )}+ {findingsVirtual.virtualRows.map((vr) => {+ const f = findings[vr.index];+ if (f === undefined) return null;const info = biomarkerInfo(f.biomarker_type);const status = statusOverride[f.id] ?? (f.status as FindingStatus) ?? "open";return (<likey={f.id}+ ref={findingsVirtual.measureElement}+ data-index={vr.index}className="rounded-md border border-[var(--color-border-default)] bg-[var(--color-bg-surface)] p-3 space-y-1"><div className="flex items-center gap-2 flex-wrap">@@ -201,6 +242,9 @@ export function FileHealthTab({</li>);})}+ {findingsVirtual.paddingBottom > 0 && (+ <li aria-hidden style={{ height: findingsVirtual.paddingBottom }} />+ )}</ul></section>)}@@ -210,63 +254,57 @@ export function FileHealthTab({<h3 className="text-xs font-medium uppercase tracking-wider text-[var(--color-text-tertiary)]">Functions by churn</h3>- <div className="overflow-x-auto overflow-hidden border border-[var(--color-border-default)]">- <table className="w-full text-xs">- <thead className="bg-[var(--color-bg-surface)]">- <tr className="border-b border-[var(--color-border-default)] text-left text-[10px] uppercase tracking-wider text-[var(--color-text-tertiary)]">- <th className="px-3 py-2 font-medium">Function</th>- <th className="px-3 py-2 font-medium text-right">Mods</th>- <th className="px-3 py-2 font-medium text-right">Recent</th>- <th className="px-3 py-2 font-medium text-right">Median age</th>- <th className="px-3 py-2 font-medium">Owner</th>- </tr>- </thead>- <tbody>- {functionBlame.map((b) => {- const age = medianAgeDays(b.median_author_time);- const name = (- <span className="font-mono">- {b.function_name}- <span className="text-[var(--color-text-tertiary)]">:{b.start_line}</span>- </span>- );- return (- <tr- key={b.symbol_id}- className="border-b border-[var(--color-table-divider)] last:border-0 hover:bg-[var(--color-bg-elevated)]"+ <VirtualizedTable+ rows={blameRows}+ rowKey={(b) => b.row.symbol_id}+ estimateRowHeight={BLAME_ROW_ESTIMATE}+ className="overflow-x-auto overflow-hidden border border-[var(--color-border-default)]"+ tableClassName="text-xs"+ headerClassName="bg-[var(--color-bg-surface)]"+ header={+ <tr className="border-b border-[var(--color-border-default)] text-left text-[10px] uppercase tracking-wider text-[var(--color-text-tertiary)]">+ <th className="px-3 py-2 font-medium">Function</th>+ <th className="px-3 py-2 font-medium text-right">Mods</th>+ <th className="px-3 py-2 font-medium text-right">Recent</th>+ <th className="px-3 py-2 font-medium text-right">Median age</th>+ <th className="px-3 py-2 font-medium">Owner</th>+ </tr>+ }+ renderRow={({ row: b, age, name }, index, measureRef) => (+ <tr+ ref={measureRef}+ data-index={index}+ className="border-b border-[var(--color-table-divider)] last:border-0 hover:bg-[var(--color-bg-elevated)]"+ >+ <td className="px-3 py-1.5 text-[var(--color-text-primary)]">+ {symbolHref ? (+ <a+ href={symbolHref(b.symbol_id)}+ className="hover:text-[var(--color-accent-primary)] hover:underline">- <td className="px-3 py-1.5 text-[var(--color-text-primary)]">- {symbolHref ? (- <a- href={symbolHref(b.symbol_id)}- className="hover:text-[var(--color-accent-primary)] hover:underline"- >- {name}- </a>- ) : (- name- )}- </td>- <td className="px-3 py-1.5 text-right tabular-nums">{b.mod_count}</td>- <td className="px-3 py-1.5 text-right tabular-nums">{b.recent_mod_count}</td>- <td className="px-3 py-1.5 text-right tabular-nums">- {age == null ? "—" : `${age}d`}- </td>- <td className="px-3 py-1.5 text-[var(--color-text-secondary)]">- {b.owner_name ?? "—"}- {b.owner_line_pct != null && (- <span className="text-[var(--color-text-tertiary)]">- {" "}- ({Math.round(b.owner_line_pct * 100)}%)- </span>- )}- </td>- </tr>- );- })}- </tbody>- </table>- </div>+ {name}+ </a>+ ) : (+ name+ )}+ </td>+ <td className="px-3 py-1.5 text-right tabular-nums">{b.mod_count}</td>+ <td className="px-3 py-1.5 text-right tabular-nums">{b.recent_mod_count}</td>+ <td className="px-3 py-1.5 text-right tabular-nums">+ {age == null ? "—" : `${age}d`}+ </td>+ <td className="px-3 py-1.5 text-[var(--color-text-secondary)]">+ {b.owner_name ?? "—"}+ {b.owner_line_pct != null && (+ <span className="text-[var(--color-text-tertiary)]">+ {" "}+ ({Math.round(b.owner_line_pct * 100)}%)+ </span>+ )}+ </td>+ </tr>+ )}+ /></section>)}</div>diff --git a/packages/ui/src/git/hotspot-table.tsx b/packages/ui/src/git/hotspot-table.tsxindex 2940ab71f..f8283637f 100644--- a/packages/ui/src/git/hotspot-table.tsx+++ b/packages/ui/src/git/hotspot-table.tsx@@ -12,8 +12,16 @@ import { AiPromptButton } from "../health/ai-prompt-button";import { ChurnBar } from "./churn-bar";import { formatLOC } from "../lib/format";import { cn } from "../lib/cn";+import { useVirtualRows } from "../shared/virtualized-table";import type { Hotspot } from "@repowise-dev/types/git";+/**+ * Collapsed main-row height (px), used as the initial virtualization estimate.+ * Real heights — including expanded detail rows — are measured at runtime via+ * `measureElement`, so this only affects the first paint and off-screen spacers.+ */+const ESTIMATED_ROW_HEIGHT = 44;+interface HotspotTableProps {hotspots: Hotspot[];repoId?: string;@@ -137,6 +145,36 @@ export function HotspotTable({return items;}, [hotspots, search, filter, sortKey, sortDir]);+ // Memoize the filter chips' counts so the three full `hotspots` scans only+ // run when the dataset changes, not on every keystroke / sort / expand.+ const filters: { key: Filter; label: string; count: number }[] = useMemo(+ () => [+ { key: "all", label: "All", count: hotspots.length },+ { key: "hot", label: "Hot", count: hotspots.filter((h) => h.is_hotspot).length },+ { key: "risk", label: "Bus factor risk", count: hotspots.filter((h) => h.bus_factor <= 1).length },+ { key: "accelerating", label: "Accelerating", count: hotspots.filter((h) => h.commit_count_30d * 3 > h.commit_count_90d).length },+ ],+ [hotspots],+ );++ // Window the tbody rows. Rows are variable-height (an expanded row adds a+ // second <tr>), so we drive the windowing with the lower-level hook and let+ // it MEASURE real heights via `measureElement`. To capture the *combined*+ // height of a logical row (main <tr> + optional expanded <tr>) within valid+ // table semantics, each logical row is rendered as its own <tbody> — a+ // <table> may contain multiple <tbody>s — and the measured/`data-index`d+ // element is that <tbody>, so an expanded row's full height is tracked.+ const {+ scrollRef,+ virtualRows,+ paddingTop,+ paddingBottom,+ measureElement,+ } = useVirtualRows({+ count: filtered.length,+ estimateSize: ESTIMATED_ROW_HEIGHT,+ });+if (hotspots.length === 0) {return (<EmptyState@@ -146,13 +184,6 @@ export function HotspotTable({);}- const filters: { key: Filter; label: string; count: number }[] = [- { key: "all", label: "All", count: hotspots.length },- { key: "hot", label: "Hot", count: hotspots.filter((h) => h.is_hotspot).length },- { key: "risk", label: "Bus factor risk", count: hotspots.filter((h) => h.bus_factor <= 1).length },- { key: "accelerating", label: "Accelerating", count: hotspots.filter((h) => h.commit_count_30d * 3 > h.commit_count_90d).length },- ];-return (<div className="space-y-3"><div className="flex flex-wrap items-center gap-2">@@ -187,7 +218,11 @@ export function HotspotTable({{filtered.length === 0 ? (<EmptyState title="No matches" description="Try adjusting your search or filters." />) : (- <div className="border border-[var(--color-border-default)] overflow-hidden overflow-x-auto">+ <div+ ref={scrollRef}+ className="border border-[var(--color-border-default)] overflow-auto"+ style={{ maxHeight: 600 }}+ ><table className="w-full min-w-[760px] text-sm"><thead className="sticky top-0 z-10 bg-[var(--color-bg-surface)]"><tr className="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]">@@ -235,13 +270,22 @@ export function HotspotTable({<th className="px-3 py-2.5 w-20" /></tr></thead>- <tbody>- {filtered.map((h, i) => {- const accelerating = h.commit_count_30d * 3 > h.commit_count_90d;- const trendScore = h.temporal_hotspot_score;- const isExpanded = expanded.has(h.file_path);- return (- <React.Fragment key={h.file_path}>+ {paddingTop > 0 && (+ <tbody aria-hidden>+ <tr>+ <td style={{ height: paddingTop, padding: 0, border: 0 }} />+ </tr>+ </tbody>+ )}+ {virtualRows.map((vr) => {+ const h = filtered[vr.index];+ if (h === undefined) return null;+ const i = vr.index;+ const accelerating = h.commit_count_30d * 3 > h.commit_count_90d;+ const trendScore = h.temporal_hotspot_score;+ const isExpanded = expanded.has(h.file_path);+ return (+ <tbody key={h.file_path} ref={measureElement} data-index={i}><tronClick={onSelect ? () => onSelect(h) : undefined}className={cn(@@ -364,10 +408,16 @@ export function HotspotTable({</td></tr>)}- </React.Fragment>- );- })}- </tbody>+ </tbody>+ );+ })}+ {paddingBottom > 0 && (+ <tbody aria-hidden>+ <tr>+ <td style={{ height: paddingBottom, padding: 0, border: 0 }} />+ </tr>+ </tbody>+ )}</table>{total != null && (<ResultsFooterdiff --git a/packages/ui/src/shared/index.ts b/packages/ui/src/shared/index.tsindex b5cde672d..968e76f2d 100644--- a/packages/ui/src/shared/index.ts+++ b/packages/ui/src/shared/index.ts@@ -11,6 +11,14 @@ export {type ResponsiveTableProps,type ColumnPriority,} from "./responsive-table";+export {+ VirtualizedTable,+ type VirtualizedTableProps,+ useVirtualRows,+ type UseVirtualRowsOptions,+ type UseVirtualRows,+ type VirtualRow,+} from "./virtualized-table";export { Toaster, toast, type ToasterProps } from "./toast";export * from "./breadcrumb";export * from "./empty-state";diff --git a/packages/ui/src/shared/virtualized-table/index.ts b/packages/ui/src/shared/virtualized-table/index.tsnew file mode 100644index 000000000..ca1139fbb--- /dev/null+++ b/packages/ui/src/shared/virtualized-table/index.ts@@ -0,0 +1,10 @@+export {+ VirtualizedTable,+ type VirtualizedTableProps,+} from "./virtualized-table";+export {+ useVirtualRows,+ type UseVirtualRowsOptions,+ type UseVirtualRows,+ type VirtualRow,+} from "./use-virtual-rows";diff --git a/packages/ui/src/shared/virtualized-table/use-virtual-rows.ts b/packages/ui/src/shared/virtualized-table/use-virtual-rows.tsnew file mode 100644index 000000000..4a9a05503--- /dev/null+++ b/packages/ui/src/shared/virtualized-table/use-virtual-rows.ts@@ -0,0 +1,120 @@+"use client";++import * as React from "react";+import { useVirtualizer } from "@tanstack/react-virtual";++/**+ * useVirtualRows — the shared windowing primitive behind every big table in the+ * package. It wraps `@tanstack/react-virtual` and returns just the pieces a row+ * renderer needs: the scroll-container ref, the window of rows to render, and+ * the top/bottom spacer heights for the "padding row" virtualization pattern+ * (which keeps a real `<table>`/`<tbody>` intact — no absolute positioning or+ * column-width hacks).+ *+ * Below `threshold` rows, windowing is skipped entirely: every row is returned+ * with zero padding. That keeps small lists (and SSR / jsdom tests, where the+ * scroll viewport measures 0) trivially correct, and avoids paying for a+ * virtualizer when there is nothing to save.+ */+export interface UseVirtualRowsOptions {+ /** Total number of rows. */+ count: number;+ /**+ * Estimated row height in px. Uniform-height tables can pass their real row+ * height; for variable-height rows attach `measureElement` and this is only+ * the initial guess. Default 44.+ */+ estimateSize?: number;+ /** Extra rows rendered above/below the viewport. Default 8. */+ overscan?: number;+ /**+ * Below this many rows, render every row (no windowing). Default 60 — large+ * enough that any list small enough to render whole stays simple, small+ * enough that the 60fps-at-5k-rows goal is always windowed.+ */+ threshold?: number;+}++export interface VirtualRow {+ index: number;+ start: number;+ size: number;+}++export interface UseVirtualRows<E extends HTMLElement = HTMLDivElement> {+ /** Attach to the scroll container (needs `overflow: auto` + a bounded height). */+ scrollRef: React.RefObject<E | null>;+ /** The window of rows to render (every row when not virtualizing). */+ virtualRows: VirtualRow[];+ /** Spacer height before the first rendered row; 0 when not virtualizing. */+ paddingTop: number;+ /** Spacer height after the last rendered row; 0 when not virtualizing. */+ paddingBottom: number;+ /**+ * Ref callback for a rendered row element, enabling measured (variable)+ * heights. Attach as `ref={measureElement} data-index={index}` on the row.+ * A no-op when not virtualizing.+ */+ measureElement: (el: HTMLElement | null) => void;+ /** Whether windowing is active for the current count. */+ isVirtualized: boolean;+}++const DEFAULT_ESTIMATE = 44;+const DEFAULT_OVERSCAN = 8;+const DEFAULT_THRESHOLD = 60;++const NOOP_MEASURE = () => {};++export function useVirtualRows<E extends HTMLElement = HTMLDivElement>({+ count,+ estimateSize = DEFAULT_ESTIMATE,+ overscan = DEFAULT_OVERSCAN,+ threshold = DEFAULT_THRESHOLD,+}: UseVirtualRowsOptions): UseVirtualRows<E> {+ const scrollRef = React.useRef<E | null>(null);+ const enabled = count > threshold;++ const virtualizer = useVirtualizer({+ count,+ getScrollElement: () => scrollRef.current,+ estimateSize: () => estimateSize,+ overscan,+ enabled,+ });++ // Read the windowed items unconditionally so the hook's behaviour only+ // depends on `enabled`, never on call order.+ const items = virtualizer.getVirtualItems();++ if (!enabled) {+ const virtualRows: VirtualRow[] = Array.from({ length: count }, (_, index) => ({+ index,+ start: index * estimateSize,+ size: estimateSize,+ }));+ return {+ scrollRef,+ virtualRows,+ paddingTop: 0,+ paddingBottom: 0,+ measureElement: NOOP_MEASURE,+ isVirtualized: false,+ };+ }++ const totalSize = virtualizer.getTotalSize();+ const first = items[0];+ const last = items[items.length - 1];+ const paddingTop = first ? first.start : 0;+ const paddingBottom = last ? totalSize - last.end : 0;++ return {+ scrollRef,+ virtualRows: items.map((i) => ({ index: i.index, start: i.start, size: i.size })),+ paddingTop,+ paddingBottom,+ measureElement: virtualizer.measureElement,+ isVirtualized: true,+ };+}diff --git a/packages/ui/src/shared/virtualized-table/virtualized-table.tsx b/packages/ui/src/shared/virtualized-table/virtualized-table.tsxnew file mode 100644index 000000000..a635e7f44--- /dev/null+++ b/packages/ui/src/shared/virtualized-table/virtualized-table.tsx@@ -0,0 +1,113 @@+"use client";++import * as React from "react";+import { cn } from "../../lib/cn";+import { useVirtualRows } from "./use-virtual-rows";++/**+ * VirtualizedTable — a real `<table>` whose `<tbody>` rows are windowed.+ *+ * It keeps the semantic table (so column alignment, sticky headers and the+ * caller's own `<tr>`/`<td>` markup all just work) and virtualizes via the+ * "padding row" pattern: a spacer row above and below the rendered window stand+ * in for the off-screen rows. Below the hook's threshold every row renders, so+ * small tables behave exactly as before.+ *+ * The caller owns the header cells (`header`) and each row's cells+ * (`renderRow`). For variable-height rows (e.g. expandable detail rows) spread+ * the supplied `measureRef` and `data-index` onto the `<tr>` so the windowing+ * tracks real heights:+ *+ * renderRow={(row, index, measureRef) => (+ * <tr ref={measureRef} data-index={index}>…</tr>+ * )}+ */+export interface VirtualizedTableProps<T> {+ rows: T[];+ /** Stable key per row. */+ rowKey: (row: T, index: number) => string;+ /** The header row(s) — `<tr><th>…</th></tr>` — rendered inside a sticky `<thead>`. */+ header: React.ReactNode;+ /** Render one row as a `<tr>` (or a fragment of `<tr>`s for expandable rows). */+ renderRow: (+ row: T,+ index: number,+ measureRef: (el: HTMLElement | null) => void,+ ) => React.ReactNode;+ /** Estimated/real row height in px. Default 44. */+ estimateRowHeight?: number;+ overscan?: number;+ threshold?: number;+ /** Max height of the scroll viewport (px when a number). Default 600. */+ maxHeight?: number | string;+ /** Scroll-container classes. */+ className?: string;+ tableClassName?: string;+ headerClassName?: string;+ /** Rendered below the table when there are no rows. */+ empty?: React.ReactNode;+ "aria-label"?: string;+}++export function VirtualizedTable<T>({+ rows,+ rowKey,+ header,+ renderRow,+ estimateRowHeight = 44,+ overscan,+ threshold,+ maxHeight = 600,+ className,+ tableClassName,+ headerClassName,+ empty,+ "aria-label": ariaLabel,+}: VirtualizedTableProps<T>) {+ const { scrollRef, virtualRows, paddingTop, paddingBottom, measureElement } =+ useVirtualRows({+ count: rows.length,+ estimateSize: estimateRowHeight,+ // Spread conditionally: under `exactOptionalPropertyTypes` a present-but-+ // undefined value is not assignable to an optional `number`.+ ...(overscan !== undefined ? { overscan } : {}),+ ...(threshold !== undefined ? { threshold } : {}),+ });++ return (+ <div ref={scrollRef} className={cn("overflow-auto", className)} style={{ maxHeight }}>+ <table className={cn("w-full border-collapse", tableClassName)} aria-label={ariaLabel}>+ <thead+ className={cn(+ "sticky top-0 z-10 bg-[var(--color-bg-elevated)]",+ headerClassName,+ )}+ >+ {header}+ </thead>+ <tbody>+ {paddingTop > 0 && (+ <tr aria-hidden>+ <td style={{ height: paddingTop, padding: 0, border: 0 }} />+ </tr>+ )}+ {virtualRows.map((vr) => {+ const row = rows[vr.index];+ if (row === undefined) return null;+ return (+ <React.Fragment key={rowKey(row, vr.index)}>+ {renderRow(row, vr.index, measureElement)}+ </React.Fragment>+ );+ })}+ {paddingBottom > 0 && (+ <tr aria-hidden>+ <td style={{ height: paddingBottom, padding: 0, border: 0 }} />+ </tr>+ )}+ </tbody>+ </table>+ {rows.length === 0 && empty}+ </div>+ );+}diff --git a/packages/ui/src/symbols/symbol-table.tsx b/packages/ui/src/symbols/symbol-table.tsxindex d5acd0525..3d5e568a2 100644--- a/packages/ui/src/symbols/symbol-table.tsx+++ b/packages/ui/src/symbols/symbol-table.tsx@@ -18,6 +18,7 @@ import { Skeleton } from "../ui/skeleton";import { EmptyState } from "../shared/empty-state";import { ResultsFooter } from "../shared/results-footer";import { RowActions } from "../shared/row-actions";+import { VirtualizedTable } from "../shared/virtualized-table";import { truncatePath } from "../lib/format";import { cn } from "../lib/cn";import type { CodeSymbol } from "@repowise-dev/types/symbols";@@ -268,113 +269,114 @@ export function SymbolTable({<EmptyState title="No symbols found" description="Try adjusting your filters." />) : (<div className="border border-[var(--color-border-default)] overflow-hidden">- <div className="overflow-x-auto">- <table className="w-full text-sm">- <thead className="sticky top-0 z-10 bg-[var(--color-bg-surface)]">- <tr className="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]">- <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-32">- <span className="inline-flex items-center gap-1">- <TrendingUp className="h-3 w-3" />- Importance+ <VirtualizedTable+ rows={items}+ rowKey={(sym) => sym.id}+ estimateRowHeight={48}+ className="overflow-x-auto"+ tableClassName="w-full text-sm"+ headerClassName="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]"+ header={+ <tr className="border-b border-[var(--color-border-default)] bg-[var(--color-bg-surface)]">+ <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider w-32">+ <span className="inline-flex items-center gap-1">+ <TrendingUp className="h-3 w-3" />+ Importance+ </span>+ </th>+ <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">+ Name+ </th>+ <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">+ Signals+ </th>+ <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden sm:table-cell">+ Kind+ </th>+ <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden sm:table-cell">+ File+ </th>+ <th className="px-4 py-2.5 text-right text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden md:table-cell">+ Complexity+ </th>+ {prefix && <th className="px-2 py-2.5 w-12" />}+ </tr>+ }+ renderRow={(sym) => (+ <tr+ className="group border-b border-[var(--color-table-divider)] hover:bg-[var(--color-bg-elevated)] transition-colors last:border-0 cursor-pointer focus:outline-none focus:bg-[var(--color-bg-elevated)]"+ tabIndex={0}+ role="button"+ aria-label={`View ${sym.qualified_name || sym.name}`}+ onClick={() => onSelect(sym)}+ onKeyDown={(e) => {+ if (e.key === "Enter" || e.key === " ") {+ e.preventDefault();+ onSelect(sym);+ }+ }}+ >+ <td className="px-4 py-2.5">+ <ImportanceBar score={sym.importance_score} />+ </td>+ <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-primary)] min-w-[200px] max-w-[420px]">+ <span className="truncate block group-hover:underline underline-offset-2" title={sym.qualified_name || sym.name}>+ {sym.name}+ </span>+ {sym.parent_name && (+ <span+ className="block truncate text-[var(--color-text-tertiary)]"+ title={sym.parent_name}+ >+ .{sym.parent_name}</span>- </th>- <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">- Name- </th>- <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider">- Signals- </th>- <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden sm:table-cell">- Kind- </th>- <th className="px-4 py-2.5 text-left text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden sm:table-cell">- File- </th>- <th className="px-4 py-2.5 text-right text-[11px] font-medium text-[var(--color-text-tertiary)] uppercase tracking-wider hidden md:table-cell">- Complexity- </th>- {prefix && <th className="px-2 py-2.5 w-12" />}- </tr>- </thead>- <tbody>- {items.map((sym) => (- <tr- key={sym.id}- className="group border-b border-[var(--color-table-divider)] hover:bg-[var(--color-bg-elevated)] transition-colors last:border-0 cursor-pointer focus:outline-none focus:bg-[var(--color-bg-elevated)]"- tabIndex={0}- role="button"- aria-label={`View ${sym.qualified_name || sym.name}`}- onClick={() => onSelect(sym)}- onKeyDown={(e) => {- if (e.key === "Enter" || e.key === " ") {- e.preventDefault();- onSelect(sym);- }- }}- >- <td className="px-4 py-2.5">- <ImportanceBar score={sym.importance_score} />- </td>- <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-primary)] min-w-[200px] max-w-[420px]">- <span className="truncate block group-hover:underline underline-offset-2" title={sym.qualified_name || sym.name}>- {sym.name}- </span>- {sym.parent_name && (- <span- className="block truncate text-[var(--color-text-tertiary)]"- title={sym.parent_name}- >- .{sym.parent_name}- </span>- )}- </td>- <td className="px-4 py-2.5">- <SignalChips sym={sym} />- </td>- <td className="px-4 py-2.5 hidden sm:table-cell">- <Badge variant={sym.kind === "class" ? "accent" : "default"}>{sym.kind}</Badge>- </td>- <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-tertiary)] min-w-[200px] max-w-[420px] hidden sm:table-cell">- <span className="block truncate" title={`${sym.file_path}:${sym.start_line}`}>- {truncatePath(sym.file_path)}:{sym.start_line}- </span>- </td>- <td className="px-4 py-2.5 text-xs text-[var(--color-text-secondary)] tabular-nums hidden md:table-cell text-right">- <span- className={cn(- sym.complexity_estimate > 15- ? "text-[var(--color-error)]"- : sym.complexity_estimate > 8- ? "text-[var(--color-warning)]"- : "",- )}- >- {sym.complexity_estimate}- </span>- </td>- {prefix && (- <td className="px-2 py-2.5" onClick={(e) => e.stopPropagation()}>- <RowActions- actions={[- {- icon: GitBranch,- label: "Graph",- href: `${prefix}/architecture?view=graph&node=${encodeURIComponent(sym.file_path)}`,- },- {- icon: BookOpen,- label: "Docs",- href: `${prefix}/docs?file=${encodeURIComponent(sym.file_path)}`,- },- ]}- />- </td>+ )}+ </td>+ <td className="px-4 py-2.5">+ <SignalChips sym={sym} />+ </td>+ <td className="px-4 py-2.5 hidden sm:table-cell">+ <Badge variant={sym.kind === "class" ? "accent" : "default"}>{sym.kind}</Badge>+ </td>+ <td className="px-4 py-2.5 font-mono text-xs text-[var(--color-text-tertiary)] min-w-[200px] max-w-[420px] hidden sm:table-cell">+ <span className="block truncate" title={`${sym.file_path}:${sym.start_line}`}>+ {truncatePath(sym.file_path)}:{sym.start_line}+ </span>+ </td>+ <td className="px-4 py-2.5 text-xs text-[var(--color-text-secondary)] tabular-nums hidden md:table-cell text-right">+ <span+ className={cn(+ sym.complexity_estimate > 15+ ? "text-[var(--color-error)]"+ : sym.complexity_estimate > 8+ ? "text-[var(--color-warning)]"+ : "",)}- </tr>- ))}- </tbody>- </table>- </div>+ >+ {sym.complexity_estimate}+ </span>+ </td>+ {prefix && (+ <td className="px-2 py-2.5" onClick={(e) => e.stopPropagation()}>+ <RowActions+ actions={[+ {+ icon: GitBranch,+ label: "Graph",+ href: `${prefix}/architecture?view=graph&node=${encodeURIComponent(sym.file_path)}`,+ },+ {+ icon: BookOpen,+ label: "Docs",+ href: `${prefix}/docs?file=${encodeURIComponent(sym.file_path)}`,+ },+ ]}+ />+ </td>+ )}+ </tr>+ )}+ /><ResultsFootershown={items.length}total={total}diff --git a/packages/ui/vitest.config.ts b/packages/ui/vitest.config.tsindex b23df65ee..141570d30 100644--- a/packages/ui/vitest.config.ts+++ b/packages/ui/vitest.config.ts@@ -12,8 +12,15 @@ export default defineConfig({exclude: ["node_modules", "dist"],},resolve: {+ // Subpath aliases MUST precede the bare "@repowise-dev/types" entry:+ // @rollup/plugin-alias matches the first entry whose `find` prefixes the+ // import (`importee === find || importee.startsWith(find + "/")`), so a+ // leading bare alias shadows every `/subpath` and rewrites e.g.+ // `@repowise-dev/types/health` → `<…/index.ts>/health`. That only breaks+ // runtime *value* imports (type-only imports are erased), which is why it+ // stayed latent until a test transitively value-imported a types subpath.+ // Keep this list in sync with packages/types/package.json `exports`.alias: {- "@repowise-dev/types": path.resolve(__dirname, "../types/src/index.ts"),"@repowise-dev/types/graph": path.resolve(__dirname, "../types/src/graph.ts"),"@repowise-dev/types/git": path.resolve(__dirname, "../types/src/git.ts"),"@repowise-dev/types/docs": path.resolve(__dirname, "../types/src/docs.ts"),@@ -21,10 +28,23 @@ export default defineConfig({"@repowise-dev/types/dead-code": path.resolve(__dirname, "../types/src/dead-code.ts"),"@repowise-dev/types/symbols": path.resolve(__dirname, "../types/src/symbols.ts"),"@repowise-dev/types/chat": path.resolve(__dirname, "../types/src/chat.ts"),+ "@repowise-dev/types/workspace": path.resolve(__dirname, "../types/src/workspace.ts"),"@repowise-dev/types/blast-radius": path.resolve(__dirname, "../types/src/blast-radius.ts"),"@repowise-dev/types/jobs": path.resolve(__dirname, "../types/src/jobs.ts"),"@repowise-dev/types/settings": path.resolve(__dirname, "../types/src/settings.ts"),+ "@repowise-dev/types/security": path.resolve(__dirname, "../types/src/security.ts"),+ "@repowise-dev/types/owners": path.resolve(__dirname, "../types/src/owners.ts"),+ "@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/files": path.resolve(__dirname, "../types/src/files.ts"),+ "@repowise-dev/types/external-systems": path.resolve(+ __dirname,+ "../types/src/external-systems.ts",+ ),"@repowise-dev/types/health": path.resolve(__dirname, "../types/src/health.ts"),+ "@repowise-dev/types/coupling": path.resolve(__dirname, "../types/src/coupling.ts"),+ "@repowise-dev/types/stats": path.resolve(__dirname, "../types/src/stats.ts"),+ "@repowise-dev/types": path.resolve(__dirname, "../types/src/index.ts"),},},});