Skip to content

chore: finish MOTION→Motion casing + fix telemetry shutdown race#59

Open
boringethan wants to merge 2 commits into
next-nextfrom
chore/cleanups
Open

chore: finish MOTION→Motion casing + fix telemetry shutdown race#59
boringethan wants to merge 2 commits into
next-nextfrom
chore/cleanups

Conversation

@boringethan
Copy link
Copy Markdown
Contributor

Summary

  • Finishes the MOTIONInterface/MOTIONConsoleMotion* casing on stale docstring refs in ConsoleTelemetry.py, MotionConsole.py, and the table/call-graph/demo-mode example in CLAUDE.md.
  • Reorders MotionConsole._drive_disconnecting() to stop the telemetry poller before flipping state to DISCONNECTING. Old order let the poll thread's in-flight tick race the state change, which surfaced as ERROR: ValueError: Console controller not connected from one of the 40 except ValueError: log+reraise blocks in MotionConsole on every clean shutdown.

Test plan

  • py_compile clean (verified locally)
  • Re-run the bloodflow-app with this SDK installed editable (pip install -e <this branch>) and confirm the shutdown log no longer contains Console controller not connected (the original smoketest in the bloodflow-app PR imported from next-next SDK so this fix wasn't exercised end-to-end yet)
  • No behavior change on the docstring edits

🤖 Generated with Claude Code

boringethan and others added 2 commits May 26, 2026 19:42
Three stragglers from the earlier MOTIONInterface -> MotionInterface
rename: two API docstrings (ConsoleTelemetry.py poller header,
MotionConsole.ping) and CLAUDE.md (facade table, call graph, signal
fallback name, demo-mode example). The script tree in scripts/
still imports MOTIONInterface from a module path that no longer
exists; that's tracked as a separate dead-code triage.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MotionConsole._drive_disconnecting() previously set state to
DISCONNECTING first, then asked the telemetry poller to stop. The
poll thread could be mid-tick when state flipped — its next UART
command-method call would see `not is_connected()`, raise
ValueError("Console controller not connected"), and the
ValueError-catch-log-reraise blocks scattered through MotionConsole
(40 sites) would surface that as ERROR before ConsoleTelemetry's
_read_all could demote it to INFO. Symptom on every clean shutdown:

  ERROR - openmotion.sdk.Console - ValueError: Console controller not connected
  WARNING - bloodflow-app.connector - Telemetry poll error: Console controller not connected

Reordering: stop the poller first (joins the poll thread; the
final tick, if any, runs against a still-CONNECTED state and
completes cleanly), then flip to DISCONNECTING, close UART, flip
to DISCONNECTED. Listeners still get notified at the same state
transitions; only the internal cleanup order changes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant