Skip to content

Commit e605de2

Browse files
nikagradkropachev
authored andcommitted
docs: document encode_message contract change
Note in the protocol API docs that both contracted _ProtocolHandler methods receive the connection's negotiated ProtocolFeatures, spelling out the calling conventions: decode_message receives it positionally, encode_message as the required protocol_features keyword argument, so overrides must keep that parameter name. Add a CHANGELOG entry with upgrade guidance for custom protocol handlers (accept protocol_features, prefer **kwargs for future-proofing, forward it when delegating to send_body).
1 parent ea1ff33 commit e605de2

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

CHANGELOG.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
Unreleased
2+
==========
3+
4+
Others
5+
------
6+
* Message serialization now receives the connection's negotiated ``ProtocolFeatures``:
7+
``Connection.send_msg`` passes ``protocol_features`` to the encoder, and
8+
``_ProtocolHandler.encode_message`` forwards it to each message's ``send_body``.
9+
This changes the contracted signature of ``encode_message`` (and of ``send_body``).
10+
Custom protocol handlers that override ``encode_message`` must accept a required
11+
``protocol_features`` keyword argument (adding ``**kwargs`` is recommended for
12+
future-proofing), and custom encoders that delegate to ``msg.send_body`` should
13+
forward it. There is deliberately no compatibility fallback: protocol extensions
14+
are negotiated per connection at STARTUP, so an encoder unaware of
15+
``protocol_features`` could silently omit fields a negotiated extension requires.
16+
This release emits no new bytes on the wire; the parameter is groundwork for
17+
upcoming protocol extensions (``SCYLLA_USE_METADATA_ID``, ``TABLETS_ROUTING_V2``).
18+
119
3.29.11
220
=======
321
Jun 15, 2026

docs/api/cassandra/protocol.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ See :meth:`.Session.execute`, :meth:`.Session.execute_async`, :attr:`.ResponseFu
2727

2828
.. automethod:: decode_message
2929

30+
.. note::
31+
Both contracted methods receive the ``ProtocolFeatures`` negotiated on the connection
32+
carrying the message: ``decode_message`` positionally, ``encode_message`` as the required
33+
``protocol_features`` keyword argument (overrides must keep that parameter name).
34+
3035
.. _faster_deser:
3136

3237
Faster Deserialization

0 commit comments

Comments
 (0)