Skip to content

feat: introduce fetch_hyper#437

Merged
martintmk merged 25 commits into
mainfrom
fetch_hyper
May 22, 2026
Merged

feat: introduce fetch_hyper#437
martintmk merged 25 commits into
mainfrom
fetch_hyper

Conversation

@martintmk

@martintmk martintmk commented May 20, 2026

Copy link
Copy Markdown
Member

Extracting hyper-related APIs into separate crate. These APIs should be treated only as an internal implementation detail of hyper transport and will never be used directly nor exposed publicly from fetch.

Public APIs are kept to a minimum:

image

Adds a new fetch_hyper crate that provides a hyper-based HTTP client transport implementing the http_extensions handler interface.

Highlights:

- HyperTransportBuilder for assembling a transport from a user-supplied connector, spawner, clock, TLS backend, and body builder, with hooks to configure the underlying hyper client.

- Connection layer with a client connector, hyper connector adapter, tracked stream wrapper, and hyper-based request handler.

- Pluggable TLS backend with a rustls-based connector.

- Configurable options, recoverability classification, error labels, and telemetry surface for observability.

- Test support module and a smoke test exercising the end-to-end transport.

Also extends templated_uri with small base_uri/origin helpers required by the transport.
@github-actions

github-actions Bot commented May 20, 2026

Copy link
Copy Markdown

⚠️ Breaking Changes Detected

error: failed to retrieve local crate data from git revision

Caused by:
    0: failed to retrieve manifest file from git revision source
    1: possibly due to errors: [
         failed when reading /home/runner/work/oxidizer/oxidizer/target/semver-checks/git-origin_main/372167fc8c6a5f23d81f716e0394d6162653999d/scripts/crate-template/Cargo.toml: TOML parse error at line 9, column 26
         |
       9 | keywords = ["oxidizer", {{CRATE_KEYWORDS}}]
         |                          ^
       missing key for inline table element, expected key
       : TOML parse error at line 9, column 26
         |
       9 | keywords = ["oxidizer", {{CRATE_KEYWORDS}}]
         |                          ^
       missing key for inline table element, expected key
       ,
         failed to parse /home/runner/work/oxidizer/oxidizer/target/semver-checks/git-origin_main/372167fc8c6a5f23d81f716e0394d6162653999d/Cargo.toml: no `package` table,
       ]
    2: package `fetch_hyper` not found in /home/runner/work/oxidizer/oxidizer/target/semver-checks/git-origin_main/372167fc8c6a5f23d81f716e0394d6162653999d

Stack backtrace:
   0: anyhow::error::<impl anyhow::Error>::msg
   1: cargo_semver_checks::rustdoc_gen::RustdocFromProjectRoot::get_crate_source
   2: cargo_semver_checks::rustdoc_gen::StatefulRustdocGenerator<cargo_semver_checks::rustdoc_gen::CoupledState>::prepare_generator
   3: cargo_semver_checks::Check::check_release::{{closure}}
   4: cargo_semver_checks::Check::check_release
   5: cargo_semver_checks::exit_on_error
   6: cargo_semver_checks::main
   7: std::sys::backtrace::__rust_begin_short_backtrace
   8: main
   9: <unknown>
  10: __libc_start_main
  11: _start

If the breaking changes are intentional then everything is fine - this message is merely informative.

Remember to apply a version number bump with the correct severity when publishing a version with breaking changes (1.x.x -> 2.x.x or 0.1.x -> 0.2.x).

@codecov

codecov Bot commented May 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.0%. Comparing base (b5900ac) to head (79488d3).

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #437    +/-   ##
========================================
  Coverage   100.0%   100.0%            
========================================
  Files         286      299    +13     
  Lines       22978    23562   +584     
========================================
+ Hits        22978    23562   +584     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@martintmk martintmk marked this pull request as ready for review May 21, 2026 08:52
Copilot AI review requested due to automatic review settings May 21, 2026 08:52

Copilot AI 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.

Pull request overview

This PR introduces a new internal crate, fetch_hyper, to host the Hyper-based transport implementation and related utilities while keeping these APIs as an implementation detail (not part of the public surface of higher-level fetch/SDK crates). It also extends templated_uri with explicit vs effective port handling to support transport/telemetry needs.

Changes:

  • Added new crates/fetch_hyper crate with transport builder, connection plumbing, TLS backend selection, telemetry helpers, and extensive unit/integration tests + snapshots.
  • Updated templated_uri to distinguish explicit ports (port()) from scheme-inferred defaults (effective_port()), with tests/docs updates.
  • Wired the new crate into the workspace (root Cargo.toml deps, root README/changelog indices, lockfile updates).

Reviewed changes

Copilot reviewed 36 out of 37 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
README.md Adds fetch_hyper to the workspace crate list.
crates/templated_uri/src/origin.rs Adds Origin::effective_port() and clarifies port() semantics + tests.
crates/templated_uri/src/base_uri.rs Updates BaseUri::port() semantics and adds effective_port() + tests/docs.
crates/fetch_hyper/tests/smoke.rs Adds wiremock-based end-to-end smoke coverage for the transport.
crates/fetch_hyper/src/tls/mod.rs Introduces TlsBackend public enum and conversions + tests.
crates/fetch_hyper/src/tls/connector.rs Adds internal TLS connector dispatch for rustls/native-tls.
crates/fetch_hyper/src/timer.rs Implements a tick::Clockhyper::rt::Timer adapter + tests.
crates/fetch_hyper/src/testing.rs Adds in-process fakes/helpers for transport testing.
crates/fetch_hyper/src/telemetry.rs Adds ConnectionInfo response extension and OTel attribute helpers + snapshots/tests.
crates/fetch_hyper/src/snapshots/fetch_hyper__telemetry__tests__create_connection_failure_attributes_includes_error_type.snap Snapshot for failure connection attributes.
crates/fetch_hyper/src/snapshots/fetch_hyper__telemetry__tests__create_connection_attributes_emits_expected_keys.snap Snapshot for success connection attributes.
crates/fetch_hyper/src/snapshots/fetch_hyper__options__tests__debug_renders_unlimited.snap Snapshot for ConnectionLifetime debug output (Unlimited).
crates/fetch_hyper/src/snapshots/fetch_hyper__options__tests__debug_renders_per_connection_without_closure_fmt_panic.snap Snapshot for ConnectionLifetime debug output (PerConnection).
crates/fetch_hyper/src/snapshots/fetch_hyper__options__tests__debug_renders_fixed.snap Snapshot for ConnectionLifetime debug output (Fixed).
crates/fetch_hyper/src/snapshots/fetch_hyper__builder__tests__defaults.snap Snapshot for builder default configuration.
crates/fetch_hyper/src/snapshots/fetch_hyper__builder__tests__configured.snap Snapshot for configured builder state.
crates/fetch_hyper/src/recoverability.rs Adds recoverability detection over error chains + tests.
crates/fetch_hyper/src/options.rs Adds RequestFilter and ConnectionLifetime configuration types + tests.
crates/fetch_hyper/src/lib.rs Declares crate modules and public exports; documents internal-only nature.
crates/fetch_hyper/src/error_labels.rs Adds centralized error label constants and label collection logic + tests.
crates/fetch_hyper/src/connection/tracked_stream.rs Adds connection lifecycle tracking stream wrapper with metrics/logs + tests.
crates/fetch_hyper/src/connection/snapshots/fetch_hyper__connection__client_connector__tests__verify_protocol_version_rejects_unsupported.snap Snapshot for unsupported negotiated protocol error message.
crates/fetch_hyper/src/connection/mod.rs Declares connection submodules and re-exports.
crates/fetch_hyper/src/connection/io.rs Defines HyperIo trait alias and Box<dyn HyperIo> connection impl + tests.
crates/fetch_hyper/src/connection/hyper_handler.rs Implements internal hyper-util client handler and poisoning logic + tests.
crates/fetch_hyper/src/connection/hyper_connector_adapter.rs Adapts layered connector to tower::Service<Uri> for hyper-util + tests.
crates/fetch_hyper/src/connection/connect.rs Defines the public Connect trait alias.
crates/fetch_hyper/src/connection/client_connector.rs Implements connect-timeout, protocol verification, and telemetry around connects + tests.
crates/fetch_hyper/src/builder.rs Adds HyperTransportBuilder and type-erased HyperTransport wrapper + tests/snapshots.
crates/fetch_hyper/README.md Adds crate README (doc2readme-style output).
crates/fetch_hyper/logo.png Adds crate logo via Git LFS.
crates/fetch_hyper/favicon.ico Adds crate favicon via Git LFS.
crates/fetch_hyper/CHANGELOG.md Adds initial changelog file.
crates/fetch_hyper/Cargo.toml Adds crate manifest, features, deps, and test configuration.
CHANGELOG.md Adds fetch_hyper to root changelog index.
Cargo.toml Adds fetch_hyper workspace dependency and new workspace deps (hyper TLS/rustls/semconv/wiremock).
Cargo.lock Locks new dependency graph introduced by fetch_hyper and TLS/test deps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/fetch_hyper/src/testing.rs
Comment thread crates/fetch_hyper/src/telemetry.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs Outdated
Comment thread crates/fetch_hyper/src/tls/mod.rs
Comment thread crates/fetch_hyper/src/telemetry.rs
Comment thread crates/fetch_hyper/Cargo.toml Outdated
Comment thread crates/fetch_hyper/src/lib.rs
Comment thread crates/fetch_hyper/src/error_labels.rs
- Use BaseUri::effective_port() in tracing events so default ports for
  http/https are included.
- Omit server.port metric attribute when effective_port() is None instead
  of recording a misleading port 0.
- Update testing module docs to reflect that it is crate-internal only.
- Drop unused optional �ytes dependency; testing fakes already rely on
  the dev-dependency.
- Remove redundant frozen-clock is_expired test whose name contradicted
  its assertion; the ClockControl-based test already covers the case.
- Make clone_preserves_variant actually exercise Clone for both
  TlsBackend variants.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 21, 2026 09:19

Copilot AI 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.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 8 comments.

Comment thread crates/fetch_hyper/src/builder.rs
Comment thread crates/fetch_hyper/src/connection/hyper_handler.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/fetch_hyper/src/connection/hyper_connector_adapter.rs
Comment thread crates/fetch_hyper/src/timer.rs
Comment thread crates/fetch_hyper/src/testing.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/templated_uri/src/base_uri.rs
Copilot AI review requested due to automatic review settings May 21, 2026 10:38

Copilot AI 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.

Pull request overview

Copilot reviewed 36 out of 37 changed files in this pull request and generated 4 comments.

Comment thread crates/fetch_hyper/src/timer.rs
Comment thread crates/fetch_hyper/Cargo.toml
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/fetch_hyper/CHANGELOG.md
Copilot AI review requested due to automatic review settings May 21, 2026 12:43

Copilot AI 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.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated 2 comments.

Comment thread crates/fetch_hyper/src/builder.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Copilot AI review requested due to automatic review settings May 22, 2026 06:52

Copilot AI 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.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

crates/fetch_hyper/CHANGELOG.md:2

  • crates/fetch_hyper changelog is currently just a header. Other crates in this workspace include at least an ## Unreleased section or an initial ## [0.1.0] entry; having an empty changelog makes release tooling and changelog navigation less useful. Consider adding an ## Unreleased section (and/or an initial ## [0.1.0] entry) consistent with the rest of the repo’s changelogs.
# Changelog

Comment thread crates/fetch_hyper/src/connection/client_connector.rs
@martintmk martintmk enabled auto-merge (squash) May 22, 2026 08:06
Copilot AI review requested due to automatic review settings May 22, 2026 13:11

Copilot AI 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.

Pull request overview

Copilot reviewed 34 out of 35 changed files in this pull request and generated 3 comments.

Comment thread crates/fetch_hyper/src/connection/client_connector.rs
Comment thread crates/fetch_hyper/src/builder.rs
Comment thread crates/fetch_hyper/src/connection/client_connector.rs
@martintmk martintmk merged commit 460b7b8 into main May 22, 2026
31 checks passed
@martintmk martintmk deleted the fetch_hyper branch May 22, 2026 15:55
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.

4 participants