Skip to content

feat(gui): Svelte 5 foundation + config-forms slice (#215) - #222

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/svelte-foundation
Jun 26, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/svelte-foundation

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Closes #215. First slice of the React→Svelte 5 migration (epic #214) and the decision gate for the whole effort.

Strategy: strangler-on-main

React stays the live, shipped app (index.html → src/main.tsx). Svelte is added in parallel, reachable only via a dev-only entry (index.svelte.html → src/main.svelte.ts) that is not in the production rollup input, so vite build is unchanged until the #221 cutover. Every slice PRs to main and must pass full CI.

What's in this slice

  • Toolchain (dev deps): svelte 5.56, @sveltejs/vite-plugin-svelte 7.1, svelte-check 4.7, @testing-library/svelte 5.4 — running beside the React plugins. svelte.config.js, a dual tsconfig (tsc checks TS/TSX, svelte-check checks .svelte/.svelte.ts via tsconfig.svelte.json), and a new svelte-check step in the GUI CI job.
  • State — src/state/project-session.svelte.ts: a runes module that splits the persisted ProjectDocument from transient session state (filePath / selection / validation) and tracks dirtiness via a revision counter instead of a boolean set in every mutation. Replaces the config slice of the Zustand projectStore.
  • Forms — Svelte Mandrel / Tow / Machine forms + a reusable NumberField primitive, reusing the existing param-form CSS and validation helpers (NUMERIC_RANGES, parseNumericInput) at behaviour parity (immediate store update, debounced live validation, on-blur validation, backend-error display).
  • Tests — 33 Svelte tests incl. the debounced live-validation path and blur path.

Decision-gate metrics

React Svelte Δ
Production LoC (config forms + state) 569 356 −37%
Test LoC (same surface) 512 269 −47%
Production bundle JS 599 KB unchanged (Svelte tree-shaken out)
Frontend deps — +4 dev now −10 at cutover (net −6)

The Svelte side already includes a reusable NumberField (51 LoC) that amortises across every future form/editor; like-for-like forms-only is 308→236 (−23%), with the state layer adding more. Verdict: GO — the LoC/ceremony reduction is real.

Verification

  • Local gate green: tsc, svelte-check (0 errors), 643 vitest tests (58 files), coverage 81/74/79/81 (> 60/65/50/60), stylelint, lint:css:vars, vite build, bundle budget.
  • Visual + functional parity confirmed in-browser (dev server): forms render identically to React; invalid input shows the exact same error and flips the revision-based dirty indicator.
  • Adversarially reviewed by an independent agent (ran every gate + line-by-line parity diff): no blockers, no reachable parity defects. Its one Major finding — the debounced live-validation path was only tested via blur — is fixed here (added a waitFor-based no-blur test per form). A minor deferral (live-validation on programmatic document changes, currently unreachable) is marked with // minimal: notes and tracked for Migrate project & layer editing to Svelte (editors, native reorder, file ops, export) #217.

Notes for reviewers

  • No change to the Python backend, the OpenAPI contract, the Rust shell, or the shipped React app.
  • index.svelte.html is dev-only; visit http://localhost:5173/index.svelte.html to preview.

Part of #214.

First slice of the React->Svelte 5 migration (epic #214), strangler-on-main:
React stays the live entry; Svelte is reachable only via a dev-only entry
(index.svelte.html) and is tree-shaken out of the production build.

- Toolchain: @sveltejs/vite-plugin-svelte + svelte-check + @testing-library/svelte
  alongside the React plugins; svelte.config.js; dual tsconfig (tsc checks TS/TSX,
  svelte-check checks .svelte/.svelte.ts); svelte-check wired into the GUI CI job.
- State: src/state/project-session.svelte.ts runes module - persisted
  ProjectDocument vs transient session split, revision-based dirty tracking
  (replaces the config slice of the Zustand projectStore).
- Forms: Svelte Mandrel/Tow/Machine config forms + a reusable NumberField
  primitive, reusing the existing param-form CSS and validation helpers at
  behaviour parity (live debounced + on-blur validation, backend errors).
- Tests: 33 Svelte tests incl. debounced live-validation and blur paths.

Production bundle unchanged (Svelte not in the rollup input). For the equivalent
config-forms + state surface: 569 -> 356 production LoC.

Refs #214
@CameronBrooks11 CameronBrooks11 added the gui Pull requests that update GUI components label Jun 26, 2026
@CameronBrooks11
CameronBrooks11 merged commit 1fcec02 into main Jun 26, 2026
18 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/svelte-foundation branch June 26, 2026 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gui Pull requests that update GUI components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant