Repository navigation
Conversation
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUNXDUYPZYgFiM2Hx5
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoUNXDUYPZYgFiM2Hx5
jfallows
force-pushed
the
fix/3173-kafka-offset-delete-codec
branch
from
November 13, 2026 02:03
5ba89bf to
aacd3e6
Compare
jfallows
changed the base branch from
develop
to
fix/3170-mqtt-kafka-discard-session-offsets
November 13, 2026 02:03
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.
Description
Adds typed wire codecs for the Kafka OffsetDelete request (API key 47, version 0) to binding-kafka's public
io.aklivity.zilla.runtime.binding.kafka.apipackage, which until now had no codec for it:KafkaOffsetDeleteRequest:sizeof(Source, short),Source, and aGeneratorwith the incrementaltopics/topic().name().partitions().partition()/build()builders andgenerate(Source).KafkaOffsetDeleteResponse: topic/partition cursor exposing the top-level error code, the throttle time and per-partition error codes.KafkaOffsetDeleteResponseV0FW: the v0 decoder.protocol.idl: newoffset_deletecodec scope.Structure and naming mirror
KafkaFindCoordinatorRequest/KafkaFindCoordinatorResponseV3FWand, for the nested topic/partition arrays,KafkaListOffsetsRequest/KafkaListOffsetsResponseV6FW. Nokafka.idlchange, no new stream, no client factory. Only version 0 is supported, sosizeofthrows for any other version. DeleteGroups (API key 42) is out of scope.As with the sibling response codecs, interpreting the error codes and checking that the topics and partitions returned match those requested are the caller's job; the codec exposes the values it decodes unchanged.
This is the first cursor in the package with
int32array counts; the sibling cursors usevaruintcounts, which cannot go negative. A negative topic or partition count in the response makesnext()throwIllegalStateException. This follows the existing truncation behaviour (an unchecked exception from the reader) and adds no new mechanism.Base: this PR is stacked on
fix/3170-mqtt-kafka-discard-session-offsets(heade82b3cf33d6e016773719373aba3c24b52d9bd18); it touches only binding-kafka'sapipackage, its tests andprotocol.idl, none of which the PRs below it change.Fixes #3173
Protocol sources read
Every statement below was read from the files and page named here.
Message definitions (
clients/src/main/resources/common/message/OffsetDeleteRequest.jsonandOffsetDeleteResponse.jsonin apache/kafka), downloaded with curl fromraw.githubusercontent.com/apache/kafkaat:validVersionsflexibleVersionsheaderVersions2.4.0(first release with the API)936016a236845ae953426bcb48c3bf73e70608ec"0"3.9.0"0""none"4.0.0985bc99521dd22bbf620591b8db8613c54f596b2"0""none"trunk2c620cd26873d916778aefcb8fc9b9b3d294d04b"0-1""1+"{"0": "1", "1+": "3"}, response{"0": "0", "1+": "1"}"validVersions": "0". Ontrunk, version 1 exists and is marked unstable and flexible; the request file reads:// Version 1 enables flexible versions.,"validVersions": "0-1","flexibleVersions": "1+". Version 1 is therefore not implemented.trunkstates"headerVersions": {"0": "1", "1+": "3"}for the request. The released tags carry noheaderVersions(flexibleVersionsisnone), so a non-flexible version uses the non-flexible header.trunkstates"headerVersions": {"0": "0", "1+": "1"}for the response.GroupIdstring;Topicsarray of {Namestring;Partitionsarray of {PartitionIndexint32 } }.ErrorCodeint16 ("The top-level error code, or 0 if there was no error.");ThrottleTimeMsint32;Topicsarray of {Namestring;Partitionsarray of {PartitionIndexint32;ErrorCodeint16 ("The error code, or 0 if there was no error.") } }.Protocol guide (https://kafka.apache.org/protocol, which redirects to https://kafka.apache.org/44/design/protocol/, downloaded and read): the "OffsetDelete API (Key: 47)" entry gives
and the same field descriptions as the JSON. The guide's primitive types define
STRINGas an INT16 length followed by UTF-8 bytes andARRAYas an INT32 count followed by the items (theCOMPACT_*forms and tagged fields apply to flexible versions only), which is the encoding this codec writes and reads.Error codes the response carries: an INT16 top-level
error_codefor the group as a whole and an INT16error_codeper partition. The guide's OffsetDelete entry does not enumerate which codes occur; the codes are values of the guide's general error code table. Those relevant to this request there:UNKNOWN_TOPIC_OR_PARTITION3,COORDINATOR_LOAD_IN_PROGRESS14,COORDINATOR_NOT_AVAILABLE15,NOT_COORDINATOR16,INVALID_GROUP_ID24,TOPIC_AUTHORIZATION_FAILED29,GROUP_AUTHORIZATION_FAILED30,UNSUPPORTED_VERSION35,NON_EMPTY_GROUP68,GROUP_ID_NOT_FOUND69,GROUP_SUBSCRIBED_TO_TOPIC86 ("Deleting offsets of a topic is forbidden while the consumer group is actively subscribed to it."). The codec exposes the numeric codes unchanged and does not interpret them.Test evidence
KafkaOffsetDeleteRequestTestandKafkaOffsetDeleteResponseV0FWTestwere written by hand from the layout above, before the codec existed (the first commit contains only the tests); they are not copies of generator output. The test comments say they are laid out per the schema; they were not captured from a real Kafka encoder. As a cross-check, the three arrays (EXPECTED,BODY,GROUP_ERROR) were also compared against an independent encoding written separately from the guide layout with Pythonstruct(>hstring lengths,>icounts and indexes): all three matched byte for byte. The two malformed-response arrays (negative topic count, negative partition count) were written by hand the same way.package ...KafkaOffsetDeleteRequest does not exist/cannot find symbol. With the implementation but without the negative-count guard, run on this base, 2 of the 4KafkaOffsetDeleteResponseV0FWTesttests fail (shouldRejectNegativeTopicCount,shouldRejectNegativePartitionCount:expected:<IllegalStateException> but was:<IndexOutOfBoundsException>); with the guard they pass../mvnw clean verify -pl runtime/binding-kafka -Dmaven.build.cache.skipCache=trueon this branch (checkstyle and license checks on, upstream modules installed from the same checkout first): BUILD SUCCESS, 229 unit tests (218 on unmodified develop, plus the 11 new ones: 7 request, 4 response), 0 failures; 433 integration tests, 0 failures, 0 errors, 67 skipped.develop(555677939d623d2bcdb762181efd6adf92e2190a) build ofruntime/binding-kafka(clean verify -Dmaven.build.cache.skipCache=true -Dskip.checks=true) reports the same 433 integration tests with 67 skipped and 218 unit tests with 0 skipped, so this change adds no skipped tests.buildmodule's notice check (unresolvedmanager/zpm-maven-pluginlicenses), unrelated to this change; upstream modules were installed with-Dskip.checks=trueinstead.Not delivered / follow-ups
🤖 Generated with Claude Code
https://claude.ai/code/session_01SiHVoUNXDUYPZYgFiM2Hx5