Repository navigation
fix(web): restore entity type colors in knowledge graphs - #21443
Conversation
|
Important Review skippedReview was skipped as selected files did not have any reviewable changes.
|
| Layer / File(s) | Summary |
|---|---|
Graph label callback and escaping web/src/components/artifact-force-graph/types.ts, web/src/components/artifact-force-graph/index.tsx, web/src/components/artifact-force-graph/__tests__/index.test.tsx |
ArtifactForceGraph accepts a label callback and defaults to entity descriptions. It escapes callback output before passing it to ForceGraph2D. Tests cover labels, graph-data identity, node colors, and zoom-fit calls. |
Knowledge graph labels and color palette web/src/components/structure-graph/use-knowledge-graph-node-style.ts, web/tailwind.css, web/src/components/structure-graph/__tests__/knowledge-graph-node-style.test.ts |
The style helpers format labels and assign colors using normalized entity types and CSS palette tokens. Tests cover label formatting, palette selection, and callback stability. |
Renderer callback wiring web/src/components/structure-graph/representation-renderer.tsx, web/src/components/structure-graph/__tests__/representation-renderer.test.tsx |
RepresentationRenderer passes node color and label callbacks to ArtifactForceGraph for KnowledgeGraph templates. Tests check callback identity and templates without the callbacks. |
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Possibly related issues
- [Feature Request]: Please add the color back to Graph #21375 requests graph entity colors. This change adds categorical colors based on knowledge-graph entity types.
Suggested reviewers: qaqadws
Merge Risk: 
Minimal · previous review dad6c
-
No actionable merge-blocking issue is established; the change is ready for normal merge checks.
Pre-merge checks: 
4 · 
1
-
Failed checks: 1 warning Passed checks: 4 passed-
Full details: Title check
-
Explanation
The title "fix(web): restore entity type colors in knowledge graphs" matches the main change. The PR assigns stable, type-based colors to knowledge graph nodes (ten-color palette with a gray fallback for blank types and
other) and shows the entity type in tooltips. The title is concise, specific, and follows a conventional-commit style. The word "restore" implies the colors existed before, which the linked issue#21375is expected to confirm. The summary does not describe the tooltip change, but the title does not need to cover every detail.
Full details: Description check
-
Explanation
The description follows the required template. It includes a "Summary" section that explains the problem context (issue
#21375), the approach (stable type-based colors, ten-color palette, gray fallback), the tooltip behavior, and the scope limits. It also adds a "Validation" section with test, lint, and browser-check results, which goes beyond the template. The description is complete and specific.
-
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
A rabbit sees the node colors glow
Type and description join the show
Safe labels travel to the graph
Ten bright hues fill each path
The rabbit hops through data’s flow
8363b3d to
998118b
Compare
Summary
Addresses #21375 by assigning knowledge graph nodes stable colors based on their entity type. Colors stay consistent when nodes are reordered or a graph subset is displayed. Blank types and
otheruse gray.Tooltips show the original entity type alongside its description, with plain text escaped before rendering. The palette has ten colors, so different types can share a color; the tooltip provides the exact type.
The change is limited to knowledge graph rendering. Wiki and session graph defaults, graph layout, and existing hover and pinned-node highlighting remain unchanged. No new dependencies or backend changes are required.
Validation
git diff --check, and the pre-commit hooks passed.176e91d7produces the same diagnostics, with no differences.