Skip to content

refactor(web): retire V1, promote unified-engine 3D to canonical#365

Merged
aaronsb merged 4 commits into
mainfrom
refactor/promote-v2-canonical-force3d
May 14, 2026
Merged

refactor(web): retire V1, promote unified-engine 3D to canonical#365
aaronsb merged 4 commits into
mainfrom
refactor/promote-v2-canonical-force3d

Conversation

@aaronsb
Copy link
Copy Markdown
Owner

@aaronsb aaronsb commented May 14, 2026

Summary

ADR-702 phase 1 finish: retire the V1 `react-force-graph-3d`-backed
ForceGraph3D and promote the unified-engine implementation (V2) to be
the canonical `force-3d` plugin. PR #360 landed the unified engine
behind V2. PR #363 unified the action layer so V1 and V2 routed
identical mutations through `useExplorationActions`, removing the
last reason to keep V1 around.

Affirms

  • ADR-702 — single r3f + instanced GPU rendering + GPU force-sim
    path. The two-stack 3D world (V1 wrapper + V2 unified engine) was
    always meant to be a temporary phase-1 coexistence; V1 is now gone.
  • ADR-034 — the canonical 3D plugin declares its own
    `settingsPanel` via the plugin contract. The hard-coded
    `Settings3DPanel` carve-out in `ExplorerView` (which had been
    reaching into the V1 settings shape) is removed.

User-visible changes

  • One 3D Force Graph sidebar entry (was two: "3D Force Graph"
    and "3D Force Graph (V2)").
  • The 3D explorer now runs the unified r3f + instanced GPU + GPU
    force-sim engine. ~50× headroom on large graphs (per ADR-702),
    shader-driven bezier curves on multi-edges, distance-culled
    `` edge labels.
  • Background right-click on the 3D canvas now opens the context
    menu with the background-only items (Unpin All, etc.) — V2 only
    fired on node right-clicks before.

Mechanism changes

  • `web/src/explorers/ForceGraph3D/` is the unified-engine code,
    renamed wholesale from `ForceGraph3DV2/`. Types renamed
    (`ForceGraph3DV2Data/Settings` → `ForceGraph3DData/Settings`),
    symbols renamed (`V2SettingsPanel` → `SettingsPanel`), historical
    V1/V2 comments cleaned.
  • `VisualizationType` drops `'force-3d-v2'`. `/explore/3d-v2`
    route deleted. Sidebar collapsed.
  • `ExplorerView` drops the `force-3d-v2` branch and the
    `Settings3DPanel` carve-out. Only `force-2d` still routes through
    `GraphSettingsPanel` + `SLIDER_RANGES_2D` — every other explorer
    uses the plugin's own `settingsPanel`.
  • `react-force-graph-3d` and `three-spritetext` are removed from
    `web/package.json` (and the lockfile). Both were V1-only.

Parity audit + deferred features

V2 reaches parity for everyday exploration: rendering, color modes,
edge-category filter, drag/pin (+pin-all/unpin-all), context menus,
hover/focus dimming, theme integration, autosave/replay, Reports
export, Legend, StatsPanel.

V1 features explicitly deferred — all tracked in #364:

  • Origin / destination ring markers
  • Camera travel (to origin, to destination, along path)
  • FOV slider, ground grid + auto-level + clamp-to-floor
  • Edge info box on left-click
  • Node / edge label font-size sliders
  • `showShadows` toggle
  • `edgeColorBy: 'confidence' | 'uniform'` modes (intentional shape
    divergence — V2's settings type is the canonical one; future
    additions go there)

One V1 feature is obviated by the new engine: "orient labels to
camera" — `` overlays always face the camera.

Tests + author-verification

  • 10-test `useExplorationActions` suite passes against the renamed
    surface.
  • `tsc --noEmit` clean.
  • `vite build` clean.
  • UI verification handed to the author at /explore/3d after this
    branch is pulled — golden path (search → explore → right-click →
    follow / add-adjacent / pin / focus) and the new background
    right-click. Not author-verified in CI.

Commits

```
9f55eaa chore(web): drop unused /explore/3d-v2 redirect
47e4f24 chore(web): drop react-force-graph-3d and three-spritetext
2d5638c refactor(web): promote V2 to canonical ForceGraph3D, retire V1
2e09491 feat(web): V2 fires context menu on background right-click
```

Commit 4 reverts a stale-bookmark redirect introduced defensively in
commit 2 — removed on author guidance since this branch is the first
to reference `/explore/3d-v2` outside of the V2 coexistence period
and there are no real bookmarks to preserve.

Test plan

  • Pull branch, open /explore/3d
  • Search for a concept; verify the graph renders with instanced
    nodes + curved edges + arrows
  • Left-click a node → info overlay opens
  • Right-click a node → context menu with Follow / Add Adjacent /
    Pin / Focus / Set Origin / Set Destination / Report
  • Right-click empty canvas → background menu (Unpin All, etc.)
  • Drag a node → node pins
  • Reheat button reseeds the sim
  • Settings panel sliders (repulsion / attraction / damping)
    respond
  • Hover a node → neighbors highlight, others dim
  • Right-click a node → "Focus on node" → stronger dim
  • Send to Reports works
  • /explore/2d still works unchanged
  • The 10-test `useExplorationActions` suite is still green

aaronsb added 4 commits May 13, 2026 22:35
V1's onBackgroundRightClick opened the unified context menu with
nodeId=null so the background-only items (Unpin All, etc.) would
render. V2 only fired the menu when right-clicking on a node mesh.

Add an onContextMenu handler on the canvas-wrapping div. A ref guard
filters out the bubble that follows a node-mesh right-click — the
mesh handler sets the guard before the same DOM contextmenu event
reaches the wrapper, so the background path runs only when the click
missed all nodes.

After this commit V2 is strictly more capable than V1 for the
purposes of cutover.
ADR-702's phase 1 plan: once V2 reaches parity, V1 is removed and the
unified-engine plugin becomes the one 3D force-graph. The action-layer
unification in PR #363 was the last gating step — V1 and V2 had been
routing identical mutations through useExplorationActions, so the V1
plugin was redundant.

Atomic because intermediate states (V1 deleted but routes still naming
'force-3d-v2', plugin renamed but registry still importing both) are
unshippable.

- Delete web/src/explorers/ForceGraph3D/ (V1 react-force-graph-3d
  wrapper, ~2050 lines)
- git mv ForceGraph3DV2/ → ForceGraph3D/; rename main file and
  V2SettingsPanel → SettingsPanel
- Rename internal symbols (ForceGraph3DV2 → ForceGraph3D,
  ForceGraph3DV2Data/Settings → ForceGraph3DData/Settings,
  V2SettingsPanel → SettingsPanel) and clean V1/V2 historical comments
- Drop 'force-3d-v2' from VisualizationType
- explorers/index.ts: stop exporting/importing ForceGraph3DV2Explorer
- App.tsx: drop the /explore/3d-v2 route; add a redirect from the old
  URL to /explore/3d so existing bookmarks resolve
- AppLayout.tsx sidebar: collapse two "3D Force Graph" entries into one
  (the Boxes icon stays, matching the new canonical entry)
- ExplorerView.tsx: drop the force-3d-v2 carve-out and the
  Settings3DPanel branch; the 3D plugin's own settingsPanel is used via
  the standard plugin contract. Only force-2d still routes through
  GraphSettingsPanel + SLIDER_RANGES_2D.
- Delete explorers/common/3DSettingsPanel.tsx (last consumer removed)
  and its export from common/index.ts
- Update on-canvas chrome label from "ForceGraph3D V2" to
  "ForceGraph3D"

Build, type-check, and the 10-test useExplorationActions suite all
clean against the renamed surface.
Both packages were used exclusively by the V1 ForceGraph3D explorer
retired in the previous commit. Removing them now shrinks the
production bundle and prevents future code from accidentally taking a
dependency on the abandoned wrapper API.

react-force-graph-2d remains — the 2D explorer hasn't migrated to the
unified engine yet (deferred to ADR-702 phase 2).
No stale bookmarks to worry about — the route was added in this branch
and is being removed in the same branch before the PR lands.
aaronsb added a commit that referenced this pull request May 14, 2026
Introspection from the PR #366 boundary surfaced patterns the human
corrected or affirmed this session. Two new ways and one drift fix:

- web/explorers/explorers.md (new) — concrete R3F/drei guidance for
  force-graph explorers. The d3 ForceGraph2D interaction model
  (left-pan, right-context, scroll-zoom) is the reference for any 2D
  explorer in this project. Top-down ortho with OrbitControls (not
  MapControls — its screenSpacePanning=false breaks vertical pan for
  z-locked layouts). Projection-aware label rules. WebGL feature
  documentation should be empirical-first, not worst-case.

- web/evolution/evolution.md (new) — engineering judgement for
  refactors where two implementations coexist. Engine convergence
  before polish; scrub V1/V2 framing post-promotion; skip redirects
  for never-public transitional routes; two-plugin-one-component
  factory pattern during transition windows.

- web/way.md (drift fix) — replace "./operator.sh restart web" with
  "kg-web-dev runs Vite with HMR" pointing at devmode/way.md. Tripped
  me up this session; aligned now.

Both new ways apply to web/src/explorers/ and web/src/views/ work
that's actively in flight (PR #365, PR #366, Phase C).
@aaronsb aaronsb merged commit f494701 into main May 14, 2026
3 checks passed
@aaronsb aaronsb deleted the refactor/promote-v2-canonical-force3d branch May 14, 2026 05:07
@aaronsb aaronsb restored the refactor/promote-v2-canonical-force3d branch May 14, 2026 05:08
@aaronsb aaronsb deleted the refactor/promote-v2-canonical-force3d branch May 14, 2026 05:08
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