Skip to content

Refactors public API for 1.0 readiness#23

Merged
zheylmun merged 7 commits into
mainfrom
feature/public-api-cleanup
Jun 30, 2026
Merged

Refactors public API for 1.0 readiness#23
zheylmun merged 7 commits into
mainfrom
feature/public-api-cleanup

Conversation

@zheylmun

Copy link
Copy Markdown
Owner

This release introduces significant breaking changes to socketeer's public API, aiming to tighten its surface, improve maintainability, and future-proof for 1.0.

Key Changes

  • Re-exports foreign types: Provides direct socketeer:: access to Message, Bytes, http module, tungstenite module (including Error), and WebSocketStreamType. This removes the need for downstream users to manage direct dependencies on these crates.
  • ConnectOptions builder: Replaces public fields with a builder pattern (ConnectOptions::builder()...build()) and marks the struct #[non_exhaustive]. This allows for future expansion of connection options without breaking changes.
  • Error enum is #[non_exhaustive]: Ensures new error variants can be added without forcing downstream match statements to update.
  • Mocking API cleanup: Moves the backpressure_probe_server test fixture out of the public API into internal test helpers, while making WebSocketStreamType publicly available for custom mock server implementations.
  • Documentation improvements: Adds metadata for docs.rs to build documentation with all features.

What it Solves

  • Eliminates the necessity for consumers to add direct, version-matched dependencies on bytes, http, and tokio-tungstenite for types already exposed by socketeer.
  • Allows ConnectOptions and Error to evolve with additive changes without introducing further breaking changes in their public interface.
  • Streamlines the mocking feature by removing a specific test utility from its public surface and clarifying the entry point for custom mock servers.

This aligns with the pre-1.0 public API cleanup strategy defined in the associated design and implementation plan.

zheylmun and others added 7 commits June 29, 2026 20:35
Re-export leaked foreign types, #[non_exhaustive] + builder for
ConnectOptions and #[non_exhaustive] Error, and tidy the mocking
surface (export WebSocketStreamType, move backpressure_probe_server
into the test suite).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…mType

These foreign types already appeared in the public API (send_raw,
RawCodec, Error, ConnectOptions, HandshakeContext, get_mock_address) but
were not re-exported, forcing downstream version-matched direct deps.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace public-field construction with ConnectOptions::builder() and make
the struct non_exhaustive so future options are additive. Fields become
pub(crate); internal reads are unchanged.

BREAKING CHANGE: ConnectOptions fields are no longer public; construct via
ConnectOptions::builder() or ::default().

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Allows new error variants to be added without a breaking change; downstream
matches must now include a wildcard arm.

BREAKING CHANGE: Error is now non_exhaustive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
It is a socketeer-specific test fixture, not a general-purpose mock; it
only reached the public API via the crate root. It now lives in
tests/support and drives the public get_mock_address/WebSocketStreamType
entry point.

BREAKING CHANGE: backpressure_probe_server is no longer re-exported.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…en test

- Re-export `ConnectOptionsBuilder` from `src/lib.rs` so downstream code
  can name the builder type (Fix 1)
- Reword `ConnectOptionsBuilder::header` doc to reflect `insert` (replace)
  semantics rather than append (Fix 2)
- Add `[package.metadata.docs.rs] all-features = true` to Cargo.toml so
  the `get_mock_address` intra-doc link resolves on docs.rs; extend
  `WebSocketStreamType` doc note to mention `mocking` feature (Fix 3)
- Strengthen `headers_replaces_whole_map` test: seed a prior header, call
  `.headers()`, assert the seeded header is gone (Fix 4)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.86%. Comparing base (059715f) to head (12c034a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #23      +/-   ##
==========================================
+ Coverage   94.64%   94.86%   +0.21%     
==========================================
  Files           7        7              
  Lines         635      662      +27     
==========================================
+ Hits          601      628      +27     
  Misses         34       34              

☔ View full report in Codecov by Harness.
📢 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.

@zheylmun
zheylmun merged commit a42ef72 into main Jun 30, 2026
12 of 14 checks passed
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.

1 participant