Skip to content

refactor: extract socket loop into its own module, move e2e tests to tests/ - #19

Merged
zheylmun merged 1 commit into
mainfrom
refactor/extract-socket-loop
Jun 29, 2026
Merged

zheylmun merged 1 commit into
mainfrom
refactor/extract-socket-loop

Conversation

@zheylmun

Copy link
Copy Markdown
Owner

Split lib.rs along its two natural seams. lib.rs now holds only the public
Socketeer handle (connect/send/receive/reconnect/close); the background task
that owns the split WebSocket stream moves to src/socket_loop.rs. The handle's
entire contract with the loop is now expressed through three pub(crate) items
(TxChannelPayload, send_close, socket_loop_split) plus the shared
WebSocketStreamType alias.

The ~580 lines of end-to-end tests, which only ever touched the public API and
the mocking exports, move to tests/integration.rs as integration tests. The
genuine unit tests in codec.rs stay inline.

Also folds in the trace-level normalization discussed alongside this work,
since those lines were relocated by the extraction: routine keepalive sends
info -> trace, per-message send debug -> trace (matching the receive side), and
the expected reconnect close-failure error -> debug.

No behavior change. All tests pass (15 unit, 25 integration, 5 doc); clippy
pedantic and rustfmt clean.

…tests/

Split lib.rs along its two natural seams. lib.rs now holds only the public
Socketeer handle (connect/send/receive/reconnect/close); the background task
that owns the split WebSocket stream moves to src/socket_loop.rs. The handle's
entire contract with the loop is now expressed through three pub(crate) items
(TxChannelPayload, send_close, socket_loop_split) plus the shared
WebSocketStreamType alias.

The ~580 lines of end-to-end tests, which only ever touched the public API and
the mocking exports, move to tests/integration.rs as integration tests. The
genuine unit tests in codec.rs stay inline.

Also folds in the trace-level normalization discussed alongside this work,
since those lines were relocated by the extraction: routine keepalive sends
info -> trace, per-message send debug -> trace (matching the receive side), and
the expected reconnect close-failure error -> debug.

No behavior change. All tests pass (15 unit, 25 integration, 5 doc); clippy
pedantic and rustfmt clean.
@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.61905% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.05%. Comparing base (ad2be98) to head (b7ec286).

Files with missing lines Patch % Lines
src/socket_loop.rs 97.61% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #19      +/-   ##
==========================================
- Coverage   98.52%   97.05%   -1.47%     
==========================================
  Files           5        6       +1     
  Lines         811      408     -403     
==========================================
- Hits          799      396     -403     
  Misses         12       12              

☔ 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 bd12665 into main Jun 29, 2026
13 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