fix(network): correct IoT/Mobile node icon codepoints on graph canvas#544
Conversation
…#495) DEVICE_TYPE_ICONS in NetworkGraph.tsx had drifted from deviceTypeIcon()'s class names (the legend's source): IOT drew bi-lightbulb instead of bi-cpu, MOBILE drew bi-patch-minus-fill instead of bi-phone. Extracts the icon codepoint tables into their own module (nodeIcons.ts, free of the `sigma` import) and adds a regression test that cross-checks every codepoint against the installed bootstrap-icons package and against deviceTypeIcon(), so the two tables can't silently drift again. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 17 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
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. Comment |
There was a problem hiding this comment.
Code Review
This pull request refactors the network graph icons by extracting icon codepoints, generic node types, and the getNodeIcon function from NetworkGraph.tsx into a separate nodeIcons.ts module. This allows unit testing of the codepoints without importing Sigma's WebGL dependencies. A new test suite iconCodepoints.test.ts is introduced to verify that the hardcoded codepoints match the Bootstrap Icon package. The reviewer feedback suggests several improvements to the tests, including: cross-checking NODE_TYPE_ICONS against NODE_TYPE_CONFIG to prevent drift, importing the necessary constants, updating the regex to correctly match the fallback icon (which ends with a semicolon), making the codepoint assertions case-insensitive, and including the fallback icon in the set of verified values.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Summary
NetworkGraph.tsxhardcoded raw Bootstrap Icon codepoints for Sigma's WebGL canvas, hand-copied fromdeviceTypeIcon()'s class names (the legend's source). Two had drifted:IOTdrewbi-lightbulbinstead ofbi-cpu,MOBILEdrewbi-patch-minus-fillinstead ofbi-phone.IOT→,MOBILE→).NODE_TYPE_ICONS,DEVICE_TYPE_ICONS,getNodeIcon,GENERIC_NODE_TYPES) out ofNetworkGraph.tsxinto a newnodeIcons.tsmodule, free of thesigmaimport — this lets them be unit-tested without pulling in Sigma's WebGL dependency (which crashes on import under jsdom).__tests__/iconCodepoints.test.ts, which cross-checks every codepoint against the installedbootstrap-iconspackage (viabootstrap-icons/font/bootstrap-icons.json) and assertsDEVICE_TYPE_ICONSstill agrees withdeviceTypeIcon()'s class names, so the two tables can't silently drift again.Closes #495
Test plan
npm run test— 106/106 passing (including 29 new tests)tsc -b --noEmit— cleannginximage, byte-inspected the built bundle: containsU+F4E7/U+F2D6(correct), neither of the old wrong codepointsMOBILE; verified via bundle codepoint inspection and the same code path confirmed working for IoT instead🤖 Generated with Claude Code