Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ui): say test routes are being checked while route evidence loads

Bernhard Jackiewiczc5c2a2d359b8
diff --git a/graph-ui/src/architecture/SpatialArchitecture.test.tsx b/graph-ui/src/architecture/SpatialArchitecture.test.tsx
index aaf18b215..d5355316c 100644
--- a/graph-ui/src/architecture/SpatialArchitecture.test.tsx
+++ b/graph-ui/src/architecture/SpatialArchitecture.test.tsx
@@ -127,6 +127,18 @@ it('groups endpoints, hides test routes by default and narrows a group through t
expect(scene()).toEqual(['/accounts · 2', '/fixture/', '/accounts_old/']);
expect(toggle.textContent).toBe('Include test routes');
});
+it('says the test routes are still being checked while route evidence loads, then counts them', async () => {
+ let finish!: (value: Awaited<ReturnType<typeof loadRouteGraph>>) => void;
+ vi.mocked(loadRouteGraph).mockImplementationOnce(() => new Promise(resolve => { finish = resolve; }));
+ const route = (id: number, name: string, file_path: string): GraphNode => ({ id, label: 'Route', name, qualified_name: `sample.route.${id}`, file_path, x: 0, y: 0, z: 0, size: 1, color: '' });
+ const input: GraphData = { nodes: [node, route(2, '/accounts/login/', 'app/urls.py'), route(4, '/fixture/', 'tests/urls.py')], edges: [], total_nodes: 3 };
+ await act(async () => root.render(<SpatialArchitecture project="sample" graph={input} overview={overview} view="routes" filter="" active onNavigate={vi.fn()} onView={vi.fn()} />));
+ const toggle = () => [...host.querySelectorAll('label')].find(label => label.textContent?.startsWith('Include test routes'))!.textContent;
+ // Before the evidence arrives a count would be a guess that later jumps (1, then 155 in Django).
+ expect(toggle()).toBe('Include test routes (checking…)');
+ await act(async () => finish({ relationships: [], truncated: false, warnings: [] }));
+ expect(toggle()).toBe('Include test routes (1 hidden)');
+});
it('does not load route evidence while the workspace is hidden', async () => {
await act(async () => root.render(<SpatialArchitecture project="sample" graph={graph} overview={overview} view="routes" filter="" active={false} onNavigate={vi.fn()} onView={vi.fn()} />));
expect(loadRouteGraph).not.toHaveBeenCalled();
diff --git a/graph-ui/src/architecture/SpatialArchitecture.tsx b/graph-ui/src/architecture/SpatialArchitecture.tsx
index 4319c9093..8a4d90c3b 100644
--- a/graph-ui/src/architecture/SpatialArchitecture.tsx
+++ b/graph-ui/src/architecture/SpatialArchitecture.tsx
@@ -79,6 +79,8 @@ export default function SpatialArchitecture({ project, generation, graph, overvi
? node.qualified_name === entryChoice.node.qualified_name && node.file_path === entryChoice.node.file_path
: entryChoice?.generation === generation && node.id === entryChoice?.node.id && node.file_path === entryChoice.node.file_path) ?? entries[0];
const routeSnapshot = routeReading?.key === routeKey ? routeReading.snapshot : undefined;
+ // Which routes are test code is decided by their registration, handler and caller evidence.
+ const routesChecking = view === 'routes' && !routeSnapshot && !(routeReading?.key === routeKey && routeReading.error);
const knownFiles = useMemo(() => [...new Set([...overview.files, ...[...(coverage?.records.values() ?? [])].filter(record => record.kind === 'file').map(record => record.path)])], [overview.files, coverage]);
const catalog = useMemo(() => collectSourceMetrics(graph, knownFiles), [graph, knownFiles]);
const hotspotCatalog = useMemo(() => collectHotspots(overview.hotspots, graph), [overview.hotspots, graph]);
@@ -155,7 +157,7 @@ export default function SpatialArchitecture({ project, generation, graph, overvi
</select></label><label>Call depth <select aria-label="Call depth" value={depth} onChange={event => setDepth(Number(event.target.value))}>{[1, 2, 3, 4].map(value => <option key={value}>{value}</option>)}</select></label></>}
{view === 'hotspots' && hotspotArea && <nav aria-label="Hotspot area"><button onClick={clearScope}>All hotspots</button><span>/ {hotspotArea}</span></nav>}
{view === 'routes' && <button onClick={() => setRouteRevision(value => value + 1)}>Refresh connections</button>}
- {view === 'routes' && <label className="spatial-gravity-toggle"><input type="checkbox" checked={includeTestRoutes} onChange={event => { setIncludeTestRoutes(event.target.checked); setSelection(undefined); }} />{text.includeTestRoutes(model.hiddenRoutes ?? 0)}</label>}
+ {view === 'routes' && <label className="spatial-gravity-toggle"><input type="checkbox" checked={includeTestRoutes} onChange={event => { setIncludeTestRoutes(event.target.checked); setSelection(undefined); }} />{routesChecking ? text.includeTestRoutesChecking : text.includeTestRoutes(model.hiddenRoutes ?? 0)}</label>}
{filePath && (view === 'overview' || view === 'dependencies') && <button onClick={() => onNavigate(filePath, 1)}>Read this file</button>}
{(view === 'overview' || view === 'dependencies') && <div className="spatial-relations" role="group" aria-label="Relationship types">
<button aria-pressed={!relations.length} onClick={() => setRelations([])}>All</button>{relationKinds.map(type => <button key={type} aria-pressed={relations.includes(type)} onClick={() => setRelations(current => current.includes(type) ? current.filter(item => item !== type) : [...current, type])}>{type.replaceAll('_', ' ').toLowerCase()}</button>)}
diff --git a/graph-ui/src/architecture/strings.ts b/graph-ui/src/architecture/strings.ts
index c3c9e09b9..1ec19a36f 100644
--- a/graph-ui/src/architecture/strings.ts
+++ b/graph-ui/src/architecture/strings.ts
@@ -79,6 +79,8 @@ export const architectureText = {
projectionEmpty: 'No component projection is available within this analysis budget.',
behaviorLimited: 'The analysis returned no call evidence.',
includeTestRoutes: (hidden: number) => hidden ? `Include test routes (${hidden.toLocaleString()} hidden)` : 'Include test routes',
+ /** Until the route evidence arrives a count would be a guess that jumps later. */
+ includeTestRoutesChecking: 'Include test routes (checking…)',
showRoutes: (count: number) => `Show these ${count.toLocaleString()} routes →`,
/** Routes › Service map: what the deployment inventory read found. */
serviceMap: {