Repository navigation
feat(wire): shared versioned output schema for compute results - #202
Closed
CameronBrooks11 wants to merge 1 commit into
Closed
CameronBrooks11 wants to merge 1 commit into
CameronBrooks11 wants to merge 1 commit into
Conversation
Introduce fiberpath/wire.py as the single source of truth for the shape of plan/simulate results crossing a process boundary. Every response carries schemaVersion and all fields are camelCase; the wire format is decoupled from the engine dataclasses (mapped in via from_result), so it is no longer hostage to engine refactors. - API /plan and /simulate now return wire models directly; the per-route hand-rename DTOs (PlanResponse/PlanLayer/SimulationResponse) are gone. - Docs + CHANGELOG updated to the camelCase, versioned shapes. Closes #198.
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 #198. Part of the local-API architecture track (Epic #195).
Stacked on #201 (#189). Base is
feat/api-compute-routes-189; review/merge #201 first, then this re-targetsmain.What
Introduce
fiberpath/wire.pyas the single source of truth for the shape of plan/simulate results crossing a process boundary (HTTP responses, the future OpenAPI client, persisted output). It is intentionally decoupled from the engine dataclasses — engine results are mapped in viafrom_result, the one place renames happen — so the wire format is not hostage to internal engine refactors.schemaVersion(a requiredconst: "1.0"in the OpenAPI schema) and all fields are camelCase (commandCount,cumulativeTimeSeconds,estimatedTimeSeconds, …)./planand/simulatereturn the wire models directly; the per-route hand-rename DTOs (PlanResponse/PlanLayer/SimulationResponse) are gone.fiberpath_api/schemas.pynow holds onlyGcodeRequest+ValidateResponse./validate({valid: bool}) and/plot(binary PNG) are intentionally outside the JSON wire schema.Review gate
Self-reviewed via an independent adversarial review subagent (verdict: SHIP-WITH-NITS, no blocking). All three nits addressed:
multi_layerexample so a per-vs-cumulative swap is actually observable (+ a guard that the fixture exercises distinct cumulative values).schemaVersionhardened from freestrto a requiredLiteral["1.0"]const (verified in the live OpenAPI).Deferred (tracked on #193)
The CLI still emits inconsistent JSON (
fiberpath_cli/plan.py,simulate.py). It is not unified ontowire.pyhere because the current GUI parses the CLI's existing shape (fiberpath_gui/src/lib/schemas.tsexpects snake_caseestimated_time_s); changing it now would break the GUI. This resolves naturally on the GUI track when the GUI moves to the API client (#193/#194).Verification
ruffclean ·mypyclean (32 files) · full suite 108 passed (+3 wire-mapping tests)./plan→PlanResultOut,/simulate→SimulationResultOut,schemaVersionrequired const on both.