Skip to content

refactor: simplify proc ID handling and exec return type#22

Merged
mikelsr merged 1 commit intomasterfrom
refactor/proc-id-return-type
Sep 18, 2025
Merged

refactor: simplify proc ID handling and exec return type#22
mikelsr merged 1 commit intomasterfrom
refactor/proc-id-return-type

Conversation

@lthibault
Copy link
Copy Markdown
Contributor

Simplifies the process ID API by making exec return just the process ID while maintaining proper protocol handling internally.

Changes

  • Proc.String()Proc.ID(): Returns just endpoint name (e.g., "abc123")
  • Endpoint.String(): Returns full protocol string (e.g., "/ww/0.1.0/abc123")
  • exec command: Returns process ID instead of full protocol string
  • send command: Constructs protocol internally from process ID
  • Added docstrings for all methods
  • Updated tests and docs to reflect new behavior

Benefits

  • Cleaner API: (exec ...) returns simple ID, (send ...) takes simple ID
  • Maintains proper libp2p protocol routing internally
  • Better separation of concerns between user-facing API and internal protocol handling

Testing

  • All existing tests pass
  • Updated test names and assertions to match new behavior
  • Documentation updated with correct examples

- Change Proc.String() to Proc.ID() returning just endpoint name
- Change Endpoint.String() to return full protocol string with /ww/0.1.0/ prefix
- Update exec command to return process ID instead of full protocol string
- Update send command to construct protocol internally from process ID
- Add proper docstrings to String(), ID(), and Protocol() methods
- Update tests and documentation to reflect new behavior

This simplifies the API by making exec return just the process ID while
maintaining proper protocol handling internally for libp2p stream routing.
@lthibault lthibault requested a review from mikelsr September 17, 2025 23:25
@lthibault lthibault self-assigned this Sep 17, 2025
@lthibault lthibault added the enhancement New feature or request label Sep 17, 2025
@mikelsr mikelsr merged commit 06d9c8d into master Sep 18, 2025
3 checks passed
@mikelsr mikelsr deleted the refactor/proc-id-return-type branch September 19, 2025 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants