Skip to content

Svelte 5 foundation + config-forms vertical slice (decision gate) #215

Closed

Description

@CameronBrooks11

What

First vertical slice of the React→Svelte 5 migration (strangler-on-main: PRs land on main, React stays the live entry, Svelte is reachable only via a dev-only Vite entry and tree-shaken out of the production build) — and the decision gate for the whole epic. Stand up the Svelte 5 toolchain alongside React (@sveltejs/vite-plugin-svelte, svelte-check, @testing-library/svelte) and build one slice end-to-end in Svelte: the project document/session state plus the Mandrel / Tow / Machine-settings forms, with the minimal shared primitives they need.

Why

Proves the projected Svelte simplification (lower LoC, less render-management ceremony) is real on this codebase before committing the entire app. If the delta isn't there, we stop here cheaply.

Where

fiberpath_gui/ — replaces src/stores/projectStore.ts (244 LoC), src/components/MandrelForm.tsx, TowForm.tsx, MachineSettingsForm.tsx, and the LayerNumericField primitive. Reuses src/lib/*, src/api/*, src/types/* unchanged (framework-agnostic).

Scope

  • Add the Svelte plugin/test toolchain next to React (both build); add a dev-only Svelte entry (e.g. index.svelte.html → src/main.svelte.ts) so the slice is viewable without disturbing the React entry or the production bundle.
  • Port tokens.css as-is (no rework — tokens transfer directly).
  • Rebuild project state as a runes module (project-session.svelte.ts): split persisted document from transient session (filePath / isDirty / activeLayerId / validationErrors leave the saved object). Prefer revision-based dirty tracking over a per-mutation boolean.
  • Migrate Mandrel / Tow / Machine forms with validation display, to behavior parity (same validation errors as React).
  • Add only the primitives this slice needs: NumberField, Button, SelectField, Section.
  • Capture the React baseline: handwritten LoC for these files, dependency list, bundle size, and screenshots at min / typical / large window sizes.

Acceptance criteria

  • Repo builds with both plugins; npm run build and svelte-check are clean; the production bundle is unchanged (Svelte tree-shaken out until cutover).
  • Mandrel/Tow/Machine forms render and validate in Svelte at parity with React.
  • Project state is a runes module; persisted-vs-session split done; dirty tracking works.
  • PR records a side-by-side metric table (Svelte vs React for this slice: handwritten LoC, dep delta, slice bundle delta).
  • A written go / no-go recommendation on proceeding with the full migration.

Notes

Domain contracts are already frozen by #191/#198 + existing contract tests — no new contract work here. Part of EPIC_REF.

Metadata

Metadata

Assignees

No one assigned

    Labels

    gui

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions