Repository navigation
refactor(api): make compute routes body-only and add /plot - #201
Merged
Merged
Conversation
Rework the FastAPI compute surface so requests carry data, not filesystem paths: - POST /plan and POST /validate take a wind definition body; /plan returns the generated program in `gcode` instead of writing a file. - POST /simulate takes a G-code program body. - Add POST /plot returning image/png bytes. - Remove the path-allow-list policy (path_policy.py) and the streaming route; map PlotError to 400. This makes the service stateless and safe to run as a local sidecar, and is the stable contract the generated OpenAPI client will consume. Closes #189.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #189.
First step of the local-API architecture track (Epic #195): rework the FastAPI compute surface so requests carry data, not filesystem paths. This is the stable contract the OpenAPI-generated TS client (#191) will consume, and makes the service safe to run as a stateless local sidecar.
Changes
POST /planandPOST /validatetake a wind-definition body (the same JSON as a.windfile)./planreturns the generated program directly ingcodeinstead of writing a.gcodefile and returning its path.POST /simulatetakes a G-code program body ({"gcode": "..."}).POST /plotrenders an unwrapped 2D preview and returnsimage/pngbytes.path_policy.py+FIBERPATH_API_ALLOWED_ROOTS) and the/streamroute.PlotErrornow maps to 400.Driving a Marlin controller is intentionally not part of this surface — it's being reworked into a dedicated REST surface (#190 / #199).
Verification
tests/api/test_plan_route.py,test_simulate_route.py, newtest_plot_route.py.ruff checkclean ·mypyclean · full suite 105 passed.Net −580 lines.