Repository navigation
refactor(gateways): split long files in the Kafka gateway - #5145
Open
thepatrykk wants to merge 3 commits into
Open
thepatrykk wants to merge 3 commits into
thepatrykk wants to merge 3 commits into
Conversation
group/state.rs ran past the 2500 line limit of file-length.sh, and its tests alone came to 3327 lines. They move into group/state/tests/, one file per topic: join, describe, delete_and_list, pricing, membership, leave, commit and static_members. A helper that serves one topic moves with it, and the shared helpers and imports stay in tests/mod.rs.
protocol/handlers/fetch.rs ran past the 2500 line limit of file-length.sh. Its tests move unchanged into fetch/tests.rs.
kafka_client_e2e_tests.rs ran past the 2500 line limit of file-length.sh. Its tests move into sasl, client_versions, admin_tools, kcat_records, groups, offsets_for_times, tls, failover and stalls. The file is a test crate root, so the children are declared with #[path], as the common modules already are, and cargo does not take them for test crates of their own. The shared fixtures stay in the root.
thepatrykk
marked this pull request as ready for review
December 1, 2026 18:34
This branch has not been deployed
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.
scripts/ci/file-length.sh caps a Rust file at 2500 lines of code.
Three files of the Kafka gateway sat over the cap on the allowlist.
The group/state.rs tests alone came to 3327 lines, more than one file
can hold under the cap. They move into group/state/tests/, one file
per topic: join, describe, delete and list, pricing, membership,
leave, commit and static members. The fetch handler tests move into
fetch/tests.rs.
tests/kafka_client_e2e_tests.rs moves its tests into sasl,
client_versions, admin_tools, kcat_records, groups,
offsets_for_times, tls, failover and stalls. The file is a test crate
root, so a plain mod declaration looks for the child next to it.
Cargo takes a file there for a test crate of its own. The children
are declared with #[path] instead, as the common modules already are.
A helper that serves one topic moves with it, and the shared helpers
and fixtures stay in the parent. The code moves as it is, apart from
the line wraps that rustfmt makes at the new indent. The same 911
unit tests pass before and after, and the e2e crate lists the same
37 tests. The three files leave the allowlist.