Skip to content

refactor(ui): prune orphaned hand-rolled service-map helpers#112

Merged
aksOps merged 1 commit into
mainfrom
ui/prune-dead-map-helpers
Jun 18, 2026
Merged

refactor(ui): prune orphaned hand-rolled service-map helpers#112
aksOps merged 1 commit into
mainfrom
ui/prune-dead-map-helpers

Conversation

@aksOps

@aksOps aksOps commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #111 (React Flow service-map migration). That PR moved layout interaction (pan/zoom/fit/keyboard-walk/edge drawing) to React Flow but left the old hand-rolled implementations behind in ui/src/lib/ as dead code: 0 production references, kept compiling only by their own unit tests and tree-shaken out of the shipped bundle.

Removed

  • dagLayout.tslayoutGraph (+ its private sanitizeEdges/dfsKeepForwardEdges/breakCycles/assignLayers/orderLayers), graphSetHash, fitTransform, zoomAt, walkFrom, edgePath; the Transform/WalkDir types; the GAP_Y/MIN_ZOOM/MAX_ZOOM constants.
  • radialLayout.tswalkRadial (+ private center/angleOf/nearestOnRing).
  • Both __tests__ files trimmed to the kept exports.

Kept (still consumed by FlowMap + layoutRadial)

GraphEdgeRef / LayoutNode / Layout types, NODE_W / NODE_H / GAP_X, compareIds, edgeWidth, neighborsOf, and layoutRadial itself.

Why it's safe

Pure dead-code removal — no behaviour change. The deleted code had no path from the entry chunk, so it never shipped: the production bundle is byte-for-byte the same size before and after (186 KB gz).

Verification

  • tsc -b clean
  • 339 tests pass / 39 files (the 38 removed tests covered exactly the deleted functions)
  • jscpd 0.43% (gate 3%)
  • npm run build green, bundle size unchanged

Note: dagLayout.ts no longer contains a DAG layout (only shared map primitives now). Renaming the file (e.g. to mapLayout.ts) would touch FlowMap.tsx + radialLayout.ts imports; left as a separate optional cleanup to keep this PR a pure deletion. Header comment updated to reflect the file's current contents.

🤖 Generated with Claude Code

The React Flow migration (#111) left the old hand-rolled map's layout,
pan/zoom and keyboard-walk helpers in lib/ as dead code — 0 production
references, kept compiling only by their own unit tests and tree-shaken
out of the shipped bundle. Remove them:

  dagLayout.ts    layoutGraph (+ sanitize/cycle/layer/order helpers),
                  graphSetHash, fitTransform, zoomAt, walkFrom, edgePath,
                  the Transform/WalkDir types, GAP_Y/MIN_ZOOM/MAX_ZOOM.
  radialLayout.ts walkRadial (+ center/angleOf/nearestOnRing).

Kept the shared primitives still consumed by FlowMap + layoutRadial:
GraphEdgeRef/LayoutNode/Layout, NODE_W/NODE_H/GAP_X, compareIds,
edgeWidth, neighborsOf, and layoutRadial itself. Both test files trimmed
to the kept exports.

No behaviour change and no bundle-size change (the code was already
tree-shaken): tsc clean, 339 tests pass, jscpd 0.43%.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LDQVJrixs2nJoea67a8pEG
@sonarqubecloud

Copy link
Copy Markdown

@aksOps aksOps merged commit 56efc11 into main Jun 18, 2026
17 checks passed
@aksOps aksOps deleted the ui/prune-dead-map-helpers branch June 18, 2026 07:34
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