Skip to content

Replace assert guards with StreamError in MarlinStreamer #103

Closed

Description

@CameronBrooks11

What

Replace assert statements used as runtime guards in MarlinStreamer with explicit StreamError raises.

Why

assert self._transport is not None (and similar) are compiled out when Python runs with -O. In an optimized build the guards vanish and the next line dereferences None, turning a clear error into an opaque AttributeError. Serial streaming is exactly where we want deterministic, descriptive failures.

Where

fiberpath/execution/marlin.py — assert-as-guard sites (e.g. lines ~215, 248, 297, 370, 430, 441)

Acceptance criteria

  • Transport/state guards raise StreamError (or an appropriate existing exception) with a descriptive message instead of assert
  • Behavior is identical under python and python -O
  • Existing streamer tests still pass; add a test for the guard path if not covered

Activity

  1. added
    python
    on Jun 24, 2026
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

    python

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions