Conversation
Seven improvements to the code generator, all purely internal refactors that produce identical generated output: - Thread file/line context into all parse errors via scanner.dief() - Replace right-to-left request modifier parsing with split-and-switch - Replace notTopLevelRe regex with simple suffix check + modifier loop - Extract parseSpecialField() for ThrottleMillis/TimeoutMillis detection - Extract resolveType() from BuildFrom for type resolution - Move tag/version validation from gen.go into a post-parse validateStructs() pass - Add mustParseInt/mustParseUint helpers to reduce numeric Defaulter boilerplate Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Validates structural equivalence between the DSL definitions and the Kafka project's JSON message definitions: version ranges, field types, tags, nullable properties, and field ordering at every protocol version. Set KAFKA_DIR to the Kafka repo root to run; skips otherwise. Excludes versions marked latestVersionUnstable in the JSON. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- AddRaftVoterRequest, UpdateRaftVoterRequest: Listeners.Port int16 → uint16 - AlterPartitionRequest: NewIsrWithEpochs.BrokerEpoch int32 → int64 - DescribeTopicPartitionsResponse: ErrorCode fields int32 → int16 - EndQuorumEpochRequest: PreferredSuccessors v0-v0 (was all versions) - ShareFetchRequest: PartitionMaxBytes v0-v0 (was all versions) - UpdateFeaturesResponse: Results v0-v1 (was all versions) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sparse-checks out apache/kafka for just the JSON message definitions and runs the validation test. Triggers on changes to generate/. Co-Authored-By: Claude Opus 4.6 <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.
A test now exists for the parser to compare my DSL to Kafka json files. That found, unfortunately for me, a
TECHNICALLY the protocol changes in kmsg are BREAKING CHANGES.
That said, the current parsing is WRONG and using the protocols that are being fixed here just outright doesn't work.
I checked and none of this repo uses these protocol requests.
I'm going to push this as a patch since it's straight up a bug fix; existing code is unusable.
Any change in the generate directory will trigger a test in CI validating it against the Kafka protocol.