refactor(cli): remove duplicate connection code - #302
Merged
Conversation
ember-cli had its own connection.rs with ~85% overlap with ember-client/src/connection.rs — identical error types, frame read loop, send/auth/disconnect logic, and TlsClientConfig struct. - expose TlsClientConfig publicly from ember-client (tls feature) - re-export it from ember-cli::tls, removing the duplicate struct - add ember-client dependency to ember-cli - update all callers (repl, batch, watch, cluster, main) to use Client::connect / Client::connect_tls, .send(), .auth(), .disconnect() - inline auth_frame in bench_conn.rs (4-line helper, one call site) - delete crates/ember-cli/src/connection.rs
kacy
force-pushed
the
feat/snapshot-scheduling
branch
from
February 25, 2026 16:38
b5905bb to
e354aca
Compare
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.
summary
when
ember-clientwas added as a standalone crate, the connection logicwas written fresh rather than wiring the CLI to use it. the result was ~85%
duplication: both crates had their own
Connection/Clientstruct, identicalerror types, the same frame read loop, and a copy of
TlsClientConfig.this PR removes the dead copy from
ember-cliand wires it toember-client.what changed:
ember-client::TlsClientConfigis now public and re-exported from the crate rootember-cli::tlsre-exports it instead of defining its own identical structember-cligains anember-clientdependencyClient::connect/Client::connect_tls,.send(),.auth(), and.disconnect()auth_framein bench_conn.rs was a 4-line, single-caller helper — inlined directlycrates/ember-cli/src/connection.rsdeletedbench_conn.rsstill ownsMaybeTlsStreamand the raw TLS connect path forpipelining — that code is benchmark-specific and stays.
what was tested
cargo build -p emberkv-cli— clean, zero warningscargo clippy -p emberkv-cli -- -D warnings— cleancargo test -p emberkv-cli— 114/114 passcargo test --workspace— 78/79 integration tests pass; the failingcluster_moved_redirecttest is a pre-existing flaky race unrelated to this changecargo fmt --all --check— cleandesign notes
bench_conn.rsbypassesClientintentionally — it pre-serializes commandsand writes raw bytes for pipeline benchmarking. it still reads from
crate::tls::MaybeTlsStreamdirectly, which is the right level of abstractionfor that use case.