feat(protocol): version the daemon wire protocol - #15
Merged
Conversation
Request and Response now carry a protocol field (PROTOCOL_VERSION = 1, serde default 0 for binaries that predate versioning). The client warns on stderr when the running daemon is older than the client and suggests 'pilotty stop' so auto-start relaunches the current binary. Warning-only for now: every current command exists in version 0. Hard gating begins when version-1-only commands ship and check this field. Compat covered by tests: unknown fields stay ignored in both directions (guarded against deny_unknown_fields), missing fields parse as 0. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds protocol versioning to the client↔daemon wire protocol, piggybacked on every message rather than a handshake roundtrip:
PROTOCOL_VERSION = 1;RequestandResponsegainprotocol: u32with#[serde(default)], so messages from binaries that predate versioning deserialize as version 0.Request::new()stamps the client version; bothResponseconstructors stamp the daemon version.run 'pilotty stop' so the daemon restarts with the current binary(auto-start then spawns the new one).Why piggybacked instead of a hello/ack: the only realistic mismatch is version skew with an already-running daemon (mid-upgrade). Additive JSON fields detect that for free; a handshake would add a roundtrip to every thin-client invocation to negotiate something that almost never fails.
Why warning-only: every current command exists in version 0, so nothing needs hard gating yet. Commands introduced at version 1+ will check the field and error helpfully when the daemon is older.
Compatibility
protocolfield ignored (guard test preventsdeny_unknown_fieldsregressions).Tests
Five new wire-compat tests in
protocol.rscovering both skew directions and constructor stamping. Full suite: 181 passed, 0 failed; clippy clean under-D warnings.🤖 Generated with Claude Code