Skip to content

Add topic_data writer with wire-format tests#12

Merged
andreterroir merged 4 commits into
mainfrom
claude/topic-data-writer-QG5vl
Jun 2, 2026
Merged

Add topic_data writer with wire-format tests#12
andreterroir merged 4 commits into
mainfrom
claude/topic-data-writer-QG5vl

Conversation

@andreterroir

@andreterroir andreterroir commented Jun 2, 2026

Copy link
Copy Markdown
Owner

What

Adds writer.topic_data to protocol.zig, completing the producer-side serialization of a Produce request's topic data.

Per the Produce request spec (topic_data => topic_id (partition_data)), topic_data is a COMPACT array. The writer mirrors the existing writer.partition_data: it writes the element count as a compact array size, then for each topic writes the 16-byte UUID topic_id followed by the partition_data compact array (delegating to partition_data).

Why

produce_req already serializes the fixed part of the request, and partition_data serializes a partition array, but there was no function to write the topic data array that sits between them on the wire. This fills that gap so the Produce request body can be fully serialized.

Tests

Two wire-format tests in the exact-bytes style of the existing partition_data tests:

  • topic_data writes count, ids, and partition_data — one topic with two partitions (one with records, one with null records), asserting the array count, UUID, and nested partition bytes.
  • topic_data writes empty array — asserts just the compact array size (0x01) for zero topics.

zig build test --summary all → 26/26 pass; zig build is clean.

Scope

Writer only, no reader — mirroring the deliberately writer-only partition_data. No client.zig / klog.zig wiring; left for a follow-up.

@andreterroir andreterroir merged commit ba2cd48 into main Jun 2, 2026
1 check passed
@andreterroir andreterroir deleted the claude/topic-data-writer-QG5vl branch June 2, 2026 08:34
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.

2 participants