Skip to content

perf(network): reuse the node map for selection labels - #1358

Closed
seonghobae wants to merge 2 commits into
developfrom
fix/network-graph-node-map-selection
Closed

perf(network): reuse the node map for selection labels#1358
seonghobae wants to merge 2 commits into
developfrom
fix/network-graph-node-map-selection

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Summary

  • replace both post-selection node-label rescans with the existing memoized nodeMap;
  • preserve the current visible-label fallback by returning the selected node identifier when a map entry is absent;
  • add a focused regression that binds both graph-event and control-selection handlers to the constant-time lookup contract.

Test-first boundary

The RED commit bd42057a0b0b7f9626189f48b9c627dd1170d339 added the focused contract before production code changed. Protected develop still called findNodeLabel() from both handlers, so the regression required behavior absent from the predecessor.

The implementation commit 61781b70185799f6901c19e092fef36b766aa3db changes only those two label-resolution expressions. Existing rendered interaction coverage in NetworkGraph.test.tsx continues to verify the Korean node detail and control behavior.

Scope integrity

Base: develop@bc98789521d21271e84789888413c182aa111b4d

Changed files:

  • frontend/src/components/NetworkGraph.node-map.test.ts
  • frontend/src/components/NetworkGraph.tsx

This clean current-base replacement preserves the intended unique optimization from #1342 without carrying that branch's unrelated container, release-workflow, text-safety, dependency-pin, and repository-governance changes.

Merge gate

Merge only after the unchanged exact head passes all live repository and organization exact-head checks, all actionable review findings are resolved, and qualifying independent approval satisfies the protected-branch rules. Queued, pending, skipped, cancelled, predecessor-head, model-only, status-only, or author-only evidence is non-passing.

Supersedes #1342.

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@seonghobae, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Limit details: You’ve used all 1 included review currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 4127ab46-f525-4a4f-afd7-eb20189b000d

📥 Commits

Reviewing files that changed from the base of the PR and between bc98789 and 61781b7.

📒 Files selected for processing (2)
  • frontend/src/components/NetworkGraph.node-map.test.ts
  • frontend/src/components/NetworkGraph.tsx

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 15, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please perform a fresh formal review of unchanged exact head 61781b70185799f6901c19e092fef36b766aa3db. All six repository workflows are terminal-success, and there are no formal reviews or review threads. Verify the bounded two-file constant-time node-label lookup repair.

@coderabbitai

coderabbitai Bot commented Aug 16, 2026

Copy link
Copy Markdown
Contributor
🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Checked-out commit =='
git rev-parse HEAD
git status --short
git show --no-patch --format='commit=%H%nparents=%P%nsubject=%s' HEAD

echo
echo '== Diff against declared base =='
git diff --stat bc98789521d21271e84789888413c182aa111b4d..61781b70185799f6901c19e092fef36b766aa3db
git diff --name-status bc98789521d21271e84789888413c182aa111b4d..61781b70185799f6901c19e092fef36b766aa3db
git diff --no-ext-diff --unified=80 bc98789521d21271e84789888413c182aa111b4d..61781b70185799f6901c19e092fef36b766aa3db -- \
  frontend/src/components/NetworkGraph.tsx \
  frontend/src/components/NetworkGraph.node-map.test.ts

echo
echo '== Source structure =='
ast-grep outline frontend/src/components/NetworkGraph.tsx --items all
echo
echo '== Source: nodeMap and selection-label paths =='
rg -n -C 12 -e '\bnodeMap\b' -e '\bfindNodeLabel\s*\(' -e 'selectedNode' -e 'onNodeClick|onSelection' frontend/src/components/NetworkGraph.tsx

echo
echo '== Focused regression structure and assertions =='
ast-grep outline frontend/src/components/NetworkGraph.node-map.test.ts --items all
cat -n frontend/src/components/NetworkGraph.node-map.test.ts

echo
echo '== PR state, checks, reviews, and review threads =='
gh pr view 1358 --repo ContextualWisdomLab/naruon --json number,headRefOid,baseRefOid,state,isDraft,mergeStateStatus,reviews,statusCheckRollup \
  --jq '{number, headRefOid, baseRefOid, state, isDraft, mergeStateStatus, reviews: [.reviews[] | {author: .author.login, state: .state, commit: .commit.oid}], checks: [.statusCheckRollup[] | {name: .name, status: .status, conclusion: .conclusion, workflowName: .workflowName}]}'
gh api graphql -F owner='ContextualWisdomLab' -F name='naruon' -F number=1358 -f query='
query($owner: String!, $name: String!, $number: Int!) {
  repository(owner: $owner, name: $name) {
    pullRequest(number: $number) {
      reviewThreads(first: 100) {
        nodes { isResolved comments(first: 20) { nodes { author { login } body } } }
      }
    }
  }
}' --jq '[.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false) | {comments: [.comments.nodes[] | {author: .author.login, body: .body}]}]'

Length of output: 29141


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo '== Candidate test and package configuration files =='
fd -H -t f -a -E node_modules -E .git \
  '^(package\.json|vite\.config\..*|vitest\.config\..*|.*vitest.*\.(ts|js|mts|mjs|cts|cjs))$' . \
  | sort

echo
echo '== Frontend package test scripts =='
if [ -f frontend/package.json ]; then
  python3 - <<'PY'
import json
from pathlib import Path
path = Path("frontend/package.json")
data = json.loads(path.read_text())
print(json.dumps({
    "name": data.get("name"),
    "scripts": {k: v for k, v in data.get("scripts", {}).items() if "test" in k.lower()},
    "devDependencies": {k: v for k, v in data.get("devDependencies", {}).items() if "vitest" in k.lower()},
    "dependencies": {k: v for k, v in data.get("dependencies", {}).items() if "vitest" in k.lower()},
}, indent=2))
PY
fi

echo
echo '== Vitest discovery settings =='
rg -n -i -C 8 \
  -e '\bvitest\b' -e '\btest\s*:' -e '\binclude\b' -e '\bexclude\b' \
  -g 'package.json' \
  -g 'vite.config.*' \
  -g 'vitest.config.*' \
  -g '*vitest*.*' \
  frontend .

Length of output: 8495


@seonghobae Formal review completed for exact head 61781b70185799f6901c19e092fef36b766aa3db.

I found no actionable findings in the bounded two-file change.

  • The diff is limited to NetworkGraph.tsx and NetworkGraph.node-map.test.ts.
  • Both graph-event and control-selection handlers use nodeMap.get(String(...)).
  • Both handlers retain the required identifier fallback with ?? String(...).
  • The map preserves the previous first-match behavior for normalized duplicate node identifiers.
  • The focused Vitest test covers both handlers and is included by the frontend test discovery configuration.
  • There are no unresolved review threads.

GitHub currently reports metadata-only gate evaluation as IN_PROGRESS. Therefore, the live check evidence is not yet fully terminal-success. I did not approve the pull request.

⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor Author

@opencode-agent @cwl-noema-review

Review only. Re-evaluate unchanged exact head 61781b70185799f6901c19e092fef36b766aa3db against current develop@bc98789521d21271e84789888413c182aa111b4d. All six repository workflows are terminal-success and there are no formal reviews or review threads. Do not update branches, enable auto-merge, merge, or write source. Submit a formal current-head review of the bounded constant-time node-label lookup repair.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overlap note

#1358 61781b70 is a valid node-label-only slice (nodeMap.get for selectNode / selectGraphNode). It is not the merge tip.

#1382 e74695e5 already includes that label reuse, plus first-wins edgeMap / nodeInstanceMap, rendered vis-network selectNode / selectEdge coverage, and the colliding-id contract that #1377 left last-wins.

Do not merge #1358 or #1377 in parallel with #1382. Close or hold this PR once #1382 is the named landing head. No approval.

View PR

Open in Web View Automation 

Sent by Cursor Automation: Fix Issues

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #1382 after exact source/test comparison.

The successor preserves this PR's two node-label lookup changes in both the graph-event and control-selection paths (nodeMap.get(String(...)) ?? String(...)) and extends the same constant-time contract to edge and node-instance selection. Its focused NetworkGraph.map-lookup.test.ts explicitly rejects findNodeLabel() and linear .find() fallbacks in both node-selection paths, while also testing first-wins collision behavior that this narrower slice does not cover.

No code or test from this PR needs to land independently. #1382 remains Draft and must still satisfy its own exact-head checks, review resolution, independent approval, and protected merge gate.

@seonghobae seonghobae closed this Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant