Skip to content

Rename payload() to into_payload() across codebase#445

Merged
leynos merged 6 commits intomainfrom
rename-payload-to-into-payload-q2jpyh
Feb 5, 2026
Merged

Rename payload() to into_payload() across codebase#445
leynos merged 6 commits intomainfrom
rename-payload-to-into-payload-q2jpyh

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Feb 5, 2026

Summary

Rename payload() to into_payload() across the codebase to better reflect ownership and consumption semantics. A deprecated payload() alias is kept to preserve compatibility while guiding users toward the new API.

Changes

  • Core API updates
    • Envelope (src/app/envelope.rs): use into_payload() when constructing envelopes from PacketParts; add a deprecated payload() alias that delegates to into_payload().
    • FragmentParts (src/fragment/packet.rs): replace payload() with into_payload(); keep a deprecated payload() alias delegating to into_payload().
    • PacketParts usage (src/app/envelope.rs, src/fragment/packet.rs, tests): adopt into_payload() where payload() was previously used; updated From implementations to use into_payload().
    • Fragmentation flow (src/app/fragmentation_state.rs, src/fragment/packet.rs): switch to into_payload() when extracting payload from parts.
    • Fragmentable/Envelope conversions updated to use into_payload() for fragment assembly.
  • Middleware and routing
    • Middleware (src/middleware.rs): return payload via into_payload() to align with new semantics.
  • Tests and test utilities
    • Updated tests and helpers to use into_payload() or env.into_parts().into_payload() where payload() was used.
    • Adjusted test_support and common test utilities accordingly.
  • Documentation and deprecation
    • Deprecated aliases added for payload() with deprecation notes (since 0.2.0) guiding users to into_payload().

Tests

  • All references to payload() in tests updated to into_payload() or into_parts().into_payload().
  • Existing deprecated payload() aliases preserved to avoid breaking downstream crates immediately.

Migration notes

  • Replace calls to payload() with into_payload() where ownership semantics are intended. The old payload() remains available but is deprecated and will be removed in a future release.

Validation plan

  • Run cargo test to ensure all tests compile and pass.
  • Verify fragments and envelopes are still serialized/deserialized correctly with the new method names.
  • Ensure both new and deprecated code paths behave identically in tests.

◳ Generated by DevBoxer


ℹ️ Tag @devboxerhub to ask questions and address PR feedback

📎 Task: https://www.devboxer.com/task/05d5a0ca-8547-4d9a-986d-b808005e7134

📝 Closes #305

Summary by Sourcery

Rename packet and fragment payload accessors to an owning into_payload() API while preserving a deprecated payload() alias for backward compatibility.

Enhancements:

  • Introduce into_payload() on PacketParts and FragmentParts to clarify ownership semantics when extracting payload bytes.
  • Add deprecation-shim payload() methods on PacketParts and FragmentParts that delegate to into_payload() to ease migration.
  • Update fragmentation, envelope conversion, middleware routing, and helper flows to use into_payload() when consuming payloads.

Tests:

  • Adjust tests, test helpers, and test support types to call into_payload() and validate behavior through the new API surface.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 5, 2026

Reviewer's Guide

Renames the consumptive payload accessor from payload() to into_payload() across core types, updates all call sites to use the new method, and introduces deprecated payload() aliases that forward to into_payload() to preserve backward compatibility and clarify ownership semantics.

Class diagram for payload and into_payload on core packet types

classDiagram
    class FragmentParts {
      +id() u64
      +correlation_id() Option<u64>
      +into_payload(self) Vec<u8>
      +payload(self) Vec<u8>
    }

    class PacketParts {
      +id() u64
      +correlation_id() Option<u64>
      +into_payload(self) Vec<u8>
      +payload(self) Vec<u8>
    }

    class Envelope {
      +new(id u64, correlation_id Option<u64>, payload Vec<u8>) Envelope
      +id(&self) u64
      +correlation_id(&self) Option<u64>
      +into_parts(self) PacketParts
    }

    class Fragmentable {
      <<trait>>
      +into_fragment_parts(self) FragmentParts
      +from_fragment_parts(parts FragmentParts) Self
    }

    class Packet {
      <<trait>>
      +into_parts(self) PacketParts
      +from_parts(parts PacketParts) Self
    }

    Fragmentable <|.. Packet
    PacketParts --> Envelope : converted_to
    FragmentParts --> Envelope : used_in_fragmentation
    PacketParts o--> FragmentParts : Fragmentable_impl_uses

    Envelope ..> PacketParts : From<PacketParts>_uses_into_payload
    Fragmentable ..> FragmentParts : uses_into_payload
    Fragmentable ..> PacketParts : uses_into_payload
Loading

Flow diagram for deprecated payload alias delegating to into_payload

flowchart LR
    A[PacketParts_or_FragmentParts_instance] --> B{Caller_method}
    B -->|prefers_new_API| C[into_payload]
    B -->|legacy_call| D[payload]
    C --> E[returns Vec<u8> payload]
    D --> F[delegates_to_into_payload]
    F --> C
Loading

File-Level Changes

Change Details Files
Introduce into_payload() on PacketParts and FragmentParts and keep payload() as a deprecated alias forwarding to it.
  • Add into_payload(self) -> Vec on FragmentParts and PacketParts returning the owned payload bytes.
  • Update rustdoc examples for FragmentParts and PacketParts to demonstrate into_payload() instead of payload().
  • Add #[deprecated] payload(self) -> Vec methods on FragmentParts and PacketParts delegating to into_payload() with version and guidance notes.
src/fragment/packet.rs
src/app/envelope.rs
Update envelope, fragmentation, and middleware flows to use into_payload() when consuming payloads from parts.
  • Change Envelope::from(PacketParts) to consume payload via into_payload().
  • Adjust Fragmentable impls and fragmentation_state to construct FragmentParts and decode fragment payloads using into_payload().
  • Update RouteService middleware response construction to extract payload from Envelope parts via into_payload().
src/app/envelope.rs
src/app/fragmentation_state.rs
src/fragment/packet.rs
src/middleware.rs
Align tests and test utilities with into_payload() while preserving semantics.
  • Replace uses of payload() with into_payload() or into_parts().into_payload() across integration and unit tests.
  • Update Packet implementations in test_support and common test envelopes to reconstruct values using into_payload().
  • Ensure helper functions and test-only echo server logic use into_payload() when rebuilding or mutating envelopes and frames.
tests/common/fragment_helpers.rs
tests/multi_packet_streaming.rs
src/client/tests/messaging.rs
src/connection/test_support.rs
tests/connection_fragmentation.rs
tests/common/mod.rs
tests/example_codecs.rs
tests/fragment_transport/rejection.rs
tests/frame_codec.rs
tests/middleware_order.rs
tests/packet_parts.rs
tests/response.rs
wireframe_testing/src/echo_server.rs

Assessment against linked issues

Issue Objective Addressed Explanation
#305 Add a consuming into_payload(self) -> Vec<u8> method to PacketParts.
#305 Deprecate the existing payload(self) -> Vec<u8> method on PacketParts while keeping it as a non-breaking alias that delegates to into_payload.
#305 Update internal examples and call sites to use into_payload() instead of payload() while maintaining backwards compatibility.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 5, 2026

Summary by CodeRabbit

  • Breaking Changes

    • Payload accessors renamed to into_payload(), switching payload retrieval to a consuming API.
    • Configuration builder spelling fixed: normalised → normalized.
  • Documentation

    • Migration guide updated with before/after examples for the payload accessor and config rename.
  • Tests

    • Extensive new and reorganised preamble and fragmentation tests; assertions updated for consuming payload accessors.
  • Chores

    • New Makefile target: typecheck (workspace typecheck).

Walkthrough

Rename consuming payload accessors to into_payload(self) across the codebase; update all call sites, tests, examples, the migration guide and preamble test structure to use the consuming method and new modular test modules.

Changes

Cohort / File(s) Summary
Core API & Envelope
src/app/envelope.rs
Replace PacketParts::payload(self) with PacketParts::into_payload(self) and update Envelope conversions and Fragmentable blanket impls to consume payload via into_payload().
Fragment parts
src/fragment/packet.rs
Rename FragmentParts::payload(self)into_payload(self); update internal usages and doc example.
Fragmentation / Reassembly
src/app/fragmentation_state.rs, tests/connection_fragmentation.rs, tests/common/fragment_helpers.rs
Consume payload with into_payload() when creating, decoding and reassembling fragments; adjust reassemble and helper flows accordingly.
Middleware & Server handlers
src/middleware.rs, wireframe_testing/src/echo_server.rs
Change payload extraction to parts.into_payload() in request handling and server mismatch handling.
Packet impls & test support
src/connection/test_support.rs, tests/common/mod.rs
Update from_parts impls to use parts.into_payload() (u8, Vec<u8>, CommonTestEnvelope).
Tests — Payload accessor updates
src/client/tests/messaging.rs, tests/frame_codec.rs, tests/example_codecs.rs, tests/fragment_transport/rejection.rs, tests/multi_packet_streaming.rs, tests/packet_parts.rs, tests/response.rs, tests/middleware_order.rs
Replace .payload() calls on parts with .into_payload() across test suites; adapt assertions and ownership usage where necessary.
Preamble tests refactor & additions
tests/preamble.rs, tests/preamble/basic.rs, tests/preamble/callbacks.rs, tests/preamble/responses.rs, tests/preamble/support.rs, tests/preamble/timeouts.rs
Replace large inlined preamble test block with modular test files; add multiple preamble test modules and shared support utilities.
Docs / Migration guide
docs/v0-1-0-to-v0-2-0-migration-guide.md
Document breaking-change: PacketParts::payload / FragmentParts::payloadinto_payload; update examples and note other renames.
Misc — Makefile
Makefile
Add typecheck target and include it in .PHONY.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

codex

Poem

Into the bytes, take the move 🦀
Ownership shifts, make the change smooth.
Rename the getter, follow Rust's law—
Update tests, docs and examples in awe.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately reflects the main change: renaming payload() to into_payload() across the codebase to better reflect ownership semantics.
Description check ✅ Passed The PR description clearly explains the changes, including core API updates, deprecated aliases, migration path, and validation plan related to the payload/into_payload rename.
Linked Issues check ✅ Passed The PR fulfils all coding objectives from issue #305: into_payload() added to PacketParts and FragmentParts [#305], deprecated payload() aliases provided [#305], internal call sites updated across fragmentation, envelope, middleware, and test flows [#305], and backward compatibility maintained [#305].
Out of Scope Changes check ✅ Passed All changes remain in scope: payload accessor renames across core, fragmentation, middleware, tests, and documentation. One tangential addition (Makefile typecheck target) is minimal and unrelated but does not detract from the primary objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch rename-payload-to-into-payload-q2jpyh

Comment @coderabbitai help to get the list of available commands and usage tips.

@leynos leynos marked this pull request as ready for review February 5, 2026 12:02
sourcery-ai[bot]

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 3-4: Replace the en-GB-oxford-inconsistent word "summarises" in
the document heading sentence ("This guide summarises the breaking changes you
need to address when migrating from wireframe v0.1.0 to v0.2.0.") with the
en-GB-oxendict spelling "summarizes" to conform to the coding guidelines; update
that exact sentence to read "This guide summarizes the breaking changes you need
to address when migrating from wireframe v0.1.0 to v0.2.0."

Comment thread docs/v0-1-0-to-v0-2-0-migration-guide.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/preamble.rs (1)

1-561: 🧹 Nitpick | 🔵 Trivial

File exceeds 400-line limit.

At 561 lines, this file surpasses the 400-line threshold specified in the coding guidelines. Decompose by grouping related tests (e.g., timeout tests, callback override tests, response writing tests) into separate modules or files under a tests/preamble/ directory.

As per coding guidelines: "Files must not exceed 400 lines in length. Large modules must be decomposed."

🤖 Fix all issues with AI agents
In `@tests/preamble.rs`:
- Around line 186-196: The test function server_triggers_expected_callback
returns TestResult but uses assert! and assert_eq!, so add the attribute
#[expect(clippy::panic_in_result_fn, reason = "asserts provide clearer
diagnostics in tests")] immediately above the async fn
server_triggers_expected_callback(...) signature to match the existing pattern
used in parse_valid_preamble and invalid_magic_is_error and suppress the clippy
lint while keeping the asserts.

Comment thread tests/preamble.rs Outdated
@leynos leynos force-pushed the rename-payload-to-into-payload-q2jpyh branch from ca30c55 to 2dce27f Compare February 5, 2026 12:42
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/envelope.rs (1)

187-198: ⚠️ Potential issue | 🟠 Major

Add the deprecated payload() alias for backward compatibility.

The PR objectives explicitly require a deprecated payload() alias that delegates to into_payload() to ensure downstream crates remain compatible during migration. This alias is missing.

🔧 Proposed fix: add deprecated alias after into_payload()
     #[must_use]
     pub fn into_payload(self) -> Vec<u8> { self.payload }
+
+    /// Consume the parts and return the raw payload bytes.
+    ///
+    /// # Deprecated
+    ///
+    /// Use [`into_payload`](Self::into_payload) instead.
+    #[deprecated(since = "0.2.0", note = "use `into_payload` instead")]
+    #[must_use]
+    pub fn payload(self) -> Vec<u8> { self.into_payload() }

leynos and others added 3 commits February 5, 2026 13:31
…nto_payload() consuming method

Replaced the consuming method `payload()` with a new method named `into_payload()` for `PacketParts` and `FragmentParts`. The old `payload()` method is now deprecated and forwards to `into_payload()`. All internal usages are updated to use `into_payload()` for clarity and consistency.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
- Introduces v0.1.0 to v0.2.0 migration guide detailing breaking changes
- Notes removal of deprecated payload() methods in favor of into_payload()
- Updates existing docs for minor formatting improvements
- Removes deprecated payload accessor methods from PacketParts and FragmentParts

These changes improve developer experience by documenting required migration steps and cleaning up deprecated APIs.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Refactored the `server_triggers_expected_callback` test to move the matching on expected callback inside the async block, unifying and slightly increasing the timeout durations for success and failure channels. This improves test clarity and consistency by centralizing assertion logic and using clearer timing boundaries.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos force-pushed the rename-payload-to-into-payload-q2jpyh branch from 2dce27f to efe3695 Compare February 5, 2026 13:32
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/app/envelope.rs (1)

187-198: ⚠️ Potential issue | 🟡 Minor

Add deprecated payload(self) alias to PacketParts for backward compatibility.

The PR objectives specify a deprecated payload(self) alias delegating to into_payload(), but the implementation omits this. Add the alias with an appropriate #[deprecated] attribute and messaging to support the transition period for downstream crates:

#[deprecated(since = "...", note = "use `into_payload()` instead")]
pub fn payload(self) -> Vec<u8> { self.into_payload() }

This ensures existing code continues to compile whilst guiding users toward the consuming method.

🤖 Fix all issues with AI agents
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 19-27: Add a short before/after code snippet showing the payload
accessor rename for both PacketParts and FragmentParts: demonstrate the old call
PacketParts::payload(self) / FragmentParts::payload(self) and the new call
PacketParts::into_payload(self) / FragmentParts::into_payload(self) (e.g., “//
Before ... let payload = parts.payload();” and “// After ... let payload =
parts.into_payload();”) so it matches the configuration builder example style
and appears in the same section.

In `@src/fragment/packet.rs`:
- Around line 51-52: Add a deprecated forwarding alias named payload that calls
the existing into_payload to preserve backward compatibility: in the impl for
FragmentParts (the type that defines into_payload), add a method pub fn
payload(self) -> Vec<u8> annotated with #[deprecated(...)] that simply forwards
to self.into_payload(); ensure the deprecation note explains it was renamed to
into_payload.

Comment thread docs/v0-1-0-to-v0-2-0-migration-guide.md
Comment thread src/fragment/packet.rs
Move preamble tests into grouped modules under tests/preamble/\nwith shared helpers to keep file sizes under the limit.\n\nAdd a Makefile typecheck target to match the commit gates.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Fix all issues with AI agents
In `@tests/preamble/responses.rs`:
- Around line 25-89: Add the #[expect(clippy::panic_in_result_fn, reason =
"asserts provide clearer diagnostics in tests")] attribute to both test
functions success_callback_can_write_response and
failure_callback_can_write_response so the assert_eq! usage in these
TestResult-returning tests doesn't fail CI under -D warnings; place the
attribute above each async test (above #[tokio::test]) for both functions.

In `@tests/preamble/support.rs`:
- Around line 97-148: Add Rustdoc comments for the test helper items to match
existing style: document OtherPreamble, Holder, channel_holder, take_sender_io,
recv_within, success_cb, and failure_cb with /// comments that briefly describe
each item's purpose, parameters (e.g., duration, rx, holder), return values
(e.g., (Holder, oneshot::Receiver), io::Result, TestResult, callback signature),
and any important behavior (lock poisoning handling in take_sender_io, timeout
semantics in recv_within, and that callbacks send on the oneshot). Keep comments
concise and consistent with the surrounding documented helpers
(server_with_handlers, with_running_server).

In `@tests/preamble/timeouts.rs`:
- Around line 19-129: Add the Clippy expectation attribute to both test
functions preamble_timeout_invokes_failure_handler_and_closes_connection and
preamble_timeout_allows_timely_preamble by applying
#[expect(clippy::panic_in_result_fn, reason = "test uses assertions/panics
inside a Result-returning async test; panics are intentional for test
failures")] directly above each async test declaration; this narrowly silences
the lint instead of using a global allow and keeps the reason clear.

Comment thread tests/preamble/responses.rs Outdated
Comment thread tests/preamble/support.rs
Comment thread tests/preamble/timeouts.rs Outdated
Add a before/after snippet showing the payload accessor rename\nfor PacketParts and FragmentParts in the migration guide.
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 3-4: The opening sentence "This guide summarizes the breaking
changes you need to address when migrating from wireframe v0.1.0 to v0.2.0."
uses second-person phrasing; change it to a neutral construction such as
replacing "you need to address" with "to address" or "that must be addressed" so
the sentence reads neutrally (e.g., "This guide summarizes the breaking changes
to address when migrating from wireframe v0.1.0 to v0.2.0."). Update the
sentence in the document's opening paragraph accordingly.

Comment thread docs/v0-1-0-to-v0-2-0-migration-guide.md Outdated
Address review feedback by clarifying the migration guide intro and\nkeeping payload-accessor documentation neutral.\n\nRefactor preamble tests to avoid excessive nesting and add helper\nRustdoc examples for shared test utilities.
@coderabbitai coderabbitai Bot added the codex label Feb 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 24-27: Update the migration guide wording to reflect that
PacketParts::payload(self) and FragmentParts::payload(self) are deprecated
aliases (not removed): replace "has been removed" with "has been deprecated" and
add a short note that these deprecated payload() methods still exist for
backward compatibility, forward to into_payload(self), and emit deprecation
warnings during the transition period.

In `@tests/preamble/responses.rs`:
- Around line 45-50: The test `success_callback_can_write_response` currently
calls `stream.read_exact(&mut buf).await?` without a timeout which can hang CI;
wrap the read in Tokio's `timeout(Duration::from_secs(1), ...)` like the
`failure_callback_can_write_response` test does so the read uses
`timeout(Duration::from_secs(1), stream.read_exact(&mut buf)).await??` (or
equivalent handling), keeping `with_running_server`, `TcpStream::connect`, and
`read_exact` usage but ensuring the timeout result is properly awaited and
errors propagated.

In `@tests/preamble/timeouts.rs`:
- Around line 133-135: The read on the success path currently uses
stream.read_exact(&mut buf).await without a deadline, which can hang CI; wrap
that await in a tokio timeout similar to the earlier pattern (e.g., use
tokio::time::timeout with the same Duration used at line 83) and handle the
timeout error before sending via result_tx.send((buf, failure_fired)); ensure
you reference the same buffer (buf), stream, and result_tx variables and
propagate/convert the timeout into the test error path instead of awaiting
indefinitely.
- Around line 85-96: Extract the four-branch match into a predicate helper that
returns TestResult<bool>: define a function like fn
is_connection_closed(read_res: std::io::Result<usize>) -> TestResult<bool> and
move the match there (Ok(0) -> Ok(true), Ok(n) ->
Err(io::Error::other(...)).into(), Err(e) if e.kind() == ConnectionReset ->
Ok(true), Err(e) -> Err(e.into())). In the original code replace the match on
read? with calling is_connection_closed(read?) and propagate the TestResult (use
?), keeping the timeout/stream.read(&mut eof) call unchanged; reference the
symbols stream.read, read, and the new is_connection_closed helper.

Comment thread docs/v0-1-0-to-v0-2-0-migration-guide.md
Comment thread tests/preamble/responses.rs
Comment thread tests/preamble/timeouts.rs
Comment thread tests/preamble/timeouts.rs
@leynos leynos merged commit 82fb786 into main Feb 5, 2026
6 checks passed
@leynos leynos deleted the rename-payload-to-into-payload-q2jpyh branch February 5, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Name the consuming getter into_payload

1 participant