[CHAIN] refactor(ui): normalize graph edge types and remove dead code#10701
Conversation
- Narrow GraphEdge.source/target from string | object to string - Remove typeof guards in adapter, graph component, and utilities - Remove unused panX, panY, zoomLevel fields from graph state store - Delete orphaned NodeRelationships component (never integrated) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
105bc5f to
86bd153
Compare
…n' into PROWLER-1373/normalize-data
Code reviewA couple of questions before this lands — both non-blocking, just want to make sure the cleanup closes fully: 1. ui/components/ui/nav-bar/navbar.tsx#L17-L20 What bug is this fixing? A static string 2. Orphaned ui/types/attack-paths.ts#L252-L255 After deleting |
A literal string key on <Suspense> never changes, so it does not remount the boundary or reset the fallback. Removing the line.
NodeDetailData, RelatedFinding, FINDING_SEVERITIES and FINDING_STATUSES have no remaining producers or consumers after prior cleanup. Dropping the full chain.
|
ba84b23
into
PROWLER-1273/react-flow-migration
Alan-TheGentleman
left a comment
There was a problem hiding this comment.
- The string-only edge contract needs test coverage. This refactor removes every fallback path for
GraphEdge.sourceandGraphEdge.target, so we need one automated test that provesadaptQueryResultToGraphData()always emits string IDs and one test that exercisescomputeFilteredSubgraph()against that normalized shape. Without that guardrail, a legacy edge payload with{ id }would break the graph silently.
…#10701) Co-authored-by: Pablo F.G <pablo.fernandez@prowler.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
🔗 Part of Chained PRs
PROWLER-1273/react-flow-migrationChain Overview
Context
Preparatory cleanup for the React Flow migration (#10686). Normalizes the graph data layer and removes dead code before introducing any new library dependencies.
Part of chained PRs for Replace D3+Dagre attack path graph with React Flow. This sub-task ensures the data layer is clean and type-safe before PR1 introduces React Flow rendering.
Description
Net result: -198 lines, zero visual/functional change.
Changes:
Data normalization:
GraphEdge.source/targettype fromstring | objecttostring— the adapter already guaranteed strings, but the type was unnecessarily widetypeofguards across 5 files (adapter, graph component, utilities, node relationships, graph-utils)getEdgeNodeId()helper andEdgeNodeReftype — replaced by directedge.source/edge.targetaccessDead code removal:
panX,panY,zoomLevel,setZoom(),setPan(),updateZoomAndPan()from Zustand graph state store (never consumed by any component)NodeRelationshipscomponent (exported but never imported by any parent component)Steps to review
ui/types/attack-paths.ts—sourceandtargetnarrowed tostringquery-result.adapter.ts,attack-path-graph.tsx,graph-utils.tsuse-graph-state.tsNodeRelationshipswas indeed orphaned (search for imports — none exist outside its own barrel)pnpm typecheckpassesChecklist
Community Checklist
SDK/CLI
UI
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.