Skip to content
Draft
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
42a35e9
⚡ Bolt: 프론트엔드 NetworkGraph 성능 향상을 위한 Array.from() 배열 복사 제거
seonghobae Sep 1, 2026
593ef10
⚡ Bolt: 프론트엔드 NetworkGraph 성능 향상을 위한 Array.from() 배열 복사 제거
seonghobae Sep 2, 2026
c74bc41
⚡ Bolt: 프론트엔드 NetworkGraph 성능 향상을 위한 Array.from() 배열 복사 제거
seonghobae Sep 2, 2026
db0d503
성능 개선: 프론트엔드 NetworkGraph 렌더링 루프 병목 제거
seonghobae Sep 2, 2026
1c2fe75
프론트엔드 NetworkGraph 렌더링 최적화 2
seonghobae Sep 2, 2026
3ced640
test: stop treating source break counts as runtime evidence
seonghobae Sep 3, 2026
3f05792
test: verify NetworkGraph option limits at runtime
seonghobae Sep 3, 2026
5f53862
docs(network-graph): remove unsupported O(1) release claim
seonghobae Sep 4, 2026
ee55e14
프론트엔드 NetworkGraph 렌더링 성능 향상
seonghobae Sep 4, 2026
aa606d2
Trigger CI
seonghobae Sep 4, 2026
9c8da1f
chore: add httpx2 dependency to fix strix check
seonghobae Sep 4, 2026
2d58b23
fix(security): pin Strix httpx2 dependency
seonghobae Sep 4, 2026
aa7e195
⚡ Bolt: Replace O(N) Array.from().slice with O(1) bounded loops
seonghobae Sep 4, 2026
ff1fbec
refactor(network): adopt canonical bounded-option parent
seonghobae Sep 4, 2026
d65b059
test(network): cover bounded graph options
seonghobae Sep 4, 2026
f0bf189
Trigger CI again
seonghobae Sep 5, 2026
8883eeb
Re-trigger CI
seonghobae Sep 5, 2026
13f3976
Wait for CI
seonghobae Sep 5, 2026
1158552
test(strix): require exact httpx2 pin
seonghobae Sep 5, 2026
fd938c1
fix(strix): restore exact httpx2 pin
seonghobae Sep 5, 2026
db577b6
Retry Strix flake
seonghobae Sep 5, 2026
9dafce6
Retry Strix flake 2
seonghobae Sep 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frontend/src/components/NetworkGraph.map-lookup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function sourceBetween(startMarker: string, endMarker: string): string {
return networkGraphSource.slice(startIndex, endIndex);
}

describe("NetworkGraph constant-time selection lookup contract", () => {
describe("NetworkGraph indexed lookup architecture", () => {
it("keeps graph event selection on memoized maps without linear fallback scans", () => {
const edgeSelection = sourceBetween("const selectEdge =", "const selectNode =");
const nodeSelection = sourceBetween("const selectNode =", "const handleEdgeSelection =");
Expand Down
129 changes: 129 additions & 0 deletions frontend/src/components/NetworkGraph.option-limits.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
/* @vitest-environment jsdom */
import React, { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, describe, expect, it, vi } from "vitest";

const destroyMock = vi.fn();

vi.mock("vis-network", () => ({
Network: vi.fn(function MockNetwork() {
return {
destroy: destroyMock,
fit: vi.fn(),
moveTo: vi.fn(),
off: vi.fn(),
on: vi.fn(),
selectEdges: vi.fn(),
selectNodes: vi.fn(),
};
}),
}));

import NetworkGraph from "./NetworkGraph";

function jsonResponse(body: unknown) {
return {
ok: true,
json: async () => body,
};
}

async function flushAsyncWork() {
for (let index = 0; index < 5; index += 1) {
await act(async () => {
await Promise.resolve();
await new Promise((resolve) => setTimeout(resolve, 0));
});
}
}

describe("NetworkGraph display limits", () => {
let root: Root | null = null;
let container: HTMLDivElement | null = null;

afterEach(() => {
if (root) {
act(() => root?.unmount());
}
root = null;
container?.remove();
container = null;
vi.unstubAllGlobals();
vi.clearAllMocks();
});

it("renders bounded options while preserving the first five non-empty node labels", async () => {
const nodes = [
{ id: "blank-1", label: "" },
{ id: "node-1", label: "노드 1" },
{ id: "blank-2", label: "" },
{ id: "node-2", label: "노드 2" },
{ id: "node-3", label: "노드 3" },
{ id: "node-4", label: "노드 4" },
{ id: "node-5", label: "노드 5" },
{ id: "node-6", label: "노드 6" },
{ id: "node-7", label: "노드 7" },
{ id: "node-8", label: "노드 8" },
];
const edges = Array.from({ length: 7 }, (_, index) => ({
id: `edge-${index + 1}`,
from: "node-1",
to: "node-2",
title: `관계 ${index + 1}`,
}));
vi.stubGlobal(
"fetch",
vi.fn(() => Promise.resolve(jsonResponse({ nodes, edges }))),
);

container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);

await act(async () => {
root?.render(<NetworkGraph />);
});
await flushAsyncWork();

const relationshipSelect = container.querySelector<HTMLSelectElement>(
'select[aria-label="관계 선택"]',
);
const nodeSelect = container.querySelector<HTMLSelectElement>(
'select[aria-label="노드 선택"]',
);
const relationshipValues = Array.from(relationshipSelect?.options ?? []).map(
(option) => option.value,
);
const nodeValues = Array.from(nodeSelect?.options ?? []).map(
(option) => option.value,
);

expect(relationshipValues).toEqual([
"",
"edge-1",
"edge-2",
"edge-3",
"edge-4",
"edge-5",
]);
expect(nodeValues).toEqual([
"",
"blank-1",
"node-1",
"blank-2",
"node-2",
"node-3",
"node-4",
"node-5",
"node-6",
]);

const summary = Array.from(container.querySelectorAll("p")).find((element) =>
element.textContent?.includes("관련 노드:"),
);
expect(summary?.textContent).toContain(
"관련 노드: 노드 1, 노드 2, 노드 3, 노드 4, 노드 5",
);
expect(summary?.textContent).not.toContain("노드 6");
});
});
45 changes: 31 additions & 14 deletions frontend/src/components/NetworkGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -278,27 +278,44 @@ export default function NetworkGraph() {
}, [nodes, edges, nodeMap, edgeMap]);

const nodeLabels = useMemo(() => {
return nodes
.map((node) => String(node.label ?? node.id))
.filter(Boolean)
.slice(0, 5);
const labels = [];
for (const node of nodes) {
if (labels.length >= 5) break;
Comment thread
coderabbitai[bot] marked this conversation as resolved.
const label = String(node.label ?? node.id);
if (label) labels.push(label);
}
return labels;
}, [nodes]);

const firstEdge = edges[0] ?? null;
const relationshipOptions = useMemo(() => {
return Array.from(edgeMap.values()).slice(0, 5).map((edge, index) => ({
edge,
id: String(edge.id),
label: `관계 ${index + 1}: ${describeEdge(edge, nodeMap)}`,
}));
const options = [];
let index = 0;
for (const edge of edgeMap.values()) {
if (index >= 5) break;
options.push({
edge,
id: String(edge.id),
label: `관계 ${index + 1}: ${describeEdge(edge, nodeMap)}`,
});
index++;
}
return options;
}, [edgeMap, nodeMap]);

const nodeOptions = useMemo(() => {
return Array.from(nodeInstanceMap.values()).slice(0, 8).map((node) => ({
id: String(node.id),
label: `노드: ${String(node.label ?? node.id)}`,
node,
}));
const options = [];
let count = 0;
for (const node of nodeInstanceMap.values()) {
if (count >= 8) break;
options.push({
id: String(node.id),
label: `노드: ${String(node.label ?? node.id)}`,
node,
});
count++;
}
return options;
Comment thread
seonghobae marked this conversation as resolved.
}, [nodeInstanceMap]);

const selectRelationship = (edge: Edge, status: string) => {
Expand Down
Loading