Skip to content

refactor: extract shared message protocol for runner and launcher - #14

Draft
AnemoFlower wants to merge 1 commit into
mainfrom
refactor/message-protocol
Draft

refactor: extract shared message protocol for runner and launcher#14
AnemoFlower wants to merge 1 commit into
mainfrom
refactor/message-protocol

Conversation

@AnemoFlower

Copy link
Copy Markdown
Member

This pull request introduces a new shared message protocol library to standardize communication between the Runner and Launcher executables, and refactors both to use this protocol for inter-process messaging over Unix Domain Sockets. The changes improve code maintainability, robustness, and clarity in the message exchange mechanism.

Protocol and Communication Refactoring:

  • Introduced a new MessageProtocol library target, which defines a unified Message enum and encoding/decoding logic for inter-process communication. Both Runner and Launcher now depend on this library. (Package.swift, Sources/MessageProtocol/Protocol.swift, Sources/MessageProtocol/ByteReader.swift) [1] [2] [3]
  • Refactored the Runner and Launcher to use the new MessageProtocol for all socket communication, replacing custom byte handling with structured message encoding/decoding. (Sources/Runner/main.swift, Sources/Launcher/main.swift) [1] [2] [3] [4] [5] [6]

Code Simplification and Robustness:

  • Simplified socket reading and writing logic by introducing the ByteReader and SocketReader abstractions, improving error handling and code clarity. (Sources/MessageProtocol/ByteReader.swift, Sources/Launcher/main.swift) [1] [2]
  • Improved error handling and logging for unexpected or malformed messages, and made message handling more robust to incomplete or unknown message types. (Sources/MessageProtocol/Protocol.swift, Sources/Launcher/main.swift) [1] [2]

Minor Cleanups:

  • Minor code cleanups and consistency improvements in argument construction and process launching. (Sources/Launcher/main.swift) [1] [2]

@AnemoFlower
AnemoFlower marked this pull request as draft June 14, 2026 08:25
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