-
Notifications
You must be signed in to change notification settings - Fork 1
perf(network-graph): bound relationship and node option materialization #1522
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
seonghobae
wants to merge
22
commits into
develop
Choose a base branch
from
bolt/networkgraph-array-copy-removal-3640017362173775883
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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 593ef10
⚡ Bolt: 프론트엔드 NetworkGraph 성능 향상을 위한 Array.from() 배열 복사 제거
seonghobae c74bc41
⚡ Bolt: 프론트엔드 NetworkGraph 성능 향상을 위한 Array.from() 배열 복사 제거
seonghobae db0d503
성능 개선: 프론트엔드 NetworkGraph 렌더링 루프 병목 제거
seonghobae 1c2fe75
프론트엔드 NetworkGraph 렌더링 최적화 2
seonghobae 3ced640
test: stop treating source break counts as runtime evidence
seonghobae 3f05792
test: verify NetworkGraph option limits at runtime
seonghobae 5f53862
docs(network-graph): remove unsupported O(1) release claim
seonghobae ee55e14
프론트엔드 NetworkGraph 렌더링 성능 향상
seonghobae aa606d2
Trigger CI
seonghobae 9c8da1f
chore: add httpx2 dependency to fix strix check
seonghobae 2d58b23
fix(security): pin Strix httpx2 dependency
seonghobae aa7e195
⚡ Bolt: Replace O(N) Array.from().slice with O(1) bounded loops
seonghobae ff1fbec
refactor(network): adopt canonical bounded-option parent
seonghobae d65b059
test(network): cover bounded graph options
seonghobae f0bf189
Trigger CI again
seonghobae 8883eeb
Re-trigger CI
seonghobae 13f3976
Wait for CI
seonghobae 1158552
test(strix): require exact httpx2 pin
seonghobae fd938c1
fix(strix): restore exact httpx2 pin
seonghobae db577b6
Retry Strix flake
seonghobae 9dafce6
Retry Strix flake 2
seonghobae File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
129 changes: 129 additions & 0 deletions
129
frontend/src/components/NetworkGraph.option-limits.test.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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"); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.