Skip to content

feat(planning): define the typed Motion IR (Move/MoveKind/Program/ProgramMeta) - #279

Merged
CameronBrooks11 merged 1 commit into
mainfrom
feat/motion-ir-types
Jun 28, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
feat/motion-ir-types

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

Part of #136 (Motion IR epic). Closes #273. First build slice (S1) — the typed, machine-agnostic toolpath vocabulary that plan_wind will lower to (#274) and that Stage 2 (#137) / Stage 3a (#138) will target.

What

New module fiberpath/planning/ir.py:

  • MoveKind — RAPID (G0 <axes>; also the all-zero init move) · SET_FEED (G0 F<rate> state op, not a G1 cut) · SET_POSITION (G92 <subset>) · COMMENT (; <text>).
  • Move (frozen) — kind, targets: dict[Axis,float] (absolute, ordered), feed, text.
  • ProgramMeta — mandrel_diameter, wind_length, tow_width, tow_thickness.
  • Program — meta + moves.

Reuses helpers.Axis (no X/A/B letters in the IR).

Shape decisions (from the investigation)

Only the four kinds the current planner actually emits are modelled — an opcode audit of the committed goldens found nothing but G0 / G92 / comment lines. So, per the minimal-IR finding: no lay, no G1, G92 not M92, no dead G21/G94 prologue, and a Program/ProgramMeta wrapper so the header data travels structurally (consumers stop re-parsing it in S3/S4). Pure data vocabulary — no per-kind validation (the IR is internal, not a trust boundary; the byte-equal golden gate catches lowering mistakes).

Pure addition

Nothing imports the IR yet (grep confirms), so emitted G-code, the simulator, the plotter, and all goldens/snapshots are unchanged.

Verification

  • ruff / ruff format / mypy clean (now 43 source files type-checked).
  • 6 unit tests (defaults, insertion-order preservation, per-kind construction, value equality, immutability).
  • Full backend suite: 138 passed (+6) — byte goldens + sim/plot snapshot untouched.

…gramMeta)

First build slice (S1) of the Motion IR epic (#136): introduce the typed,
machine-agnostic toolpath vocabulary that plan_wind will lower to (#274) and that
Stage 2 (#137) / Stage 3a (#138) will target.

New module fiberpath/planning/ir.py:
- MoveKind: RAPID (G0 <axes>; also the all-zero init move), SET_FEED (G0 F<rate>
  state op, not a G1 cut), SET_POSITION (G92 <subset>), COMMENT (; <text>).
- Move (frozen): kind, targets: dict[Axis,float] (absolute, ordered), feed, text.
- ProgramMeta: mandrel_diameter, wind_length, tow_width, tow_thickness.
- Program: meta + moves.

Reuses helpers.Axis (no X/A/B letters in the IR). Only the four kinds ever
emitted by the current planner are modelled (opcode audit: G0/G92/comment only),
per the investigation's minimal-IR finding — no `lay`, no G1, no M92, no dead
prologue. Pure data vocabulary: no per-kind validation (internal representation,
not a trust boundary; the byte-equal golden gate catches lowering mistakes).

Pure addition — nothing imports it yet, so emitted G-code, the simulator, the
plotter, and all goldens/snapshots are unchanged. Unit tests cover defaults,
insertion-order preservation, per-kind construction, value equality, and
immutability.

Part of #136. Closes #273.
@CameronBrooks11
CameronBrooks11 merged commit 9e87c4a into main Jun 28, 2026
21 checks passed
@CameronBrooks11
CameronBrooks11 deleted the feat/motion-ir-types branch June 28, 2026 05:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(planning): define the typed Motion IR (Move/MoveKind/Program/ProgramMeta)

1 participant