Skip to content

refactor(runtime): extract plain resolver into PlainResolverHandler - #5319

Merged
tombentley merged 1 commit into
kroxylicious:mainfrom
ig-suyas:refactor/extract-plain-resolver-handler
Nov 18, 2026
Merged

tombentley merged 1 commit into
kroxylicious:mainfrom
ig-suyas:refactor/extract-plain-resolver-handler

Conversation

@ig-suyas

@ig-suyas ig-suyas commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #5317

Moves the anonymous plainResolver handler out of KafkaProxyInitializer.initPlainChannel into a package-private PlainResolverHandler. The binding resolver, an initConnection callback and the client-to-proxy error counter are passed to its constructor.

Behaviour is unchanged, except that the warning logged when binding resolution fails now uses the PlainResolverHandler logger.

Tests: PlainResolverHandlerTest covers the state machine directly with EmbeddedChannel. The ArgumentCaptor-based tests in KafkaProxyInitializerTest are replaced with a smoke test that checks the handler is installed in the pipeline.

The TLS/SNI resolver is not extracted here. I can do that in a follow-up PR if you'd like.

I ran the affected unit tests, the license check and the formatter locally. I couldn't run the full suite locally because of a Windows loopback networking problem (Netty "Invalid argument: connect"), so I'm relying on CI for that.

AI disclosure: AI tools assisted with this change (Claude Fable 5.2). The commit includes the Assisted-by: trailer, and I reviewed the code myself.

Move the anonymous "plainResolver" handler out of
KafkaProxyInitializer.initPlainChannel into a package-private
PlainResolverHandler. The binding resolver, a callback that initialises
the connection and the client-to-proxy error counter are passed to its
constructor. Behaviour is unchanged, except that the warning logged when
binding resolution fails now uses the PlainResolverHandler logger.

Cover the handler's state machine directly in PlainResolverHandlerTest
using EmbeddedChannel. Replace the ArgumentCaptor based tests in
KafkaProxyInitializerTest with a smoke test that checks the handler is
installed in the pipeline of a plain channel.

The TLS/SNI resolver is not extracted here.

Closes kroxylicious#5317

Assisted-by: Claude Fable 5.2 <[email protected]>
Signed-off-by: Naitik Singh <[email protected]>

@k-wall k-wall left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you @ig-suyas. Appears to be a faithful extract class, which is what the issue requested.
Since I raised the original issue, I'd like another committer to review too.

The TLS/SNI resolver is not extracted here. I can do that in a follow-up PR if you'd like.

My gut feel is that this would be an improvement. Try it and see what you think. If it looks good, we'd be happy to see a follow up PR.

@ig-suyas

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @k-wall ! I'll take a look at the TLS resolver extraction and open a follow-up PR.

@sonarqubecloud

Copy link
Copy Markdown

@sonarqubecloud

Copy link
Copy Markdown

@ig-suyas

Copy link
Copy Markdown
Contributor Author

Hi @k-wall , just a quick update: I'm working on the TlsResolverHandler extraction now. I'll open it as a separate follow-up PR and tag you for review. Should I wait for this PR to merge first, or is it fine to open it on top of this branch?

@tombentley tombentley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @ig-suyas

@tombentley
tombentley enabled auto-merge November 17, 2026 19:31
@robobario

Copy link
Copy Markdown
Member

something has gone a bit wrong with the CI, I've tried kicking off a re-run of the PR integration tests, hopefully that unblocks things. Else would be cleanest to update the branch to incorporate the latest main changes so a new CI run is triggered.

@ig-suyas

Copy link
Copy Markdown
Contributor Author

Thanks @robobario for re-running the tests. I can still see the same checks failing. Has the re-run finished, or should I update the branch with the latest main to start a fresh run? I’m happy to do either.

@k-wall

k-wall commented Nov 18, 2026

Copy link
Copy Markdown
Member

CI Failure Analysis

Failed Test: io.kroxylicious.it.TopologyServiceIT.invalidateRouteShouldForceFreshMetadataLookup

Failure Details:
The metadata cache still contains a deleted topic key after route invalidation. Expected the cache NOT to contain the topic, but it does.

Related Issues:

Analysis:
Despite the fix in PR #4973 that supposedly closed #4963, this test is still failing. The invalidation logic appears to not be properly clearing the cached topic metadata. This suggests the fix was incomplete or there's a race condition in the cache invalidation.

@tombentley
tombentley added this pull request to the merge queue Nov 18, 2026
Merged via the queue into kroxylicious:main with commit a0a6344 Nov 18, 2026
217 of 240 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/refactoring network Relates to proxy networking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(runtime): extract PlainResolverHandler (and possibly TlsResolverHandler) from KafkaProxyInitializer

4 participants