Skip to content

feat: Full Path Highlight - BED-8246#2812

Open
specter-flq wants to merge 2 commits into
mainfrom
BED-8246--full-path-highlight
Open

feat: Full Path Highlight - BED-8246#2812
specter-flq wants to merge 2 commits into
mainfrom
BED-8246--full-path-highlight

Conversation

@specter-flq
Copy link
Copy Markdown
Contributor

@specter-flq specter-flq commented May 22, 2026

Description

  • Added full path highlight to graph. When user clicks on entity it fades everything but inbound and outbound relationships

  • Added the ability to disable this feature via local storage. It reads of a local storage key and will default to true. Will only disable the feature if it's explicitly set to false.

Motivation and Context

Resolves BED-8246

How Has This Been Tested?

Existing and new tests passed.

Screenshots (optional):

Screenshot 2026-05-22 at 12 53 21 PM

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

Summary by CodeRabbit

  • New Features

    • Enhanced graph highlighting: selecting a node or edge now highlights its full connected path and dims unrelated items, with dimming tuned for dark/light themes.
    • Added a user-controllable explore-graph highlight toggle (persists in app view settings).
  • Tests

    • Added unit tests validating path detection and highlighting behavior for nodes and edges across graph scenarios.

Review Change Stack

@specter-flq specter-flq self-assigned this May 22, 2026
@specter-flq specter-flq added the user interface A pull request containing changes affecting the UI code. label May 22, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR adds graph highlighting utilities, unit tests, Redux state/actions/types for an explore-graph highlight flag, and integrates memoized full-path highlight computations into SigmaChart's GraphEvents to drive selective node/edge dimming with theme-aware shader parameters.

Changes

Explore graph highlight dimming

Layer / File(s) Summary
Redux types and action contracts
cmd/ui/src/ducks/global/types.ts
Introduces GLOBAL_SET_IS_EXPLORE_GRAPH_HIGHLIGHT, adds isExploreGraphHighlight: boolean to GlobalViewState, and extends GlobalViewActionTypes with SetIsExploreGraphHighlightAction.
Redux action, reducer, and initial state
cmd/ui/src/ducks/global/actions.ts, cmd/ui/src/ducks/global/reducer.ts
Adds setIsExploreGraphHighlight action creator, updates initialGlobalState to include isExploreGraphHighlight (removes legacy explore-layout selected field/import), and adds reducer case to handle GLOBAL_SET_IS_EXPLORE_GRAPH_HIGHLIGHT.
Graph highlighting utilities and tests
cmd/ui/src/components/SigmaChart/utils.tsx, cmd/ui/src/components/SigmaChart/utils.test.tsx
Adds getIsHighlightedItemInGraph to detect node/edge existence and getFullPathHighlightedEntities to compute full inbound/outbound node and edge ID sets for a selected item, with tests covering nodes (various positions), edges, isolated nodes, unknown IDs, and null input.
GraphEvents component dimming integration
cmd/ui/src/components/SigmaChart/GraphEvents.tsx
Imports highlight utilities and color-blending helpers; reads isExploreGraphHighlight, darkMode, and theme; memoizes isHighlightedItemInGraph, highlightedNodeIds, and highlightedEdgeIds; updates node/edge reducers to apply dimming only when the flag is enabled and targets are outside the computed full-path sets; adds shader/background dim parameters and expands effect dependencies.

Sequence Diagram

sequenceDiagram
  participant Client as GraphEvents(Component)
  participant Redux as Redux Selector
  participant IsInGraph as getIsHighlightedItemInGraph
  participant FullPath as getFullPathHighlightedEntities
  participant Graph as GraphologyGraph
  Client->>Redux: read highlightedItem, isExploreGraphHighlight, theme/darkMode
  Client->>IsInGraph: (graph, highlightedItem)
  IsInGraph->>Graph: hasNode / hasEdge
  Graph-->>IsInGraph: boolean
  Client->>FullPath: (graph, highlightedItem) [if in graph]
  FullPath->>Graph: outEdges / inEdges / extremities
  Graph-->>FullPath: nodes/edges
  FullPath-->>Client: highlightedNodeIds, highlightedEdgeIds
  Client->>Client: update node/edge reducers -> apply dimming/shaders
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • catsiller
  • TheNando
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: Full Path Highlight - BED-8246' clearly summarizes the main change: adding full path highlight functionality to the graph visualization, with the associated ticket reference.
Description check ✅ Passed The PR description covers all required template sections: clear description of changes, motivation with ticket reference (BED-8246), testing information, type of change marked, and checklist items completed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch BED-8246--full-path-highlight

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 and usage tips.

@coderabbitai coderabbitai Bot added the enhancement New feature or request label May 22, 2026
@specter-flq specter-flq force-pushed the BED-8246--full-path-highlight branch from c18fbb6 to 89a5da2 Compare May 22, 2026 16:19
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
cmd/ui/src/components/SigmaChart/GraphEvents.tsx (2)

291-303: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Apply computed isDimmed to reducer output.

isDimmed is calculated but never returned, so non-highlighted nodes/edges are not actually dimmed.

💡 Proposed fix
             nodeReducer: (node, data) => {
@@
                 return {
                     ...data,
+                    isDimmed,
                     highlighted: node === highlightedItem,
                     inverseSqrtZoomRatio: 1 / Math.sqrt(camera.ratio),
                 };
             },
@@
                 const newData: Attributes = {
                     ...data,
                     hidden: false,
+                    isDimmed,
                     highlighted: edge === highlightedItem,
                     inverseSqrtZoomRatio: 1 / Math.sqrt(camera.ratio),
                 };

Also applies to: 305-318

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx` around lines 291 - 303, The
computed isDimmed flag in the nodeReducer (and likewise in edgeReducer) is not
included in the returned data object, so dimming never takes effect; update the
return value of nodeReducer (and the analogous return in edgeReducer) to spread
the existing data and include a property (e.g., dimmed: isDimmed) or set
highlighted/dimmed appropriately so the UI can read the dim state (reference
nodeReducer, edgeReducer, highlightedItem, highlightedNodeIds, and
isExploreGraphHighlight).

19-19: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Fix missing useMemo import (build-breaking)

useMemo is used in cmd/ui/src/components/SigmaChart/GraphEvents.tsx (e.g., lines ~281 and ~286) but isn’t imported from React; the useEffect block around ~289 is already syntactically correct and already has a dependency array.

Proposed fix
-import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useState } from 'react';
+import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useMemo, useState } from 'react';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx` at line 19, The file uses
React's useMemo (around the hooks at ~281 and ~286) but the top import list in
GraphEvents.tsx only imports forwardRef, useCallback, useEffect,
useImperativeHandle, useLayoutEffect, useState; add useMemo to that import list
so useMemo is imported from React (i.e., update the import statement to include
useMemo) and re-run the build to confirm the missing-import error is resolved.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx`:
- Around line 291-303: The computed isDimmed flag in the nodeReducer (and
likewise in edgeReducer) is not included in the returned data object, so dimming
never takes effect; update the return value of nodeReducer (and the analogous
return in edgeReducer) to spread the existing data and include a property (e.g.,
dimmed: isDimmed) or set highlighted/dimmed appropriately so the UI can read the
dim state (reference nodeReducer, edgeReducer, highlightedItem,
highlightedNodeIds, and isExploreGraphHighlight).
- Line 19: The file uses React's useMemo (around the hooks at ~281 and ~286) but
the top import list in GraphEvents.tsx only imports forwardRef, useCallback,
useEffect, useImperativeHandle, useLayoutEffect, useState; add useMemo to that
import list so useMemo is imported from React (i.e., update the import statement
to include useMemo) and re-run the build to confirm the missing-import error is
resolved.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: f113ee71-4d2d-48ba-be0d-03d7a11c416a

📥 Commits

Reviewing files that changed from the base of the PR and between 791ff65 and c18fbb6.

📒 Files selected for processing (7)
  • cmd/ui/src/components/SigmaChart/GraphEvents.tsx
  • cmd/ui/src/components/SigmaChart/utils.test.tsx
  • cmd/ui/src/components/SigmaChart/utils.tsx
  • cmd/ui/src/ducks/global/actions.ts
  • cmd/ui/src/ducks/global/reducer.ts
  • cmd/ui/src/ducks/global/types.ts
  • cmd/ui/src/store.ts

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
cmd/ui/src/components/SigmaChart/GraphEvents.tsx (2)

295-305: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Wire isDimmed into reducer output.

Line 295 and Line 309 compute isDimmed, but the returned node/edge data never uses it, so the fade behavior is effectively a no-op.

🔧 Proposed fix
             return {
                 ...data,
                 highlighted: node === highlightedItem,
+                dimmed: Boolean(isDimmed),
                 inverseSqrtZoomRatio: 1 / Math.sqrt(camera.ratio),
             };
         },
@@
                 const newData: Attributes = {
                     ...data,
                     hidden: false,
                     highlighted: edge === highlightedItem,
+                    dimmed: Boolean(isDimmed),
                     inverseSqrtZoomRatio: 1 / Math.sqrt(camera.ratio),
                 };

Also applies to: 309-320

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx` around lines 295 - 305, The
computed isDimmed flag (from isExploreGraphHighlight, highlightedItem,
highlightedNodeIds, isHighlightedItemInGraph) is never added to the reducer
output so fade behavior is a no-op; update the reducer return for node and edge
data (the object that currently spreads data and sets highlighted and
inverseSqrtZoomRatio) to include isDimmed: isDimmed so downstream renderers can
use it, and do the same for the other block around lines 309–320 where an
equivalent isDimmed is computed.

19-20: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Import missing hooks before use in GraphEvents.tsx

  • useMemo is used (around lines 281–289) but isn’t imported in the react import (line 19) → TS compile break; add useMemo to the React import.
  • useTheme() is used (around line 96) but there’s no useTheme import from @mui/material/styles; ensure useTheme is imported from the correct module so it’s in scope.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx` around lines 19 - 20, The
file GraphEvents.tsx is missing two imports used later: add useMemo to the React
import list (alongside forwardRef, useCallback, etc.) so the hook referenced
around the useMemo block compiles, and import useTheme from
'`@mui/material/styles`' so the call to useTheme() around the theme-related logic
is in scope; update the import statements at the top of GraphEvents.tsx to
include useMemo in the React import and add a named import { useTheme } from
'`@mui/material/styles`'.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@cmd/ui/src/components/SigmaChart/utils.test.tsx`:
- Around line 1-2: The test file cmd/ui/src/components/SigmaChart/utils.test.tsx
is missing the required license/header which is failing CI; add the project's
standard license header comment block at the very top of this file (above all
imports) so the header is present for all test files — no change to the existing
imports or tests (e.g., MultiDirectedGraph import or references to
getFullPathHighlightedEntities and getIsHighlightedItemInGraph) is required.

In `@cmd/ui/src/components/SigmaChart/utils.tsx`:
- Around line 1-2: Add the project's standard license header to the top of the
file to match the automated header generation; open
cmd/ui/src/components/SigmaChart/utils.tsx and insert the required license block
as the very first lines so CI's Code Generation Check no longer flags the file,
ensuring the header format exactly matches other files in the repo (same comment
style and year/owner placeholders).

---

Outside diff comments:
In `@cmd/ui/src/components/SigmaChart/GraphEvents.tsx`:
- Around line 295-305: The computed isDimmed flag (from isExploreGraphHighlight,
highlightedItem, highlightedNodeIds, isHighlightedItemInGraph) is never added to
the reducer output so fade behavior is a no-op; update the reducer return for
node and edge data (the object that currently spreads data and sets highlighted
and inverseSqrtZoomRatio) to include isDimmed: isDimmed so downstream renderers
can use it, and do the same for the other block around lines 309–320 where an
equivalent isDimmed is computed.
- Around line 19-20: The file GraphEvents.tsx is missing two imports used later:
add useMemo to the React import list (alongside forwardRef, useCallback, etc.)
so the hook referenced around the useMemo block compiles, and import useTheme
from '`@mui/material/styles`' so the call to useTheme() around the theme-related
logic is in scope; update the import statements at the top of GraphEvents.tsx to
include useMemo in the React import and add a named import { useTheme } from
'`@mui/material/styles`'.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 774d9ef1-e162-4fc2-9927-497c0a86458d

📥 Commits

Reviewing files that changed from the base of the PR and between c18fbb6 and 89a5da2.

📒 Files selected for processing (7)
  • cmd/ui/src/components/SigmaChart/GraphEvents.tsx
  • cmd/ui/src/components/SigmaChart/utils.test.tsx
  • cmd/ui/src/components/SigmaChart/utils.tsx
  • cmd/ui/src/ducks/global/actions.ts
  • cmd/ui/src/ducks/global/reducer.ts
  • cmd/ui/src/ducks/global/types.ts
  • cmd/ui/src/store.ts

Comment thread cmd/ui/src/components/SigmaChart/utils.test.tsx
Comment thread cmd/ui/src/components/SigmaChart/utils.tsx
@specter-flq specter-flq force-pushed the BED-8246--full-path-highlight branch from 89a5da2 to d1e77ee Compare May 22, 2026 16:48
@specter-flq specter-flq marked this pull request as draft May 22, 2026 17:06
@specter-flq specter-flq force-pushed the BED-8246--full-path-highlight branch from 5da52de to bbb65b2 Compare May 22, 2026 18:52
@specter-flq specter-flq marked this pull request as ready for review May 22, 2026 18:52
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cmd/ui/src/components/SigmaChart/utils.tsx (1)

45-47: ⚡ Quick win

Replace shift()-based BFS queues to avoid quadratic traversal cost.

Using Array.shift() in both BFS loops can degrade to O(n²) on large paths. Switch to index-based queue iteration.

♻️ Proposed fix
-            const outboundQueue: string[] = [highlightedItem];
-            while (outboundQueue.length > 0) {
-                const current = outboundQueue.shift()!;
+            const outboundQueue: string[] = [highlightedItem];
+            for (let i = 0; i < outboundQueue.length; i++) {
+                const current = outboundQueue[i];
                 graph.outEdges(current).forEach((edge) => {
                     highlightedEdgeIds.add(edge);
                     const neighbor = graph.target(edge);
                     if (!highlightedNodeIds.has(neighbor)) {
                         highlightedNodeIds.add(neighbor);
                         outboundQueue.push(neighbor);
                     }
                 });
             }

             // Inbound BFS: follow edges pointing toward (target → source).
             // Uses its own visited set so outbound discoveries don't cause early stops.
             const inboundVisited = new Set<string>([highlightedItem]);
-            const inboundQueue: string[] = [highlightedItem];
-            while (inboundQueue.length > 0) {
-                const current = inboundQueue.shift()!;
+            const inboundQueue: string[] = [highlightedItem];
+            for (let i = 0; i < inboundQueue.length; i++) {
+                const current = inboundQueue[i];
                 graph.inEdges(current).forEach((edge) => {
                     highlightedEdgeIds.add(edge);
                     const neighbor = graph.source(edge);
                     if (!inboundVisited.has(neighbor)) {
                         inboundVisited.add(neighbor);
                         highlightedNodeIds.add(neighbor);
                         inboundQueue.push(neighbor);
                     }
                 });
             }

Also applies to: 61-63

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@cmd/ui/src/components/SigmaChart/utils.tsx` around lines 45 - 47, The BFS
loops use Array.shift() which can lead to O(n²) behavior; replace both
shift()-based queues (the outboundQueue used around highlightedItem and the
other inbound/outbound queue at the 61-63 region) with index-based iteration:
initialize an index (e.g., let i = 0) and loop while i < queue.length,
retrieving the current element via queue[i++] instead of queue.shift(); update
any null/non-null assertions (e.g., the current variable) and preserve the
existing queue push logic and types so the traversal semantics remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@cmd/ui/src/components/SigmaChart/utils.tsx`:
- Around line 45-47: The BFS loops use Array.shift() which can lead to O(n²)
behavior; replace both shift()-based queues (the outboundQueue used around
highlightedItem and the other inbound/outbound queue at the 61-63 region) with
index-based iteration: initialize an index (e.g., let i = 0) and loop while i <
queue.length, retrieving the current element via queue[i++] instead of
queue.shift(); update any null/non-null assertions (e.g., the current variable)
and preserve the existing queue push logic and types so the traversal semantics
remain unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 67731e87-51a0-41a8-9421-725b567b7735

📥 Commits

Reviewing files that changed from the base of the PR and between 5da52de and bbb65b2.

📒 Files selected for processing (6)
  • cmd/ui/src/components/SigmaChart/GraphEvents.tsx
  • cmd/ui/src/components/SigmaChart/utils.test.tsx
  • cmd/ui/src/components/SigmaChart/utils.tsx
  • cmd/ui/src/ducks/global/actions.ts
  • cmd/ui/src/ducks/global/reducer.ts
  • cmd/ui/src/ducks/global/types.ts

@specter-flq specter-flq force-pushed the BED-8246--full-path-highlight branch from 14a6b65 to 1ad31a2 Compare May 22, 2026 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request user interface A pull request containing changes affecting the UI code.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants