feat: minimize default features and complete EventListener coverage - #76
Merged
Merged
Conversation
Make the workspace mobile-friendly and align call observability with OkHttp: - Pin workspace deps with default-features = false and request only the Tokio, Hyper, tower, and rustls features production crates actually use. - Split compression into gzip/deflate/brotli/zstd, with compression-core as the internal gate. Zero-codec builds compile and inject no Accept-Encoding. - Gate the built-in Jar behind the cookies feature (enabled by default). - Create EventListener at Call construction so cancel-before-execute and dispatcher events share a listener. - Add dispatcher, proxy, TLS handshake, request/response body, cancel, retry_decision, follow_up_decision, and cache callbacks. - Emit present empty-body events at Hyper handoff, classify try-send failures independently of request commitment, and fire response_body_start on first data or close-without-read.
Clippy 1.98 result_large_err fails because WebSocketError inlined WireError and exceeded 128 bytes. Box the IO payload so Result<_, WebSocketError> stays small without changing the public callback surface.
3 tasks
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
Mobile-friendly Cargo features plus OkHttp-aligned call observability, including the four P2s from the local review.
Features and dependency pins
tokio/full,hyper/full,tower/timeout, rustls logging, extrafutures-utilmacros).rt/net/time/io-util/sync) and Hyper (client/http1/http2) features they use.gzip/deflate/brotli/zstd.compressionremains the default umbrella.compression-coreis the internal module gate; enabling it with no codec compiles and injects noAccept-Encoding.Jarmoves behind thecookiesfeature (still default-on). CustomCookieJarimplementations do not need it.jsonnow also gates logger pretty-print.EventListener lifecycle
EventListenerFactory::createruns atClient::new_call/Call::try_clone, so cancel-before-execute and dispatcher events share a listener.tls_handshake, request/response body start,request_failed,response_failed,canceled,retry_decision,follow_up_decision, cache hit/miss/conditional/satisfaction.ProxyEvent,TlsHandshake.Body-event correctness (review P2s)
explicit_empty,from_static(b"")) emitrequest_body_start/request_body_end 0at Hyper handoff instead of being skipped.CallContextflags, not HyperTrySendErrorcommitment, so upload errors do not also emitresponse_failed.response_body_startwaits for first data (or close without a prior read), matching OkHttp 4.3 / the trait docs.Compatibility
default-features = falsedependents that usedJarmust now enablecookies, and must declare any extra Tokio/Hyper features their own crate needs.Test plan
cargo check -p openwire --no-default-features --features compression-core --libcargo check -p openwire --no-default-features --features gzip --libcargo clippy -p openwire-core -p openwire --lib -- -D warningscargo test -p openwire-core --lib request_exchange_observationcargo test -p openwire --lib compression::testsrequest_failed, absent-bodyresponse_failed, delayedresponse_body_start, plus existing body/dispatcher/pool event testscargo test --workspace --all-featuresnot run locally (disk ~2.5Gi free)