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): make the Expand +1 warning true and show it at once

Bernhard Jackiewicz3d51f86d434e
diff --git a/graph-ui/src/galaxy/GalaxyPanel.layers.test.tsx b/graph-ui/src/galaxy/GalaxyPanel.layers.test.tsx
index 3025a9e80..ab89a284e 100644
--- a/graph-ui/src/galaxy/GalaxyPanel.layers.test.tsx
+++ b/graph-ui/src/galaxy/GalaxyPanel.layers.test.tsx
@@ -40,6 +40,8 @@ const settle = (check: () => void) => vi.waitFor(async () => {
const status = () => host.querySelector('.atlas-graph-scope-count');
const button = (label: string) => [...host.querySelectorAll('button')].find(entry => entry.textContent === label)!;
const minus = () => host.querySelector<HTMLButtonElement>('button[aria-label="Remove graph layer"]')!;
+/* G3: the Expand explanation is the Galaxy's own tooltip; its text stands on the button as data-hint. */
+const hint = (element: HTMLElement) => element.getAttribute('data-hint');
const layers = () => [...host.querySelectorAll('.atlas-graph-exploration span')].map(entry => entry.textContent ?? '').find(text => /^\d+ layers?$/.test(text));
it('K8: shows loaded nodes and edges while a layer loads, and "−" cancels back to the previous layer at once', async () => {
@@ -92,14 +94,24 @@ it('K8: a layer past the render limit stops there, says it is partial and cannot
await settle(() => expect(seam().nodes).toBeGreaterThan(0));
await act(async () => { seam().clickNode('sample.n1'); });
await settle(() => expect(status()?.textContent).toBe('2 nodes · 1 edge'));
- expect(button('Expand +1').title).toContain('Load layer 2: 1 node to expand');
+ expect(hint(button('Expand +1'))).toContain('Load layer 2: 1 node to expand');
await act(async () => button('Expand +1').click());
await settle(() => expect(status()?.textContent).toBe('Partial: 602 nodes · 601 edges'));
expect(status()?.getAttribute('data-state')).toBe('partial');
- expect(status()?.getAttribute('title')).toBe('Layer 2 stopped at the render limit of 500 nodes. Raise the limit under Limits or trace fewer edge types to load all of it.');
- expect(button('Expand +1').disabled).toBe(true);
- expect(button('Expand +1').title).toContain('stopped at the render limit');
+ // G3: 602 nodes loaded with a limit of 500, so the words say "after passing", not "at".
+ expect(status()?.getAttribute('title')).toBe('Layer 2 stopped loading after the request that took it past the render limit of 500 nodes, so it is incomplete; '
+ + 'the scene draws at most 500 nodes. Raise the limit under Limits or trace fewer edge types to load all of it.');
+ expect(scene.nodes).toBe(500);
+ // G3: blocked, not disabled: a disabled button takes neither the pointer nor the focus, and the reason would be out of reach.
+ expect(button('Expand +1').getAttribute('aria-disabled')).toBe('true');
+ expect(hint(button('Expand +1'))).toContain('stopped loading after it passed the render limit');
+ await act(async () => { button('Expand +1').dispatchEvent(new MouseEvent('mouseover', { bubbles: true })); });
+ expect(document.querySelector('[data-testid="atlas-hint"][data-hint-for="galaxy-expand"]')?.textContent).toContain('stopped loading after it passed the render limit');
+ await act(async () => { button('Expand +1').dispatchEvent(new MouseEvent('mouseout', { bubbles: true })); });
+ await act(async () => button('Expand +1').click());
+ expect(layers()).toBe('2 layers');
+ expect(status()?.textContent).toBe('Partial: 602 nodes · 601 edges');
// The partial layer can still be left the normal way.
await act(async () => minus().click());
await settle(() => expect(status()?.textContent).toBe('2 nodes · 1 edge'));
@@ -128,8 +140,40 @@ it('K8: Expand warns before loading when the nodes at the edge have more indexed
await settle(() => expect(seam().nodes).toBe(3));
await act(async () => { seam().clickNode('sample.n1'); });
await settle(() => expect(button('Expand +1').getAttribute('data-warning')).toBe('true'));
- // 1,270 + 3 + 2 calls, less the two already loaded.
- expect(button('Expand +1').title).toBe(`Likely past the render limit. Load layer 2: 2 nodes to expand. The index lists ${(1273).toLocaleString()} calls at them that are not loaded yet; `
- + 'growing like the last layer it adds about 4 nodes. Loading stops at the render limit of 500 nodes and marks the layer partial.');
+ // 1,270 + 3 + 2 calls, less the two already loaded. G3: the calls drive the warning, so the smaller growth estimate is not offered beside it.
+ const text = `Likely past the render limit of 500 nodes. Load layer 2: 2 nodes to expand. The index lists ${(1273).toLocaleString()} calls at them that are not loaded yet, `
+ + `and each can bring a new node; 3 nodes are loaded now. Loading stops after the first request to the index that takes it past 500 nodes or ${(1000).toLocaleString()} edges, `
+ + `so the layer can end above the limit; it is then marked partial, and the scene draws at most 500 nodes and ${(1000).toLocaleString()} edges.`;
+ expect(hint(button('Expand +1'))).toBe(text);
expect(calls.filter(call => String(call.args.query).includes('n.in_degree'))).toHaveLength(1);
+
+ /*
+ * G3: the warning came as a native title, after the browser's delay. It is
+ * the Galaxy's own tooltip now: at once on hover and on keyboard focus,
+ * described by aria-describedby, closed on leave, blur and Escape.
+ */
+ const expand = button('Expand +1');
+ expect(expand.hasAttribute('title')).toBe(false);
+ const shown = () => document.querySelector<HTMLElement>('[data-testid="atlas-hint"][data-hint-for="galaxy-expand"]');
+ expect(shown()).toBeNull();
+ await act(async () => { expand.dispatchEvent(new MouseEvent('mouseover', { bubbles: true })); });
+ expect(shown()?.textContent).toBe(text);
+ expect(shown()?.getAttribute('role')).toBe('tooltip');
+ expect(expand.getAttribute('aria-describedby')).toBe(shown()?.id);
+ await act(async () => { expand.dispatchEvent(new MouseEvent('mouseout', { bubbles: true })); });
+ expect(shown()).toBeNull();
+ expect(expand.hasAttribute('aria-describedby')).toBe(false);
+ await act(async () => { expand.focus(); });
+ expect(shown()?.textContent).toBe(text);
+ // Escape on the focused button closes the tooltip and nothing else: the scope stays.
+ // A real key press can be cancelled; that is what keeps the Escape of the tooltip from leaving the scope too.
+ await act(async () => { expand.dispatchEvent(new KeyboardEvent('keydown', { key: 'Escape', bubbles: true, cancelable: true })); });
+ expect(shown()).toBeNull();
+ expect(button('Expand +1')).toBe(expand);
+ expect(status()?.textContent).toBe('3 nodes · 2 edges');
+ await act(async () => { expand.blur(); });
+ await act(async () => { expand.focus(); });
+ expect(shown()).not.toBeNull();
+ await act(async () => { expand.blur(); });
+ expect(shown()).toBeNull();
});
diff --git a/graph-ui/src/galaxy/GalaxyPanel.tsx b/graph-ui/src/galaxy/GalaxyPanel.tsx
index be266df88..638d1c98e 100644
--- a/graph-ui/src/galaxy/GalaxyPanel.tsx
+++ b/graph-ui/src/galaxy/GalaxyPanel.tsx
@@ -147,7 +147,7 @@ import { galaxyHistoryOptions, historyEntryDetail, historyEntryLabel, scopeIdent
import { useOrganicLayout } from './use-organic-layout';
import RenderProgress from './RenderProgress';
import { useGraphScope } from './use-graph-scope';
-import { SCOPED_HIERARCHY_LABEL_BUDGET, SCOPED_HIERARCHY_LABEL_MAX_TEXT_WIDTH, limitGraphRender, nextLayerEstimate, scenePictureFor, scopedHierarchy } from './graph-scope';
+import { SCOPED_HIERARCHY_LABEL_BUDGET, SCOPED_HIERARCHY_LABEL_MAX_TEXT_WIDTH, expandPastLimit, limitGraphRender, nextLayerEstimate, scenePictureFor, scopedHierarchy, type ExpandOutlook } from './graph-scope';
import './graph-exploration.css';
import { layoutNodeForSelection } from './selected-node';
import { galaxyScopeEvidence, useSelectionEvidence, type SelectionEvidenceListener } from './selection-evidence';
@@ -2100,11 +2100,17 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {
const estimate = scope.complete ? nextLayerEstimate(scope.result) : undefined;
// Die gezaehlten Aufrufe am Rand sind eine Untergrenze; das Wachstum allein uebersah die Knoten mit tausend Aufrufern (Review zu K8).
const edgeCalls = estimate ? scope.edgeCalls : undefined;
- const expandWarning = Boolean(estimate && props.workspaceExpanded && ((data?.nodes.length ?? 0) + Math.max(estimate.estimate, edgeCalls ?? 0) > nodeBudget
- || (data?.edges.length ?? 0) + (edgeCalls ?? 0) > edgeBudget));
+ // G3: die Render-Limits gelten nur in der Werkzeugleiste des Galaxy-Arbeitsbereichs; das Mini-Galaxy laedt ohne sie.
+ const expandOutlook: ExpandOutlook | undefined = estimate && {
+ layer: estimate.layer, frontier: estimate.frontier, estimate: estimate.estimate, calls: edgeCalls,
+ loaded: { nodes: data?.nodes.length ?? 0, edges: data?.edges.length ?? 0 },
+ limits: props.workspaceExpanded ? { nodes: nodeBudget, edges: edgeBudget } : undefined,
+ };
+ const expandPast = expandOutlook && expandPastLimit(expandOutlook);
+ const expandWarning = Boolean(expandPast);
+ const expandBlocked = Boolean(scope.loading || scope.result?.exhausted || scope.result?.partial);
const expandTitle = partial ? galaxyLayerText.expandPartial : scope.result?.exhausted ? galaxyLayerText.expandEnd
- : estimate ? `${expandWarning ? `${galaxyLayerText.expandOverLimit} ` : ''}${galaxyLayerText.expandTitle(estimate.layer, estimate.frontier, estimate.estimate, nodeBudget, edgeCalls)}`
- : undefined;
+ : expandOutlook ? galaxyLayerText.expandHint(expandOutlook, expandPast) : undefined;
/*
* Die Vorgabe der Ansicht, mit der Wahl des Lesers darauf.
@@ -2631,10 +2637,22 @@ export default function GalaxyPanel(props: GalaxyPanelProps): JSX.Element {
title={scope.loading ? galaxyLayerText.cancelLoading(scope.depth) : galaxyLayerText.removeLayer}
onClick={cancelOrRemoveLayer} aria-label="Remove graph layer">−</button>
<span>{scope.depth} {scope.depth === 1 ? 'layer' : 'layers'}</span>
- <button type="button" disabled={scope.loading || scope.result?.exhausted || Boolean(scope.result?.partial)}
- data-warning={expandWarning || undefined} title={expandTitle}
- onClick={() => scope.setDepth(scope.depth + 1)} aria-label={galaxyToolbarText.expand}>
- <FitLabel wide={galaxyToolbarText.expand} narrow={galaxyToolbarText.expandNarrow} /></button>
+ {/*
+ * G3: die Erklaerung zu Expand ist lang, und als natives
+ * `title` kam sie erst nach der Verzoegerung des Browsers.
+ * Der eigene Tooltip steht sofort bei Hover und Fokus unter
+ * dem Knopf, auch in der knappen Form "+1", ueber der Szene.
+ * Gesperrt heisst `aria-disabled` und nicht `disabled`: ein
+ * abgeschalteter Knopf nimmt weder Zeiger noch Fokus, und
+ * gerade dann (Ebene unvollstaendig, Ende des Traces) ist der
+ * Grund das, was der Leser wissen will.
+ */}
+ <Hint name="galaxy-expand" text={expandTitle}>
+ <button type="button" aria-disabled={expandBlocked || undefined}
+ data-warning={expandWarning || undefined}
+ onClick={() => { if (!expandBlocked) scope.setDepth(scope.depth + 1); }} aria-label={galaxyToolbarText.expand}>
+ <FitLabel wide={galaxyToolbarText.expand} narrow={galaxyToolbarText.expandNarrow} /></button>
+ </Hint>
{props.workspaceExpanded && (mode === 'galaxy' || scopedProjection) && <>
<PathPicker nodes={pathCandidates} onPick={node => { setTrail({ key: organicKey, kind: 'path', target: node.id, name: node.name }); setTrailStep(0); }} />
<button type="button" disabled={rootCalls.length === 0} aria-pressed={trail?.key === organicKey && trail.kind === 'calls'}
diff --git a/graph-ui/src/galaxy/galaxy-strings.test.ts b/graph-ui/src/galaxy/galaxy-strings.test.ts
index a253be0f9..9e653bed4 100644
--- a/graph-ui/src/galaxy/galaxy-strings.test.ts
+++ b/graph-ui/src/galaxy/galaxy-strings.test.ts
@@ -1,5 +1,46 @@
import { expect, it } from 'vitest';
-import { galaxyHierarchyText } from './galaxy-strings';
+import { galaxyHierarchyText, galaxyLayerText } from './galaxy-strings';
+import { expandPastLimit, type ExpandOutlook } from './graph-scope';
+
+/*
+ * Hand test 2026-10-04 (G3): at two layers of JSONBAgg the tooltip said
+ * "Likely past the render limit", then "growing like the last layer it adds
+ * about 402 nodes" (90 + 402 is far below 5,000), and "Loading stops at the
+ * render limit of 5,000 nodes", while the layer then ended at 5,548 nodes.
+ * Every sentence is true now: the warning names the limit and the number that
+ * drives it, and the limit sentence says what loading really does.
+ */
+it('G3: the Expand hint names what drives the warning and what the render limit really does', () => {
+ const n = (value: number) => value.toLocaleString();
+ const outlook: ExpandOutlook = { layer: 3, frontier: 75, estimate: 402, calls: 9031, loaded: { nodes: 90, edges: 201 }, limits: { nodes: 5000, edges: 20000 } };
+ const limit = `Loading stops after the first request to the index that takes it past ${n(5000)} nodes or ${n(20000)} edges, so the layer can end above the limit; `
+ + `it is then marked partial, and the scene draws at most ${n(5000)} nodes and ${n(20000)} edges.`;
+ expect(galaxyLayerText.expandHint(outlook, expandPastLimit(outlook))).toBe(`Likely past the render limit of ${n(5000)} nodes. Load layer 3: 75 nodes to expand. `
+ + `The index lists ${n(9031)} calls at them that are not loaded yet, and each can bring a new node; 90 nodes are loaded now. ${limit}`);
+ // The smaller growth estimate is not offered next to the warning it would contradict.
+ expect(galaxyLayerText.expandHint(outlook, expandPastLimit(outlook))).not.toContain('402');
+
+ // Driven by the growth of the last layer, without a call count (a trace without CALLS).
+ const growth = { ...outlook, calls: undefined, loaded: { nodes: 4700, edges: 9000 } };
+ expect(galaxyLayerText.expandHint(growth, expandPastLimit(growth))).toBe(`Likely past the render limit of ${n(5000)} nodes. Load layer 3: 75 nodes to expand. `
+ + `Growing like the last layer it adds about 402 nodes, and a hub can add many more; ${n(4700)} nodes are loaded now. ${limit}`);
+ // Driven by the edge limit.
+ const edges = { ...outlook, calls: 3000, loaded: { nodes: 90, edges: 18500 } };
+ expect(galaxyLayerText.expandHint(edges, expandPastLimit(edges))).toBe(`Likely past the render limit of ${n(20000)} edges. Load layer 3: 75 nodes to expand. `
+ + `The index lists ${n(3000)} calls at them that are not loaded yet, and each can bring a new node; ${n(18500)} edges are loaded now. ${limit}`);
+ // No warning: no "loaded now", and the growth estimate stands where it is the larger number.
+ const quiet = { ...outlook, calls: 120 };
+ expect(galaxyLayerText.expandHint(quiet, expandPastLimit(quiet))).toBe('Load layer 3: 75 nodes to expand. '
+ + `The index lists 120 calls at them that are not loaded yet; growing like the last layer it adds about 402 nodes. ${limit}`);
+ // The Explore mini-Galaxy loads without render limits, and the hint claims none.
+ const explore = { ...outlook, limits: undefined };
+ expect(galaxyLayerText.expandHint(explore, expandPastLimit(explore))).toBe('Load layer 3: 75 nodes to expand. '
+ + `The index lists ${n(9031)} calls at them that are not loaded yet, and each can bring a new node.`);
+ // A partial layer says it stopped after passing the limit, not at it.
+ expect(galaxyLayerText.partialTitle(3, 5000, 'nodes')).toBe(`Layer 3 stopped loading after the request that took it past the render limit of ${n(5000)} nodes, `
+ + `so it is incomplete; the scene draws at most ${n(5000)} nodes. Raise the limit under Limits or trace fewer edge types to load all of it.`);
+ expect(galaxyLayerText.expandPartial).toBe('This layer stopped loading after it passed the render limit, so there is no complete edge to grow from. Raise the limit under Limits first.');
+});
/*
* Second review of K5: the hint and the note in the picture say what carries
diff --git a/graph-ui/src/galaxy/galaxy-strings.ts b/graph-ui/src/galaxy/galaxy-strings.ts
index 8e76ab002..5e428b301 100644
--- a/graph-ui/src/galaxy/galaxy-strings.ts
+++ b/graph-ui/src/galaxy/galaxy-strings.ts
@@ -1,3 +1,5 @@
+import type { ExpandOutlook } from './graph-scope';
+
/**
* The words of the Galaxy path view, beside the view like the other domain
* copy (agents/agent-strings.ts, architecture/strings.ts).
@@ -134,20 +136,40 @@ export const galaxyLayerText = {
partial: (counts: string) => `Partial: ${counts}`,
partialPreview: 'Partial preview',
previewLoading: (layer: number) => `Partial preview while layer ${layer} loads`,
+ // G3: a layer stops after the request that passes the limit, so it can hold more than the limit (5,548 of 5,000); the scene draws up to the limit.
partialTitle: (layer: number, limit: number, kind: 'nodes' | 'edges') =>
- `Layer ${layer} stopped at the render limit of ${limit.toLocaleString()} ${kind}. Raise the limit under Limits or trace fewer edge types to load all of it.`,
+ `Layer ${layer} stopped loading after the request that took it past the render limit of ${limit.toLocaleString()} ${kind}, so it is incomplete; `
+ + `the scene draws at most ${limit.toLocaleString()} ${kind}. Raise the limit under Limits or trace fewer edge types to load all of it.`,
removeLayer: 'Remove the outermost layer',
cancelLoading: (layer: number) => `Cancel loading layer ${layer} and return to ${layer - 1 === 1 ? '1 layer' : `${layer - 1} layers`}`,
/* Measured, not promised: a hub at the edge can bring far more than the last layer did (JSONBAgg layer 3: about 400 expected, over 9,000 loaded). */
/* With `calls` the index has counted the calls at the edge nodes (review of K8): a floor, where the growth alone missed the hubs. */
- expandTitle: (layer: number, frontier: number, estimate: number, limit: number, calls?: number) =>
- `Load layer ${layer}: ${count(frontier, 'node', 'nodes')} to expand. `
- + (calls === undefined
- ? `Growing like the last layer it adds about ${estimate.toLocaleString()} nodes; a hub can add many more. `
- : `The index lists ${count(calls, 'call', 'calls')} at them that ${calls === 1 ? 'is' : 'are'} not loaded yet; growing like the last layer it adds about ${estimate.toLocaleString()} nodes. `)
- + `Loading stops at the render limit of ${limit.toLocaleString()} nodes and marks the layer partial.`,
- expandOverLimit: 'Likely past the render limit.',
- expandPartial: 'This layer stopped at the render limit, so there is no complete edge to grow from. Raise the limit under Limits first.',
+ /*
+ * Hand test 2026-10-04 (G3): every sentence true on its own. The warning
+ * names the limit and the number behind it (`expandPastLimit` in
+ * graph-scope.ts); the growth estimate stands only where it is the larger
+ * number, so "about 402 nodes" no longer sits next to a warning it
+ * contradicts. Loading stops after the request that passes a limit, not
+ * at the limit (JSONBAgg layer 3 ended at 5,548 nodes), and where no limit
+ * applies (the Explore mini-Galaxy) the hint claims none.
+ */
+ expandHint: (outlook: ExpandOutlook, past: { limit: 'nodes' | 'edges'; by: 'calls' | 'growth' } | undefined) => {
+ const { layer, frontier, estimate, calls, loaded, limits } = outlook;
+ const unit = (kind: 'nodes' | 'edges', value: number) => count(value, kind === 'nodes' ? 'node' : 'edge', kind);
+ const evidence = calls === undefined
+ ? `Growing like the last layer it adds about ${estimate.toLocaleString()} nodes, and a hub can add many more`
+ : `The index lists ${count(calls, 'call', 'calls')} at them that ${calls === 1 ? 'is' : 'are'} not loaded yet`
+ + (calls >= estimate ? `, and each can bring a new node` : `; growing like the last layer it adds about ${estimate.toLocaleString()} nodes`);
+ const kind = past?.limit;
+ return [
+ past && limits && kind ? `Likely past the render limit of ${unit(kind, limits[kind])}.` : '',
+ `Load layer ${layer}: ${count(frontier, 'node', 'nodes')} to expand.`,
+ `${evidence}${kind ? `; ${unit(kind, loaded[kind])} ${loaded[kind] === 1 ? 'is' : 'are'} loaded now` : ''}.`,
+ limits ? `Loading stops after the first request to the index that takes it past ${unit('nodes', limits.nodes)} or ${unit('edges', limits.edges)}, `
+ + `so the layer can end above the limit; it is then marked partial, and the scene draws at most ${unit('nodes', limits.nodes)} and ${unit('edges', limits.edges)}.` : '',
+ ].filter(Boolean).join(' ');
+ },
+ expandPartial: 'This layer stopped loading after it passed the render limit, so there is no complete edge to grow from. Raise the limit under Limits first.',
expandEnd: 'End of trace: no relationship leads further.',
};
diff --git a/graph-ui/src/galaxy/graph-exploration.css b/graph-ui/src/galaxy/graph-exploration.css
index af7b3ff61..d2f665cfd 100644
--- a/graph-ui/src/galaxy/graph-exploration.css
+++ b/graph-ui/src/galaxy/graph-exploration.css
@@ -8,9 +8,10 @@
.atlas-graph-coverage-filter { cursor:pointer; white-space:nowrap; }
.atlas-graph-coverage-filter input { accent-color:#80ac96; }
.atlas-graph-exploration button { appearance:none; padding:.25rem .6rem; font:inherit; line-height:1.4; color:var(--atlas-fg, #cbdbd0); background:rgba(17, 34, 26, .72); border:1px solid var(--atlas-line, #29473a); border-radius:6px; cursor:pointer; }
-.atlas-graph-exploration button:hover:not(:disabled) { background:rgba(68, 112, 86, .24); border-color:#517d65; }
+.atlas-graph-exploration button:hover:not(:disabled, [aria-disabled=true]) { background:rgba(68, 112, 86, .24); border-color:#517d65; }
.atlas-graph-exploration button:focus-visible, .atlas-galaxy-selection-details > summary:focus-visible { outline:2px solid #75ac94; outline-offset:2px; }
-.atlas-graph-exploration button:disabled { opacity:.4; cursor:not-allowed; }
+/* G3: Expand ist gesperrt statt abgeschaltet (aria-disabled), damit Zeiger und Fokus seinen Grund noch lesen; es sieht gleich aus. */
+.atlas-graph-exploration button:is(:disabled, [aria-disabled=true]) { opacity:.4; cursor:not-allowed; }
.atlas-graph-scope-name { max-width:14rem; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.atlas-graph-scope-count { color:#93b2a1; margin-inline-start:auto; font-variant-numeric:tabular-nums; white-space:nowrap; }
.atlas-graph-scope-groups { white-space:nowrap; }
diff --git a/graph-ui/src/galaxy/graph-scope.test.ts b/graph-ui/src/galaxy/graph-scope.test.ts
index 6932308c4..663172fb7 100644
--- a/graph-ui/src/galaxy/graph-scope.test.ts
+++ b/graph-ui/src/galaxy/graph-scope.test.ts
@@ -1,5 +1,5 @@
import { describe, expect, it, vi } from 'vitest';
-import { arrangeScopedGraph, frontierCallCount, graphEdgeTypesKey, hierarchyLabelWidth, limitGraphRender, loadGraphScope, nextLayerEstimate, readGraphPages, scenePictureFor, SCOPED_HIERARCHY_ROW_GAP, scopedHierarchy, type GraphQueryClient } from './graph-scope';
+import { arrangeScopedGraph, expandPastLimit, frontierCallCount, graphEdgeTypesKey, hierarchyLabelWidth, limitGraphRender, loadGraphScope, nextLayerEstimate, readGraphPages, scenePictureFor, SCOPED_HIERARCHY_ROW_GAP, scopedHierarchy, type GraphQueryClient } from './graph-scope';
import type { QueryGraphResult } from '../provider/rpc-schemas';
import type { GraphData, GraphNode } from './types';
@@ -398,6 +398,22 @@ describe('handtest K8: deep layers load in few large pages, report progress and
expect(fresh.mock.calls[0]![1]).toMatch(/^MATCH \(n\) WHERE/);
});
+ /*
+ * Hand test 2026-10-04 (G3): the warning named no reason, and next to it
+ * stood the growth estimate (402 nodes), which alone stays far below the
+ * limit. The warning says which limit it expects to pass, and the calls
+ * counted at the edge drive it when they are the larger number.
+ */
+ it('G3: says which render limit the next layer likely passes and what drives it, and none where no limit applies', () => {
+ const outlook = { layer: 3, frontier: 75, estimate: 402, calls: 9031, loaded: { nodes: 90, edges: 201 }, limits: { nodes: 5000, edges: 20000 } };
+ expect(expandPastLimit(outlook)).toEqual({ limit: 'nodes', by: 'calls' });
+ expect(expandPastLimit({ ...outlook, calls: 10 })).toBeUndefined();
+ expect(expandPastLimit({ ...outlook, calls: undefined, loaded: { nodes: 4700, edges: 9000 } })).toEqual({ limit: 'nodes', by: 'growth' });
+ expect(expandPastLimit({ ...outlook, calls: 3000, loaded: { nodes: 90, edges: 18500 } })).toEqual({ limit: 'edges', by: 'calls' });
+ // The Explore mini-Galaxy loads without render limits: nothing to pass.
+ expect(expandPastLimit({ ...outlook, limits: undefined })).toBeUndefined();
+ });
+
it('estimates the next layer from the frontier and the growth of the last layer', () => {
const nodes = [1, 2, 3, 4, 5, 6, 7].map(id => node(id));
const levels = new Map([[1, 0], [2, 1], [3, 1], [4, 2], [5, 2], [6, 2], [7, 2]]);
diff --git a/graph-ui/src/galaxy/graph-scope.ts b/graph-ui/src/galaxy/graph-scope.ts
index fbeb11c94..1978b7387 100644
--- a/graph-ui/src/galaxy/graph-scope.ts
+++ b/graph-ui/src/galaxy/graph-scope.ts
@@ -289,6 +289,38 @@ export function nextLayerEstimate(scope: ScopedGraph | undefined): { layer: numb
return { layer: scope.depth + 1, frontier, perNode, estimate: Math.round(frontier * perNode) };
}
+/** Was "Expand +1" laden wird, und was dabei schon geladen ist (Handtest 2026-10-04, G3). */
+export interface ExpandOutlook {
+ layer: number;
+ /** Die Randknoten, von denen die naechste Ebene ausgeht. */
+ frontier: number;
+ /** Neue Knoten nach dem Wachstum der letzten Ebene ({@link nextLayerEstimate}). */
+ estimate: number;
+ /** Die noch nicht geladenen Aufrufe am Rand ({@link frontierCallCount}); ohne CALLS im Trace keine Zahl. */
+ calls?: number | undefined;
+ loaded: { nodes: number; edges: number };
+ /** Die Render-Limits; ohne sie (Mini-Galaxy in Explore) laedt eine Ebene ganz. */
+ limits?: { nodes: number; edges: number } | undefined;
+}
+
+/*
+ * Ob die naechste Ebene vermutlich ueber ein Render-Limit fuehrt, und woran
+ * das haengt (G3). Bis hierher stand im Tooltip "Likely past the render limit"
+ * ohne Grund, und daneben die Schaetzung aus dem Wachstum (402 Knoten um
+ * JSONBAgg), die allein weit unter dem Limit blieb: gewarnt hatten die 9.031
+ * gezaehlten Aufrufe. Fuer die Knoten zaehlt die groessere der beiden Zahlen,
+ * jeder Aufruf kann einen neuen Knoten bringen; fuer die Kanten nur die
+ * Aufrufe, denn das Wachstum zaehlt Knoten. Die Knoten gehen vor.
+ */
+export function expandPastLimit(outlook: ExpandOutlook): { limit: 'nodes' | 'edges'; by: 'calls' | 'growth' } | undefined {
+ if (!outlook.limits) return undefined;
+ const calls = outlook.calls ?? 0;
+ const by = outlook.calls !== undefined && calls >= outlook.estimate ? 'calls' as const : 'growth' as const;
+ if (outlook.loaded.nodes + Math.max(outlook.estimate, calls) > outlook.limits.nodes) return { limit: 'nodes', by };
+ if (outlook.loaded.edges + calls > outlook.limits.edges) return { limit: 'edges', by: 'calls' };
+ return undefined;
+}
+
/** Was die Galaxie zeigt, waehrend ein Scope angeordnet wird: das aktuelle
* Bild, sonst die letzte Anordnung, sonst den ganzen Graphen. Eine Anordnung
* ohne Knoten ist kein Bild. Liegt das gewaehlte Symbol ausserhalb des
diff --git a/graph-ui/tools/handtest-fixes-galaxy.mjs b/graph-ui/tools/handtest-fixes-galaxy.mjs
index 88e76f728..3b229621f 100644
--- a/graph-ui/tools/handtest-fixes-galaxy.mjs
+++ b/graph-ui/tools/handtest-fixes-galaxy.mjs
@@ -377,12 +377,13 @@ async function checkK8(page) {
const minus = page.getByRole('button', { name: 'Remove graph layer' });
const expandButton = page.getByRole('button', { name: 'Expand +1' });
// Review: the counted calls at the edge reach the toolbar a moment after the layer is complete.
+ // G3 (2026-10-04): the explanation is the Galaxy's own tooltip (Hint), its text on the button as data-hint, no native title.
await page.waitForFunction(() => /The index lists/.test([...document.querySelectorAll('.atlas-graph-exploration button')]
- .find((el) => el.getAttribute('aria-label') === 'Expand +1')?.title ?? ''), null, { timeout: 10000 }).catch(() => {});
- const expandTitle = await expandButton.getAttribute('title');
+ .find((el) => el.getAttribute('aria-label') === 'Expand +1')?.getAttribute('data-hint') ?? ''), null, { timeout: 10000 }).catch(() => {});
+ const expandTitle = await expandButton.getAttribute('data-hint');
const expandWarning = await expandButton.getAttribute('data-warning');
await check('K8', 'Before layer 3 loads, Expand warns: the index counts the calls waiting at the edge nodes',
- expandWarning === 'true' && /^Likely past the render limit\. Load layer 3: \d+ nodes to expand\. The index lists [\d.,]+ calls at them/.test(expandTitle ?? ''),
+ expandWarning === 'true' && /^Likely past the render limit of [\d.,]+ nodes\. Load layer 3: \d+ nodes to expand\. The index lists [\d.,]+ calls at them/.test(expandTitle ?? ''),
{ expandTitle, expandWarning });
// 1. Abbrechen waehrend die dritte Ebene laedt.
@@ -431,7 +432,7 @@ async function checkK8(page) {
title: await page.locator('.atlas-graph-scope-count').first().getAttribute('title').catch(() => null),
overlayAfter2s: await progressShown(page), queryGraph: queries.length, withCursor: queries.filter((row) => row.cursor).length,
maxRows: [...new Set(queries.map((row) => row.maxRows))], layers: await layerText(page),
- expandDisabled: await expandButton.isDisabled(), expandTitle: await expandButton.getAttribute('title') };
+ expandDisabled: await expandButton.isDisabled(), expandTitle: await expandButton.getAttribute('data-hint') };
await shot(page, 'K8', 'layer3-done-2s', `2 s later: no "Updating view" overlay (${done.overlayAfter2s ? 'still shown' : 'gone'})`);
await check('K8', 'Layer 3 completes (or stops at the render limit with a partial note) within 30 s in few large requests, and the overlay goes away',
['complete', 'partial'].includes(done.state ?? '') && doneMs <= 30000 && done.queryGraph <= 40 && done.overlayAfter2s === '' && done.layers === '3 layers',