Skip to content

pb-client, pb-core, pb-service: each declares the protocol version it implements - #16

Merged
dlech merged 1 commit into
mainfrom
protocol-version-per-package
Nov 24, 2026
Merged

dlech merged 1 commit into
mainfrom
protocol-version-per-package

Conversation

@dlech

@dlech dlech commented Nov 24, 2026

Copy link
Copy Markdown
Member

PROTOCOL_VERSION and MIN_PROTOCOL_VERSION lived in pybricks-core, and
the client and the service read them from there. Each package requires
pybricks-core at a minimum version with no maximum, so an older client
or service installed beside a newer pybricks-core read the newer number
and claimed a protocol it did not implement, which the handshake cannot
catch. That happened installing pybricks-cli 1.0.0b2 from a stale index:
pybricks-core 1.0.0b2 with pybricks-client 1.0.0b1 and pybricks-service
1.0.0b2, all saying protocol 4.

The version is a promise about behaviour, so it belongs to the code
that behaves. pb-client declares PROTOCOL_VERSION, the version it
speaks, in pb_client.service. pb-service declares PROTOCOL_VERSION and
MIN_PROTOCOL_VERSION, the versions it serves, in pb_service.methods.service,
with the rules for moving them. A test checks that the two agree.

Both are removed from pybricks-core, which is a breaking change, made
while the packages are in beta. pybricks-client 1.0.0b2 and
pybricks-service 1.0.0b3 import them from there, so either installed
beside a pybricks-core without them fails to import, rather than
claiming a protocol it does not speak.

… implements

PROTOCOL_VERSION and MIN_PROTOCOL_VERSION lived in pybricks-core, and
the client and the service read them from there. Each package requires
pybricks-core at a minimum version with no maximum, so an older client
or service installed beside a newer pybricks-core read the newer number
and claimed a protocol it did not implement, which the handshake cannot
catch. That happened installing pybricks-cli 1.0.0b2 from a stale index:
pybricks-core 1.0.0b2 with pybricks-client 1.0.0b1 and pybricks-service
1.0.0b2, all saying protocol 4.

The version is a promise about behaviour, so it belongs to the code
that behaves. pb-client declares PROTOCOL_VERSION, the version it
speaks, in pb_client.service. pb-service declares PROTOCOL_VERSION and
MIN_PROTOCOL_VERSION, the versions it serves, in pb_service.methods.service,
with the rules for moving them. A test checks that the two agree.

Both are removed from pybricks-core, which is a breaking change, made
while the packages are in beta. pybricks-client 1.0.0b2 and
pybricks-service 1.0.0b3 import them from there, so either installed
beside a pybricks-core without them fails to import, rather than
claiming a protocol it does not speak.
@dlech
dlech merged commit eecf6e6 into main Nov 24, 2026
23 checks passed
@dlech
dlech deleted the protocol-version-per-package branch November 24, 2026 20:48
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