Repository navigation
Description
Epic: migrate the GUI from React to Svelte 5 + restrained desktop UI redesign
Decision (from an architecture review, grounded in the current code)
Move fiberpath_gui off React + Zustand to Svelte 5 as a plain Vite SPA inside the existing Tauri shell — no SvelteKit (a desktop SPA needs no router/SSR/meta-framework). Treat it as a UI architecture reset, not a mechanical React→Svelte transcription, paired with a restrained desktop UI redesign (denser, calmer, slicer-appropriate).
The strong parts of today's architecture are not React-specific and stay: the Tauri/Rust bridge, the Python compute backend, the OpenAPI-typed client + generated types + CI drift gate (#191/#198), the Zod/JSON-schema validation boundary, the explicit Marlin streaming state, and the token-based CSS. Svelte replaces only the framework + state-management ceremony.
Why
- Less state ceremony —
$state/$derived/$effectrunes in.svelte.tsmodules replace Zustand +useShallow+ memo/debounce render-management. Zustand disappears rather than being swapped for another store lib. - Less composition indirection —
App.tsxassembles whole element trees and passes them asReactNodeprops intoMainTab; Svelte regions own their layout directly. - Fewer dependencies & lower LoC — drop 10 React-coupled packages; the viewport, DnD, and store glue collapse into native code.
- Right moment — the UI is still bounded (no real toolpath renderer yet). Waiting until the viewport/telemetry/slicer surface grows makes this far more expensive.
Baseline (measured 2026-06-26, GUI v0.7.4)
- Handwritten TS/TSX 8,712 LoC (79 files, 40 components) · CSS 3,283 LoC (19 files) · tests 7,695 LoC (53 files).
- 28 dependencies (11 prod / 17 dev). Bundle JS 599 KB / CSS 59 KB (budget 750/90).
- Viewport = PNG preview +
react-zoom-pan-pinch(no vector/canvas). DnD = one use (LayerStack reorder,@hello-pangea/dnd). - State = 3 Zustand stores (project/stream/toast); transient UI state (
isDirty/filePath/activeLayerId/validationErrors) is mixed into the persisted project document.
Strategy
- Strangler-on-
main(chosen because the required "CI Check" only runs on PRs tomain, so every slice gets full CI and there is no long-lived branch to rebase against the merge train): each slice PRs directly tomainand must pass CI before merge. React stays the live, shipped entry the whole time; Svelte accrues in parallel behind a dev-only Vite entry, tree-shaken out of the production bundle, until the cutover (Cutover: remove React, swap toolchain, docs/ADR, merge to main #221) flips the entry and deletes React. Both frameworks' source coexist in-repo during the migration; the shipped app is never dual-framework and never broken for users. - Slice 1 (Svelte 5 foundation + config-forms vertical slice (decision gate) #215) is a decision gate: build the first vertical slice (config-forms + state) end-to-end in Svelte and measure the real LoC/dependency/ceremony delta before committing the whole app.
- Forms/editors migrate to behavior-parity first; the restrained redesign lands at the shell slice so parity stays comparable.
- Domain contracts are already frozen (build: OpenAPI-generated TS client + CI drift gate #191/feat: one shared versioned output/wire schema for compute results (plan/simulate/plot) #198 + contract tests) — no new "freeze the contract" work;
lib/,api/,types/are framework-agnostic and reused as-is.
Scope (vertical slices, on the branch)
- Svelte 5 foundation + config-forms vertical slice (decision gate) #215 — Svelte 5 foundation + config-forms vertical slice (decision gate)
- GUI shell: Prepare/Machine workspace, regions, menu + status bar, restrained desktop redesign #216 — App shell: Prepare/Machine workspace, regions, menu + status bar, restrained desktop redesign
- Migrate project & layer editing to Svelte (editors, native reorder, file ops, export) #217 — Project & layer editing (editors, native reorder, file ops, export)
- Replace react-zoom-pan-pinch with a framework-neutral viewport (fixes #147) #218 — Framework-neutral viewport pan/zoom (fixes GUI bug: plot viewer zoom is clamped to image bounds #147)
- Migrate machine control / streaming to Svelte (last, highest risk) #219 — Machine control / streaming (last, highest risk)
- Migrate dialogs, toasts, chrome & theme to Svelte #220 — Dialogs, toasts, chrome & theme
- Cutover: remove React, swap toolchain, docs/ADR, merge to main #221 — Cutover: remove React, swap toolchain, docs/ADR, merge to
main
Targets (directional, NOT hard acceptance criteria)
A smaller line count that hides state transitions or weakens tests is not an improvement. Track, don't gate on:
- Handwritten frontend LoC (TS + CSS) ↓ · external frontend deps ↓ (≥10 packages removed) · bundle JS ↓
- Number of state abstractions ↓ · UI concepts needed to change a feature ↓
- Test coverage of machine-state transitions held or improved.
Reconciliation with existing issues
- GUI bug: plot viewer zoom is clamped to image bounds #147 (plot zoom clamped to image bounds) — closed by Replace react-zoom-pan-pinch with a framework-neutral viewport (fixes #147) #218 (the viewport rewrite).
- GUI: machine connection info panel in the Stream tab #146 (machine connection-info panel) — touchpoint of Migrate machine control / streaming to Svelte (last, highest risk) #219, but ships independently; not required by this epic.
- Pattern parameter explainability: GUI aids + reference docs + circuit-mismatch clarity #145 (pattern-parameter explainability tooltips) — touchpoint of Migrate project & layer editing to Svelte (editors, native reorder, file ops, export) #217; ships independently.
- Desktop integration: register .wind file association to open FiberPath #148 (.wind OS file association) — Tauri-level, independent of the framework swap; out of scope.
- Epic: local-API backend + OpenAPI-typed thin-shell GUI #195 (local-API thin-shell epic) — architectural predecessor; this epic builds on its now-stable sidecar + generated-client contract.
Non-goals
- No SvelteKit, Tailwind, component library, frontend router, or CSS-in-JS.
- No change to the Python compute backend, the OpenAPI contract, or the Rust serial path.
- No switch from the PNG preview to vector/WebGL rendering (evaluate separately, after parity).
- No dual-framework app is ever shipped — only React is wired to the entry until cutover (both frameworks' source coexist in-repo meanwhile, Svelte tree-shaken out of the build).
Activity
feat(gui): Svelte 5 foundation + config-forms slice (#215) (#222)
feat(gui): Svelte app shell + Prepare/Machine workspace redesign (#216)…
feat(gui): Svelte layer list + layer editors (#217) (#224)
feat(gui): Svelte file operations + toasts (#217) (#225)
feat(gui): framework-neutral viewport with native pan/zoom (#218, #147)…
feat(gui): Svelte Marlin machine control + streaming (#219) (#227)
feat(gui): Svelte theme, CLI health, error boundary + dialogs (#220) (#…
feat(gui): cut over to Svelte 5, remove React (#221) (#229)
CameronBrooks11 commentedon Jun 27, 2026
✅ Epic complete — the GUI is migrated from React to Svelte 5. All 7 slices merged via strangler-on-main (one PR each, full CI + adversarial review gate):
Final metrics vs the React baseline: production code 8,712 → 6,031 LoC (−31%), tests 7,695 → 4,572 (−41%), frontend deps −10 packages, production JS bundle 599 KB → 308 KB (−48%). Plus the restrained Prepare/Machine redesign and #147 fixed.
No SvelteKit; plain Svelte 5 (runes) SPA in the same Tauri shell. Python backend, OpenAPI client, Rust bridge, and Zod boundary unchanged. See the migration ADR.