Skip to content

refactor(execution,cli): route streaming debug prints through logging - #113

Merged
CameronBrooks11 merged 1 commit into
mainfrom
refactor/streaming-logging
Jun 24, 2026
Merged

CameronBrooks11 merged 1 commit into
mainfrom
refactor/streaming-logging

Conversation

@CameronBrooks11

Copy link
Copy Markdown
Member

What

Replace the leftover print("[DEBUG] ...", file=sys.stderr, flush=True) calls in the streaming hot path with a module logging.getLogger(__name__) at DEBUG level, matching the convention already used in planning/layer_strategies.py.

Why

These debug prints run on the GUI's streaming hot path (the CLI interactive mode is the GUI's streaming backend) and spam stderr during normal pause/resume/cancel operations. They're development leftovers. Routing them through logging makes them opt-in and keeps stderr clean by default.

How

  • fiberpath/execution/marlin.py: 12 [DEBUG] prints → LOGGER.debug, and the 2 [ERROR] prints → LOGGER.error; removed the per-method import sys.
  • fiberpath_cli/interactive.py: 18 [DEBUG] prints → LOGGER.debug. The module-level import sys is kept — it backs the stdin/stdout JSON protocol (for line in sys.stdin), not debug.
  • f-string interpolations converted to lazy %s args.

The stdout JSON-line protocol the Tauri/Rust side parses (send_response → print(json.dumps(...))) is untouched; only stderr debug noise is affected. No handler is configured in library code, so DEBUG/INFO stay silent by default.

Verification

  • grep [DEBUG] → zero matches in both files.
  • New regression test: a stream/pause/resume cycle emits no [DEBUG] on stderr (capsys); would have failed before this change.
  • ruff, ruff format --check, mypy (strict, 37 files), full pytest (117 passed): all green.

Builds on #103 (same marlin.py methods); rebased on top of it. Closes #102

Replace the leftover `print("[DEBUG] ...", file=sys.stderr)` calls in the
streaming hot path with a module `logging.getLogger(__name__)` at DEBUG
level, matching the convention already used in planning/layer_strategies.py.

- fiberpath/execution/marlin.py: 12 [DEBUG] prints -> LOGGER.debug, and the 2
  [ERROR] prints -> LOGGER.error, removing the per-method `import sys`.
- fiberpath_cli/interactive.py: 18 [DEBUG] prints -> LOGGER.debug. Module
  `import sys` retained (used by the stdin/stdout JSON protocol).

The stdout JSON-line protocol the Tauri side parses is untouched; only stderr
debug noise is affected. With no handler configured, DEBUG/INFO stay silent by
default, so a normal run is quiet.

Adds a regression test asserting a stream/pause/resume cycle emits no [DEBUG]
on stderr.

Closes #102
@CameronBrooks11 CameronBrooks11 added the python Pull requests that update Python code label Jun 24, 2026
@CameronBrooks11
CameronBrooks11 merged commit 2cfff4e into main Jun 24, 2026
24 checks passed
@CameronBrooks11
CameronBrooks11 deleted the refactor/streaming-logging branch June 24, 2026 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace [DEBUG] print statements with logging in streaming paths

1 participant