Skip to content

feat(gui): Svelte Marlin machine control + streaming (#219) - #227

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

CameronBrooks11 merged 1 commit into
mainfrom
feat/svelte-streaming

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Closes #219. Ports the Marlin machine-control / G-code streaming UI to Svelte — the riskiest slice. Part of epic #214 (strangler-on-main: React still ships; Svelte stays behind the dev-only entry and out of vite build — unchanged at 595.75 kB).

What changed

  • src/state/machine-session.svelte.ts — one runes session consolidating the Zustand streamStore + the three React action hooks (useConnectionActions / useManualCommandActions / useStreamingActions) + useStreamEvents. Holds connection / streaming / manual / log state and all actions; reuses marlin-api.ts (Tauri bridge) and streamFeedback.ts + toastMessages.ts (log/toast builders) unchanged, adapted to the Svelte notifications store.
  • Machine workspace — MachineWorkspace.svelte (rewritten from the GUI shell: Prepare/Machine workspace, regions, menu + status bar, restrained desktop redesign #216 placeholder) lays out Connection / Manual Control / File Streaming + the live Output Log, and subscribes to the four Tauri stream events (started/progress/complete/error) via an $effect with proper unlisten cleanup.
  • Emergency-stop carve-out (epic requirement): E-Stop / Stop (M112, disconnects the controller) is given a distinct destructive red treatment and is behaviorally separate from graceful Cancel (stays connected). Preserved exactly from the React state machine.

Parity preserved

Connect (connecting→connected, →disconnected on failure), disconnect, pause→paused, resume→connected, cancel (resetAfterCancel: stays connected), emergency stop (→disconnected); streamControlLoading guards against concurrent control actions; manualControlsEnabled = isConnected && (!isStreaming || paused); progress throttling + 25/50/75 milestone toasts; the 5000-entry log cap.

Deferred

The ? keyboard-shortcuts help modal moves to #220 (dialogs).

Verification

  • Local gate green: tsc, svelte-check (0/0), 733 vitest tests (+19: the machine-session state machine — connect/disconnect/failure, pause/resume, cancel≠stop, the loading guard, manual-control gating, file select, and event-subscription wiring — plus a workspace render test), coverage 80.6/70.6/79.2/82.0 (> 60/50/65/60), stylelint, lint:css:vars, vite build, bundle budget.
  • Production bundle unchanged at 595.75 kB (the machine session + components are out of the rollup input).
  • Verified in-browser: the Machine workspace renders all sections; the refreshPorts error path logs to the Output Log with error styling (real connect/stream needs the Tauri sidecar + a Marlin board).
  • Adversarially reviewed before commit (riskiest-slice deep pass).

Notes for reviewers

  • No change to the Python backend, OpenAPI contract, Rust shell, or the shipped React app.
  • End-to-end streaming requires tauri dev + hardware (or --dry-run); the browser preview shows the UI + non-Tauri error paths.

Closes #219. Part of #214.

Closes #219. Ports the riskiest surface — connection, manual commands, file
streaming, live log — to Svelte. Part of epic #214, strangler-on-main: React
still ships; Svelte stays behind the dev-only entry and out of the bundle
(unchanged at 595.75 kB).

- state/machine-session.svelte.ts: one runes session consolidating the Zustand
  streamStore + useConnectionActions + useManualCommandActions +
  useStreamingActions + useStreamEvents. Reuses marlin-api.ts (Tauri bridge) and
  streamFeedback.ts/toastMessages.ts unchanged via the notifications adapter.
- components/machine/{Connection,ManualControl,FileStreaming}Section + StreamLog;
  MachineWorkspace.svelte subscribes to the 4 stream events via $effect.
- Emergency stop (M112) given a distinct destructive treatment, behaviourally
  separate from graceful cancel.

Two correctness improvements over the React original (both adversarially flagged):
- e-stop now clears isStreaming/progress (UI can't offer Pause/Stop while
  disconnected).
- stale stream-progress from a finished/cancelled job is dropped (guard on
  isStreaming).

740 tests; the machine-session suite covers connect/disconnect/failure,
pause/resume, cancel-vs-stop, the concurrency guard, failed-cancel/stop resets,
manual gating, milestone/throttle, the error event, stale-event drop, unlisten
cleanup, and the 5000-entry log cap. Adversarially reviewed (riskiest-slice pass).

Closes #219. Refs #214
@CameronBrooks11 CameronBrooks11 added the gui Pull requests that update GUI components label Jun 26, 2026
@CameronBrooks11
CameronBrooks11 merged commit cca8748 into main Jun 26, 2026
18 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/svelte-streaming branch June 26, 2026 23:56
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.

Migrate machine control / streaming to Svelte (last, highest risk)

1 participant