Skip to content

Epic: local-API backend + OpenAPI-typed thin-shell GUI #195

Closed

Description

@CameronBrooks11

Decision (from a full architecture review)

Today the GUI shells out to the CLI spawn-per-call, structured data crosses Rust↔Python through temp files, results are parsed as untyped JSON with heuristics (version-scraping, stderr-scraping), the FastAPI is orphaned and wrong-shaped (/from-file only, no plot, one-shot stream), Marlin is a bespoke stdio event protocol + Tauri events, and the frontend re-describes all of it in hand-written zod + a mislabeled "auto-generated" types file.

Refactor to: a local FastAPI that owns all backend logic — compute and serial — exposed as plain request/response REST (Marlin is a polled job resource; no WebSockets — the protocol is send-line→ok, progress is polled). The frontend becomes a generated OpenAPI client (the treat-as-separate-repo strictness), and Tauri shrinks to a thin native shell (window + file pickers). The CLI stays as a parallel human/automation adapter over the same core.

Why

  • Kills the filesystem-IPC dance, per-call cold-start, and untyped stdout-scraping.
  • One source-of-truth contract (OpenAPI) → generated client → CI drift gate; retires hand-written zod, the fake "auto-generated" types, and the bespoke stdio protocol.
  • The core is already model-based, so the compute routes are thin; the only real new infra is the serial job runner, which is a REST-exposed version of what interactive.py already does.

Scope (phased)

Backend (FastAPI owns everything, all REST)

Contract

Delivery

Frontend & shell

Reconciliation with existing issues

Notes

  • Marlin REST: GET /ports, POST/DELETE /connection, POST /commands, POST /jobs + GET /jobs/{id} (poll) + pause/resume/stop. Firmware-initiated //action:/errors surface in the polled status.
  • Tauri's only irreducible native role: window + native file/folder picker.
  • The contract is Pydantic-model-based, hence transport-agnostic — this also yields a real remote/headless API as a byproduct if ever wanted.

Plan-review refinements (2026-06-25)

Holistic 4-lens + adversarial review. Direction confirmed; refinements:

Activity

  1. added
    epic
    roadmap
    on Jun 26, 2026
  2. CameronBrooks11 commented on Jun 28, 2026

    @CameronBrooks11
    MemberAuthor

    Status (2026-06-28): backend is the engine now — marlin-host is published

    The host-protocol layer (#187: #178/#179/#180/#181/#182) is realized and published as marlin-host==0.1.0 on PyPI (MVP, hardware-validated on RAMPS 1.4 / Marlin bugfix-2.1.x; mock/hardware-separated suite). #188 closed (extraction done). This unblocks the machine half of this epic — the /jobs runner becomes a thin adapter over marlin_host.MarlinHost instead of interactive.py.

    Where the phases stand

    This machine cutover is the 0.9.0 target.

    Gap analysis — marlin-host already covers connect/streaming/pause/e-stop/queries (more rigorously than the old MarlinStreamer). app-neutral upgrades needed before consumption (tracked in fiberpath/marlin-host):

    Decisions carried in

    • Drop M0/M108 from the stream pause path — adopt marlin-host's host-side pause (send-one-await-ok pacing makes board-level M0 unnecessary and was the fragile part of the old code). Keep M0/M108 only as an explicit operator-hold app feature.
    • dry-run + ;-comment logging stay app-side; halt recovery via SerialTransport.reset(flush=True) + connect().
    • CLI stream stays (parallel interface), rewired to marlin-host.
  3. CameronBrooks11 commented on Jun 28, 2026

    @CameronBrooks11
    MemberAuthor

    Delivered. All phases shipped: #189/#191/#192 (0.8.0), #190 (#260), #193/#194 (#262/#263). Machine control now runs on the local API sidecar (it owns the serial port) + marlin-host, the GUI uses the generated typed client with polling, and the Rust stdio subprocess is gone. Released in fiberpath 0.9.0. The split-off #200 (orphaned-job crash recovery) remains open as the one piece of follow-up hardening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    epicroadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions