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 in the chat how a layer stops at the render limit

Bernhard Jackiewicz27d0081c7764
diff --git a/graph-ui/src/browser-ai/chat-wording.test.ts b/graph-ui/src/browser-ai/chat-wording.test.ts
new file mode 100644
index 000000000..060f08108
--- /dev/null
+++ b/graph-ui/src/browser-ai/chat-wording.test.ts
@@ -0,0 +1,43 @@
+import { describe, expect, it } from 'vitest';
+import { prepareExplanationContext, selectionSummary } from './explanation-context';
+import { formatExplanationEvidence } from './explanation-response';
+import { jsonbAggEvidence, jsonbAggRenderLimited } from './galaxy-evidence.fixture';
+import { relationshipAnswer } from './relationship-answer';
+
+/* Wording of the chat texts after the third review of the hand test (2026-10-04, W1 to W10). */
+
+describe('the render limit in the scope sentence (W1)', () => {
+ const english = 'Scope: 3 hops in both directions, all relationship types; 5,548 symbols and 15,673 relationships; partial. '
+ + 'Layer 3 stopped loading after the request that took it past the render limit of 5,000 nodes; the scene draws at most 5,000 nodes, '
+ + 'so counts and names further out can be incomplete.';
+ const german = 'Ausschnitt: 3 Schritte in beide Richtungen, alle Beziehungstypen; 5.548 Symbole und 15.673 Beziehungen; unvollständig. '
+ + 'Ebene 3 hörte nach der Anfrage auf zu laden, die sie über das Darstellungslimit von 5.000 Knoten brachte; die Szene zeichnet höchstens 5.000 Knoten, '
+ + 'daher können Anzahlen und Namen weiter außen fehlen.';
+
+ it('says what the Galaxy tooltip says, in the card, the prompt and the listed answers', () => {
+ expect(selectionSummary(jsonbAggRenderLimited()).at(-1)).toBe(english);
+ expect(formatExplanationEvidence(prepareExplanationContext(undefined, jsonbAggRenderLimited(), 3200))).toContain(english);
+ expect(relationshipAnswer('Who calls JSONBAgg?', [jsonbAggRenderLimited()])!.markdown).toContain(english);
+ expect(selectionSummary(jsonbAggRenderLimited(), 'de').at(-1)).toBe(german);
+ expect(relationshipAnswer('Wer ruft JSONBAgg auf?', [jsonbAggRenderLimited()])!.markdown).toContain(german);
+ });
+
+ it('keeps one unit in each sentence: symbols with the scope size, nodes with the render limit', () => {
+ for (const text of [english, german]) {
+ const sentences = text.split(/(?<=\.) (?=[A-ZÄÖÜ])/);
+ expect(sentences).toHaveLength(2);
+ expect(sentences[0]).not.toMatch(/nodes|Knoten/);
+ expect(sentences[1]).not.toMatch(/symbols|Symbole/);
+ }
+ expect(english).not.toContain('stopped at the render limit');
+ expect(german).not.toContain('hielt am Darstellungslimit');
+ });
+
+ it('names the direct relationships when the first layer stopped', () => {
+ const first = jsonbAggEvidence({ state: 'render-limit-partial', renderLimit: { layer: 1, kind: 'edges', limit: 15_000 } });
+ expect(selectionSummary(first).at(-1)).toContain('Layer 1 stopped loading after the request that took it past the render limit of 15,000 edges; '
+ + 'the scene draws at most 15,000 edges, so counts and names can be incomplete, the direct relationships included.');
+ expect(selectionSummary(first, 'de').at(-1)).toContain('über das Darstellungslimit von 15.000 Kanten brachte; die Szene zeichnet höchstens 15.000 Kanten, '
+ + 'daher können Anzahlen und Namen fehlen, auch bei den direkten Beziehungen.');
+ });
+});
diff --git a/graph-ui/src/browser-ai/grounded-explanation.test.ts b/graph-ui/src/browser-ai/grounded-explanation.test.ts
index d4248c474..4e02b8794 100644
--- a/graph-ui/src/browser-ai/grounded-explanation.test.ts
+++ b/graph-ui/src/browser-ai/grounded-explanation.test.ts
@@ -116,7 +116,8 @@ describe('the selected symbol source in a Galaxy explanation (K14)', () => {
it('says that a scope stopped at the render limit is partial, in the card and in the prompt (C1)', () => {
const partial = 'Scope: 3 hops in both directions, all relationship types; 5,548 symbols and 15,673 relationships; '
- + 'partial: layer 3 stopped at the render limit of 5,000 nodes, so counts and names further out can be incomplete.';
+ + 'partial. Layer 3 stopped loading after the request that took it past the render limit of 5,000 nodes; the scene draws at most 5,000 nodes, '
+ + 'so counts and names further out can be incomplete.';
expect(selectionSummary(jsonbAggRenderLimited()).at(-1)).toBe(partial);
expect(formatExplanationEvidence(prepareExplanationContext(undefined, jsonbAggRenderLimited(), 3200))).toContain(partial);
expect(selectionSummary(jsonbAggRenderLimited()).join('\n')).not.toContain('complete for the indexed graph');
diff --git a/graph-ui/src/browser-ai/relationship-answer.test.ts b/graph-ui/src/browser-ai/relationship-answer.test.ts
index fd7ef7dc2..0dc411f07 100644
--- a/graph-ui/src/browser-ai/relationship-answer.test.ts
+++ b/graph-ui/src/browser-ai/relationship-answer.test.ts
@@ -93,10 +93,12 @@ describe('listed relationship answers', () => {
it('says in the language of the question that a scope stopped at the render limit, with numbers written in that language (C1)', () => {
expect(relationshipAnswer('Who calls JSONBAgg?', [jsonbAggRenderLimited()])!.markdown).toContain('Scope: 3 hops in both directions, all relationship types; '
- + '5,548 symbols and 15,673 relationships; partial: layer 3 stopped at the render limit of 5,000 nodes, so counts and names further out can be incomplete.');
+ + '5,548 symbols and 15,673 relationships; partial. Layer 3 stopped loading after the request that took it past the render limit of 5,000 nodes; '
+ + 'the scene draws at most 5,000 nodes, so counts and names further out can be incomplete.');
const german = relationshipAnswer('Wer ruft JSONBAgg auf?', [jsonbAggRenderLimited()])!.markdown;
expect(german).toContain('Ausschnitt: 3 Schritte in beide Richtungen, alle Beziehungstypen; 5.548 Symbole und 15.673 Beziehungen; '
- + 'unvollständig: Ebene 3 hielt am Darstellungslimit von 5.000 Knoten an, Anzahlen und Namen weiter außen können daher fehlen.');
+ + 'unvollständig. Ebene 3 hörte nach der Anfrage auf zu laden, die sie über das Darstellungslimit von 5.000 Knoten brachte; '
+ + 'die Szene zeichnet höchstens 5.000 Knoten, daher können Anzahlen und Namen weiter außen fehlen.');
expect(german).not.toContain('vollständig für den indizierten Graphen');
});
diff --git a/graph-ui/src/browser-ai/strings.ts b/graph-ui/src/browser-ai/strings.ts
index 96f287a49..8de54bac8 100644
--- a/graph-ui/src/browser-ai/strings.ts
+++ b/graph-ui/src/browser-ai/strings.ts
@@ -47,8 +47,11 @@ const englishRelationshipWords = {
complete: 'complete for the indexed graph',
loading: 'still loading, so this is a partial preview',
partial: (error?: string) => `incomplete${error ? `: ${error}` : ''}`,
- /** A layer stopped at the render limit: the layers inside it are whole, it and those further out are not (C1). */
- renderLimited: (layer: number, limit: number, kind: 'nodes' | 'edges') => `partial: layer ${layer} stopped at the render limit of ${en(limit)} ${kind}, `
+ /** A layer stopped at the render limit: the layers inside it are whole, it and those further out are not (C1). As the
+ * Galaxy tooltip says it, loading stops after the request that passes the limit (5,548 of 5,000), and the scene draws up
+ * to the limit. The limit gets a sentence of its own, so nodes never stand beside the symbols of the scope size (W1). */
+ renderLimited: (layer: number, limit: number, kind: 'nodes' | 'edges') => `partial. Layer ${layer} stopped loading after the request that took it past `
+ + `the render limit of ${en(limit)} ${kind}; the scene draws at most ${en(limit)} ${kind}, `
+ (layer > 1 ? 'so counts and names further out can be incomplete' : 'so counts and names can be incomplete, the direct relationships included'),
exhausted: 'nothing further beyond this depth',
scope: (shape: string, size: string, state: string) => `Scope: ${shape}; ${size}; ${state}.`,
@@ -110,8 +113,12 @@ export const relationshipWords: { en: RelationshipWords; de: RelationshipWords }
complete: 'vollständig für den indizierten Graphen',
loading: 'lädt noch, das ist eine Vorschau',
partial: (error?: string) => `unvollständig${error ? `: ${error}` : ''}`,
- renderLimited: (layer: number, limit: number, kind: 'nodes' | 'edges') => `unvollständig: Ebene ${layer} hielt am Darstellungslimit von ${de(limit)} ${kind === 'nodes' ? 'Knoten' : 'Kanten'} an, `
- + (layer > 1 ? 'Anzahlen und Namen weiter außen können daher fehlen' : 'Anzahlen und Namen können daher fehlen, auch bei den direkten Beziehungen'),
+ renderLimited: (layer: number, limit: number, kind: 'nodes' | 'edges') => {
+ const unit = kind === 'nodes' ? 'Knoten' : 'Kanten';
+ return `unvollständig. Ebene ${layer} hörte nach der Anfrage auf zu laden, die sie über das Darstellungslimit von ${de(limit)} ${unit} brachte; `
+ + `die Szene zeichnet höchstens ${de(limit)} ${unit}, `
+ + (layer > 1 ? 'daher können Anzahlen und Namen weiter außen fehlen' : 'daher können Anzahlen und Namen fehlen, auch bei den direkten Beziehungen');
+ },
exhausted: 'dahinter folgt nichts mehr',
scope: (shape: string, size: string, state: string) => `Ausschnitt: ${shape}; ${size}; ${state}.`,
incoming: (total: number, symbols?: number) => `Eingehende Beziehungen: ${de(total)}${symbols === undefined ? '' : ` aus ${de(symbols)} ${symbols === 1 ? 'Symbol' : 'Symbolen'}`}.`,