Skip to content

refactor(sdk): delete code through refactor - #4571

Open
ByteBaker wants to merge 1 commit into
apache:masterfrom
ByteBaker:refactor/sdk-client-wrapper-dispatch
Open

ByteBaker wants to merge 1 commit into
apache:masterfrom
ByteBaker:refactor/sdk-client-wrapper-dispatch

Conversation

@ByteBaker

@ByteBaker ByteBaker commented Oct 16, 2026 •

Copy link
Copy Markdown

Closes #4573

  • Keep transport selection in one place to simplify SDK maintenance.
  • Replace 55 repeated matches with a private client accessor.

Rationale

There were lots of repeated client matches doing the same thing.

What changed?

  • Replaced repeated lines with a new method ClientWrapper::as_client(...) -> &dyn Client which handles the enum branch-matching within itself.
  • Add a test nested_client_wrapper_forwards_results_and_errors to test the SDK over various transport types.

GOOD: >650 net lines deleted.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

  1. Which tools? Codex
  2. generated functions, mostly as a typist
  3. Through tests and then manually read throught the whole thing
  4. Absolutely.

@github-actions

Copy link
Copy Markdown

This PR is closed because its description has no Closes #N, Fixes #N, Resolves #N or Relates to #N line naming an issue.

Every PR needs an issue that was assigned to you before work started. See CONTRIBUTING.md.

@github-actions github-actions Bot closed this Oct 16, 2026
@hubcio

hubcio commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Please create an issue and reopen :)

@ByteBaker

Copy link
Copy Markdown
Author

Hey @hubcio, I can't seem to reopen the issue. Seems like a permission thing. Could you please reopen this. Thanks 🙏

@hubcio hubcio reopened this Oct 16, 2026
@codecov

codecov Bot commented Oct 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.42%. Comparing base (fe3b426) to head (2e550b0).
⚠️ Report is 1 commits behind head on master.

❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@              Coverage Diff              @@
##             master    #4571       +/-   ##
=============================================
- Coverage     89.49%   79.42%   -10.08%     
  Complexity     1784     1784               
=============================================
  Files          1330     1278       -52     
  Lines        284420   199500    -84920     
  Branches     242863   157945    -84918     
=============================================
- Hits         254551   158459    -96092     
- Misses        24227    35259    +11032     
- Partials       5642     5782      +140     
Components Coverage Δ
Rust Core 79.30% <100.00%> (-11.45%) ⬇️
Java SDK 70.71% <ø> (ø)
C# SDK 66.08% <ø> (-13.30%) ⬇️
Python SDK 90.43% <ø> (ø)
PHP SDK 85.84% <ø> (ø)
Node SDK 95.12% <ø> (ø)
Go SDK 70.88% <ø> (ø)
C++ SDK 84.44% <ø> (ø)
Files with missing lines Coverage Δ
core/sdk/src/client_wrappers/binary_client.rs 70.00% <ø> (ø)
...e/sdk/src/client_wrappers/binary_cluster_client.rs 100.00% <ø> (ø)
...rc/client_wrappers/binary_consumer_group_client.rs 85.71% <ø> (ø)
...c/client_wrappers/binary_consumer_offset_client.rs 100.00% <ø> (ø)
...e/sdk/src/client_wrappers/binary_message_client.rs 66.66% <ø> (ø)
...sdk/src/client_wrappers/binary_partition_client.rs 100.00% <ø> (ø)
...nt_wrappers/binary_personal_access_token_client.rs 100.00% <ø> (ø)
...e/sdk/src/client_wrappers/binary_segment_client.rs 100.00% <ø> (ø)
...re/sdk/src/client_wrappers/binary_stream_client.rs 100.00% <ø> (ø)
...re/sdk/src/client_wrappers/binary_system_client.rs 100.00% <ø> (ø)
... and 3 more

... and 450 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@haubur haubur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @ByteBaker I like the refactor!
The pipeline failed for unrelated reasons which were fixed in the meantime.
A rebase should make it green.

- Keep transport selection in one place to simplify SDK maintenance.
- Replace 55 repeated matches with a private client accessor.
@ByteBaker
ByteBaker force-pushed the refactor/sdk-client-wrapper-dispatch branch from 2e550b0 to 55a6003 Compare October 18, 2026 19:59
@ByteBaker

Copy link
Copy Markdown
Author

@haubur thank you! I like deleting code. I'll try more such work in the future, and occasionally feature/fixes as well where I understand the code better.

This branch has not been deployed

No deployments
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.

Reduce repeated dispatch in Rust SDK client wrappers

3 participants