Skip to content

Refactor (3/5): consolidate duplicated helpers, guard OwnSource::FILES - #42

Open
yuuu wants to merge 3 commits into
refactor/command-layerfrom
refactor/dedupe-helpers
Open

yuuu wants to merge 3 commits into
refactor/command-layerfrom
refactor/dedupe-helpers

Conversation

@yuuu

@yuuu yuuu commented Oct 17, 2026

Copy link
Copy Markdown
Owner

Stacked on #41.

  • MRDebug::Breakpoint mixin (mrblib/mrdebug/breakpoint.rb): active?/deactivate!, numbered_line, number_in(siblings). These were copied across LineBreakpoint/MethodBreakpoint/WatchVarBreakpoint.
  • MRDebug.env_value moves to core (mrblib/mrdebug.rb) and replaces Colorizer.env, which was identical.
  • MRDebug.start_session(ui) replaces four copies of Session.new / ui= / self.session= (listen_tcp, listen_unix, attach_stdio, mrdebug-console's attach_local).
  • Transport.read_some(io) replaces the sysread/readpartial switch that was repeated in CLI, DapServer, DeviceLink and Transport::Socket.
  • CLI.connect_tcp/connect_unix share connect_and_relay. A misplaced doc comment now sits on relay instead of colorizer_for.
  • DapBridge: arguments(request) helper. setBreakpoints/setFunctionBreakpoints are handled once (breakpoints_response) instead of in both the handshake and stopped case.
  • mrdebug-console's color check is now Colorizer.enabled?(nil) (a nil io means there's nothing to probe). Small behavior change: it now also honors TERM=dumb, the same as the host side.
  • OwnSource::FILES lists every Ruby source again. device.rb, transport/socket.rb, cli/*, remote_session.rb and console.rb were missing. The new spec/own_source_spec.rb compares the list against the tree, so it can't silently drift again.

CLAUDE.md is updated to match.

Tested: rake test:unit (OK 3015, KO 0), rake test:smoke and rake picoruby:smoke (4 examples, 0 failures each). The mrdebug-console gem isn't built by CI and wasn't compiled here; its changes are two one-line call-site swaps.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CpfQQRdc3R13RafigfCNVk

- MRDebug::Breakpoint mixin: active?/deactivate!, numbered_line and
  number_in(siblings) for the three breakpoint classes.
- MRDebug.env_value moves to core and replaces Colorizer.env.
- MRDebug.start_session(ui) replaces four copies of the
  Session.new/ui=/session= sequence (device.rb, mrdebug-console).
- Transport.read_some replaces copies in CLI, DapServer, DeviceLink and
  Transport::Socket.
- CLI.connect_tcp/connect_unix share connect_and_relay.
- DapBridge: arguments(request), and one breakpoints_response for both
  the handshake and the stopped phase.
- mrdebug-console's color check is now Colorizer.enabled?(nil): a nil io
  means nothing to probe. It now also honors TERM=dumb.
- OwnSource::FILES lists every Ruby source again (device.rb, socket.rb,
  cli/*, console.rb, ... were missing); spec/own_source_spec.rb fails when
  it drifts from the tree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CpfQQRdc3R13RafigfCNVk
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