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): show the differing end of routes with a long shared start
Bernhard Jackiewiczf0bbaf1ed1bb
diff --git a/graph-ui/src/architecture/semantic-graph.test.ts b/graph-ui/src/architecture/semantic-graph.test.tsindex a1a07259f..a2a2b9f40 100644--- a/graph-ui/src/architecture/semantic-graph.test.ts+++ b/graph-ui/src/architecture/semantic-graph.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest';-import { buildSemanticGraph, layoutFolderHierarchy, readableRoute, semanticEntryPoints, type SemanticNode, type SemanticPlatform } from './semantic-graph';+import { buildSemanticGraph, distinctLabels, layoutFolderHierarchy, readableRoute, semanticEntryPoints, type SemanticNode, type SemanticPlatform } from './semantic-graph';import type { GraphData, GraphNode } from '../galaxy/types';const node = (id: number, file: string, name = `symbol${id}`, status: GraphNode['status'] = 'normal'): GraphNode => ({@@ -348,6 +348,15 @@ describe('route identities and service evidence', () => {expect(grouped['/about/']).toBe('/about/');expect(grouped['/generic-lastmod · 2']).toBe('/generic-lastmod · 2');});+ it('shows the differing end of routes that share a long start without an inner separator', () => {+ const short = distinctLabels(['/sitemapindex1.xml', '/sitemapindex2.xml', '/sitemapindex-with-a-tail1', '/sitemapindex-with-a-tail2']);+ // The cut cannot fall on a separator inside "/sitemapindex", so the chip keeps the end that fits and differs.+ expect(short.get('/sitemapindex1.xml')).toBe('…mapindex1.xml');+ expect(short.get('/sitemapindex2.xml')).toBe('…mapindex2.xml');+ // With a separator inside the shared start the cut still falls on it.+ expect(short.get('/sitemapindex-with-a-tail1')).toBe('…tail1');+ for (const label of short.values()) expect(label.length).toBeLessThanOrEqual(14);+ });it('selects exactly the routes of a group when the filter names its prefix', () => {const at = (id: number, name: string, file_path: string): GraphNode => ({ ...route, id, name, qualified_name: `fixture.route.${id}`, file_path });const routes = [at(400, '/', 'app/urls.py'), at(401, '/', 'shop/urls.py'), at(402, '/', 'blog/urls.py'),diff --git a/graph-ui/src/architecture/semantic-graph.ts b/graph-ui/src/architecture/semantic-graph.tsindex 6bf420793..2d0e705e0 100644--- a/graph-ui/src/architecture/semantic-graph.ts+++ b/graph-ui/src/architecture/semantic-graph.ts@@ -119,6 +119,8 @@ const COMPACT_LABEL_CHARS = 14;* Labels that a compact chip would cut to the same visible start ("/generic-lastmo…")* lose their shared start instead: "…/index.xml" and "…/sitemap.xml". The cut falls on a* separator, so the rest begins with a whole segment or word; a slash stays to mark a path.+ * A shared start without a separator inside ("/sitemapindex1.xml") keeps the end that+ * fits the chip, and that end holds the difference: "…mapindex1.xml".*/export function distinctLabels(labels: readonly string[], visible = COMPACT_LABEL_CHARS): Map<string, string> {const result = new Map<string, string>();@@ -133,7 +135,8 @@ export function distinctLabels(labels: readonly string[], visible = COMPACT_LABE}if (!shared) continue;const cut = Math.max(...['/', '-', '_', '.'].map(separator => label.lastIndexOf(separator, shared - 1)));- const rest = cut > 0 ? (label[cut] === '/' ? label.slice(cut) : label.slice(cut + 1)) : '';+ const rest = cut > 0 ? (label[cut] === '/' ? label.slice(cut) : label.slice(cut + 1))+ : label.slice(Math.min(shared, Math.max(1, label.length - (visible - 1))));// A label that is the shared start itself keeps its full text; its neighbours carry the difference.if (rest.replace('/', '').length > 1) result.set(label, `…${rest}`);}