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.
C aiderastclaude-codecode-analysiscode-intelligencecodexcursorcypherdeveloper-toolsgemini-cligraph-visualizationkilocodeknowledge-graphmcpmcp-servermodel-context-protocolopencodesqlitetree-sitterwindsurf
fix(ui): add ranked flows to a short Behavior start list
Bernhard Jackiewicz82a761f46e71
diff --git a/graph-ui/src/architecture/SystemArchitecture.test.tsx b/graph-ui/src/architecture/SystemArchitecture.test.tsxindex e3ab9033d..d7af3d598 100644--- a/graph-ui/src/architecture/SystemArchitecture.test.tsx+++ b/graph-ui/src/architecture/SystemArchitecture.test.tsx@@ -569,11 +569,23 @@ describe('system architecture workspace', () => {expect(loader.mock.calls.at(-1)?.[0].entryNodeId).toBe(9);expect([...start.options].map(option => option.value)).toEqual(['', '9', '36163']);});- it('does not ask for flows while the projection classifies entry points', async () => {+ it('does not ask for flows once the projection classifies enough entry points', async () => {const flowsLoader = vi.fn<FlowsLoader>().mockResolvedValue([]);- await render(vi.fn<SystemArchitectureLoader>().mockResolvedValue(response()), { view: 'behavior', flowsLoader });+ const many = fixture(); many.entrypoints = [1, 2, 3, 4, 5, 6, 7, 8].map(id => symbol(id, 'api', `entry${id}`));+ await render(vi.fn<SystemArchitectureLoader>().mockResolvedValue(response(many)), { view: 'behavior', flowsLoader });expect(flowsLoader).not.toHaveBeenCalled();});+ it('adds ranked flows after a handful of classified entry points, once each', async () => {+ const flowsLoader = vi.fn<FlowsLoader>().mockResolvedValue([+ { id: 0, label: 'handle → tick', entry: { id: 36163, name: 'handle', filePath: 'django/core/management/commands/runserver.py' }, terminal: { id: 44340, name: 'tick' }, steps: 40 },+ { id: 1, label: 'handle → save', entry: { id: 2, name: 'handle', filePath: 'src/service.ts' }, terminal: { id: 3, name: 'save' }, steps: 2 },+ ]);+ await render(vi.fn<SystemArchitectureLoader>().mockResolvedValue(response()), { view: 'behavior', flowsLoader });+ expect(flowsLoader).toHaveBeenCalledExactlyOnceWith('sample');+ const start = container.querySelector<HTMLSelectElement>('[aria-label="Behavior entry point"]')!;+ // The two classified entry points come first; the flow that repeats one of them is not listed twice.+ expect([...start.options].map(option => option.value)).toEqual(['', '1', '2', '36163']);+ });it('shows failures without retrying continuously', async () => {vi.useFakeTimers(); const loader = vi.fn<SystemArchitectureLoader>().mockResolvedValue({ status: 'failed', generation: 'g1', error: 'Analysis budget exceeded.' });await render(loader); await act(async () => { await vi.advanceTimersByTimeAsync(5000); });diff --git a/graph-ui/src/architecture/SystemArchitecture.tsx b/graph-ui/src/architecture/SystemArchitecture.tsxindex 1c66642bd..e1762847d 100644--- a/graph-ui/src/architecture/SystemArchitecture.tsx+++ b/graph-ui/src/architecture/SystemArchitecture.tsx@@ -22,6 +22,8 @@ export interface SystemArchitectureProps {/** Ranked call-graph flows (route handlers, call-graph roots) from /api/flows. */export type FlowsLoader = (project: string) => Promise<FlowSummary[]>;const loadFlows: FlowsLoader = project => new AtlasApi().flows(project);+/** Below this many classified entry points the Behavior start list also offers ranked flows. */+const FEW_ENTRY_POINTS = 8;/** Starting operations from flows, once each. The projection supplies qualified name and component on request. */export function flowEntries(flows: FlowSummary[]): SystemSymbol[] {@@ -147,8 +149,10 @@ export default function SystemArchitecture({ project, generation, view, filter,const structureData = useMemo(() => data ? { ...data, dependencies: data.dependencies.filter(edge => connectionAllowed(edge.type, connectionView)) } : undefined, [data, connectionView]);const error = current?.error ?? (current?.response?.status === 'failed' ? current.response.error ?? 'Architecture analysis failed.' : undefined);const chosenEntries = entryChoices?.project === project && entryChoices.generation === generation ? entryChoices.entries : data?.entrypoints ?? [];- // Without classified entry points (limited projections, Python without main) the ranked flows offer the starts.- const needsFlows = view === 'behavior' && active && Boolean(data) && !data?.entrypoints.length;+ // With no or only a handful of classified entry points (limited projections, Python without main, a few+ // route handlers) the ranked flows add their starts after the classified ones.+ const fewEntries = (data?.entrypoints.length ?? 0) < FEW_ENTRY_POINTS;+ const needsFlows = view === 'behavior' && active && Boolean(data) && fewEntries;useEffect(() => {if (!needsFlows || (flows?.project === project && flows.generation === generation)) return;let live = true;@@ -156,8 +160,12 @@ export default function SystemArchitecture({ project, generation, view, filter,return () => { live = false; };}, [needsFlows, flows, project, generation, flowsLoader]);const flowStarts = useMemo(() => flows?.project === project && flows.generation === generation ? flows.entries : [], [flows, project, generation]);- const entries = useMemo(() => data?.entrypoints.length || !flowStarts.length ? chosenEntries- : [...new Map([...flowStarts, ...chosenEntries].map(item => [item.id, item])).values()], [data, flowStarts, chosenEntries]);+ const entries = useMemo(() => {+ if (!fewEntries || !flowStarts.length) return chosenEntries;+ const merged = new Map(chosenEntries.map(item => [item.id, item]));+ for (const item of flowStarts) if (!merged.has(item.id)) merged.set(item.id, item);+ return [...merged.values()];+ }, [fewEntries, flowStarts, chosenEntries]);useEffect(() => {if (view !== 'behavior' || !data || (entryChoice?.project === project && entryChoice.generation === generation)) return;const suggested = data.entrypoints.length ? suggestedBehaviorEntry(data.entrypoints) : suggestedBehaviorEntry(flowStarts, true);