Skip to content

Map client decode/transport failures to WireframeError (complete)#459

Merged
leynos merged 6 commits intomainfrom
map-client-decode-transport-failures-vae8sf
Feb 15, 2026
Merged

Map client decode/transport failures to WireframeError (complete)#459
leynos merged 6 commits intomainfrom
map-client-decode-transport-failures-vae8sf

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Feb 12, 2026

Summary

  • Completed end-to-end mapping of client decode and transport failures to WireframeError; client decode failures surface as WireframeError::Protocol(...) and transport failures surface as WireframeError::Io(...). This aligns client behavior with the server-side model and provides a explicit error surface for the pipeline.
  • Adds ExecPlan documentation for roadmap item 10.2.2 and marks it complete in the roadmap.
  • Updates design/docs to reflect the new error surface and migration guidance, and adds tests to validate the mappings.

Changes

  • New/updated files:
    • New: docs/execplans/10-2-2-client-decode-and-transport-failures.md
    • docs/wireframe-client-design.md (updated with error-mapping decisions)
    • docs/users-guide.md (updated with public error-handling guidance)
    • docs/roadmap.md (mark 10.2.2 as done)
    • src/client/error.rs (added ClientProtocolError, ClientWireframeError alias, and updated ClientError surface; added mapping helpers and tests)
    • src/client/messaging.rs (documented mapping; wires decode/transport mapping into WireframeError)
    • src/client/mod.rs (export new error types)
    • src/client/runtime.rs (updated doc comments to reflect new error mapping)
    • tests/client_runtime.rs (added tests for decode/transport mapping and multi-type round-trips)
    • src/client/tests/error_handling.rs (adjusted to reflect WireframeError mapping)
    • tests/features/client_runtime.feature, tests/scenarios/client_runtime_scenarios.rs, tests/fixtures/client_runtime.rs, tests/steps/client_runtime_steps.rs, tests/steps/client_lifecycle_steps.rs (updated to reflect new error semantics)
  • Dependency updates:
    • rstest-bdd and rstest-bdd-macros updated to 0.5.0 to support new behavioural tests

Rationale

  • Unifies client error semantics with the server model by routing decode failures through WireframeError::Protocol and transport failures through WireframeError::Io. This provides clearer, consistent error handling across the pipeline and simplifies migration for downstream users.
  • Keeps pre-existing error paths (serialization, preamble, correlation, etc.) explicit and unchanged, while mapping only the pipeline decode/transport errors as planned.
  • Provides concrete tests and documentation to validate the new surface and guide users through migration.

Plan of work (status: implemented)

  • Stage A: Decide and scaffold error mapping (completed)
    • Finalize client error representation for pipeline failures and encode in src/client/error.rs (decode/transport paths).
  • Stage B: Implement runtime mapping + unit coverage (completed)
    • Update src/client/messaging.rs::receive_internal() to emit WireframeError variants for decode/transport failures.
    • Extend unit tests to cover new mappings.
  • Stage C: Integration + behavioural verification (completed)
    • Add integration tests for round-trips and failure mappings; upgrade behavioural tests to rstest-bdd 0.5.0.
  • Stage D: Documentation + roadmap closure (completed)
    • Update design/docs and user docs; mark 10.2.2 as done in docs/roadmap.md.

Validation plan / gates

  • Formatting, linting, and full test gates (fmt, markdownlint, check-fmt, lint, test) as per repo standards. All gates updated in this PR are expected to pass in CI.

Artifacts and touched files (highlights)

  • docs/execplans/10-2-2-client-decode-and-transport-failures.md
  • docs/wireframe-client-design.md
  • docs/users-guide.md
  • docs/roadmap.md
  • src/client/error.rs
  • src/client/messaging.rs
  • src/client/mod.rs
  • src/client/runtime.rs
  • tests/client_runtime.rs
  • src/client/tests/error_handling.rs
  • tests/features/client_runtime.feature
  • tests/scenarios/client_runtime_scenarios.rs
  • tests/fixtures/client_runtime.rs
  • tests/steps/client_runtime_steps.rs
  • tests/steps/client_lifecycle_steps.rs
  • Cargo.toml / dependencies: rstest-bdd bumped to 0.5.0

Revision note

  • Implemented 10.2.2 end-to-end: decode/transport failures mapped to WireframeError, updated tests and docs, and added the ExecPlan documentation. Roadmap updated to reflect completion.

📎 Task: https://www.devboxer.com/task/8d8a6b50-96ec-4684-b422-39880061150c

…o WireframeError

Introduce error mapping in the client request/response pipeline such that
client decode failures are represented as WireframeError::Protocol and
transport failures as WireframeError::Io. This aligns client error semantics
with the server-side model and improves consistency.

- Update client runtime and messaging modules to emit WireframeError variants
- Add unit tests with rstest covering error mapping cases
- Add integration tests to round-trip multiple message types through the client
- Bump rstest-bdd dependencies to version 0.5.0 and extend behavioral tests
- Document design decisions and update user's guide with migration notes
- Mark roadmap item 10.2.2 as done in project docs

This change preserves existing framing and lifecycle hooks, with no breaking
API changes beyond error representation and includes comprehensive test
coverage and documentation updates.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 12, 2026

Reviewer's Guide

Implements client-side mapping of request/response decode and transport failures into WireframeError variants, updates the ClientError surface and exports, and adds tests, docs, and execplan/roadmap updates to validate and document the new behavior.

Sequence diagram for client receive pipeline error mapping to WireframeError

sequenceDiagram
    actor ClientApp
    participant WireframeClient
    participant ClientRuntime
    participant Messaging as ClientMessaging
    participant Framed as FramedTransport
    participant Serializer

    ClientApp->>WireframeClient: call(request)
    WireframeClient->>ClientRuntime: call(request)
    ClientRuntime->>ClientMessaging: receive_internal()

    alt transport_closed_before_frame
        ClientMessaging->>Framed: next()
        Framed-->>ClientMessaging: None
        ClientMessaging->>ClientError: disconnected()
        Note right of ClientError: wraps io::ErrorKind::UnexpectedEof
        ClientMessaging-->>ClientRuntime: Err(ClientError::Wireframe(WireframeError::Io(_)))
        ClientRuntime-->>WireframeClient: Err(ClientError::Wireframe(WireframeError::Io(_)))
        WireframeClient-->>ClientApp: Err(ClientError::Wireframe(WireframeError::Io(_)))
    else frame_received_but_decode_fails
        ClientMessaging->>Framed: next()
        Framed-->>ClientMessaging: Some(frame)
        ClientMessaging->>Serializer: deserialize(frame.bytes)
        Serializer-->>ClientMessaging: Err(source_error)
        ClientMessaging->>ClientError: decode(Box_dyn_Error_Send_Sync)
        Note right of ClientError: builds WireframeError::Protocol(ClientProtocolError::Deserialize(_))
        ClientMessaging-->>ClientRuntime: Err(ClientError::Wireframe(WireframeError::Protocol(ClientProtocolError::Deserialize(_))))
        ClientRuntime-->>WireframeClient: Err(ClientError::Wireframe(WireframeError::Protocol(ClientProtocolError::Deserialize(_))))
        WireframeClient-->>ClientApp: Err(ClientError::Wireframe(WireframeError::Protocol(ClientProtocolError::Deserialize(_))))
    end
Loading

Class diagram for updated client error types and WireframeError mapping

classDiagram
    class ClientProtocolError {
        <<enum>>
        +Deserialize(source: Box_dyn_Error_Send_Sync)
    }

    class WireframeError_E {
        <<generic_enum>>
        +Io(error: io_Error)
        +Protocol(error: E)
        +Codec(error: Box_dyn_Error_Send_Sync)
    }

    class ClientWireframeError {
        <<typealias>>
    }

    class ClientError {
        <<enum>>
        +Wireframe(error: ClientWireframeError)
        +Serialize(source: Box_dyn_Error_Send_Sync)
        +PreambleEncode(source: bincode_error_EncodeError)
        +PreambleDecode(source: bincode_error_DecodeError)
        +PreambleVersionMismatch(expected: u32, received: Option_u32)
        +CorrelationMismatch(expected: u64, received: Option_u64)
        +decode(source: Box_dyn_Error_Send_Sync) ClientError
        +disconnected() ClientError
    }

    class io_Error {
    }

    ClientWireframeError --> WireframeError_E : alias_of
    WireframeError_E --> ClientProtocolError : Protocol_E
    ClientError --> ClientWireframeError : uses
    ClientError ..> io_Error : From_io_Error
Loading

File-Level Changes

Change Details Files
Route client transport and decode failures through WireframeError and adjust ClientError surface.
  • Introduce ClientProtocolError and ClientWireframeError type alias and make ClientError wrap ClientWireframeError instead of raw io/deserialize/disconnected variants.
  • Add helper constructors on ClientError for decode and disconnected paths and implement Fromio::Error using WireframeError::from_io.
  • Update client messaging receive_internal to map closed-connection and deserialize failures via the new helpers and adjust runtime/messaging docs to describe WireframeError-based mapping.
  • Re-export ClientProtocolError and ClientWireframeError from the client module and crate root.
src/client/error.rs
src/client/messaging.rs
src/client/runtime.rs
src/client/mod.rs
src/lib.rs
Extend and adjust tests to cover WireframeError-based mapping and multi-type round trips.
  • Add an echo server helper and a multi-message-type round-trip test to client_runtime integration tests.
  • Add tests ensuring decode failures map to WireframeError::Protocol(ClientProtocolError::Deserialize) and transport errors (disconnect, oversize frames) map to WireframeError::Io.
  • Update existing client error-handling tests to assert WireframeError-based variants instead of direct Io/Deserialize/Disconnected values.
  • Extend BDD fixtures, steps, and scenarios to cover malformed responses and to assert Wireframe transport vs decode protocol errors.
  • Add unit tests for ClientError mapping helpers and Fromio::Error implementation.
tests/client_runtime.rs
src/client/tests/error_handling.rs
src/client/tests/messaging.rs
tests/fixtures/client_runtime.rs
tests/features/client_runtime.feature
tests/scenarios/client_runtime_scenarios.rs
tests/steps/client_runtime_steps.rs
tests/steps/client_lifecycle_steps.rs
Document the new client error mapping and complete roadmap/execplan artifacts.
  • Add an ExecPlan document for roadmap item 10.2.2 describing constraints, plan, decisions, and outcomes for mapping client decode/transport failures to WireframeError.
  • Document request/response error mapping in the wireframe client design doc, clarifying which failures use WireframeError and which remain explicit ClientError variants.
  • Update the user guide with a new section and example code showing how to match on ClientError::Wireframe(WireframeError::{Io,Protocol}).
  • Mark roadmap item 10.2.2 as complete and update rstest-bdd users guide examples to use version 0.5.0.
docs/execplans/10-2-2-client-decode-and-transport-failures.md
docs/wireframe-client-design.md
docs/users-guide.md
docs/roadmap.md
docs/rstest-bdd-users-guide.md
Upgrade behavioural test dependencies to rstest-bdd 0.5.0.
  • Bump rstest-bdd and rstest-bdd-macros dev-dependencies to 0.5.0 with strict compile-time validation enabled.
  • Refresh Cargo.lock to reflect the updated rstest-bdd dependency versions.
Cargo.toml
Cargo.lock

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 12, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Summary by CodeRabbit

  • New Features

    • Client error handling now distinguishes transport (I/O) vs protocol (decode) failures using distinct Wireframe error variants; related client error types are publicly exposed.
  • Documentation

    • Added an execplan and design guide for error mapping; updated user guide and roadmap milestone for 10.2.2; dependency docs adjusted.
  • Tests

    • Expanded integration and behavioural tests (echo, malformed-response, feature scenarios) to cover transport and decode mappings.
  • Chores

    • Dev-dependency rstest-bdd upgraded to 0.5.0.

Walkthrough

Map client transport I/O and decode failures into WireframeError variants, refactor ClientError into a unified Wireframe wrapper with ClientProtocolError::Deserialize, update client call sites and constructors and tests/BDD steps, add ExecPlan and user/docs, and bump rstest-bdd dev-dependencies to 0.5.0.

Changes

Cohort / File(s) Summary
Dependency Updates
Cargo.toml, docs/rstest-bdd-users-guide.md
Bump rstest-bdd and rstest-bdd-macros 0.4.0 → 0.5.0 and update documentation pins.
Planning & Documentation
docs/execplans/10-2-2-client-decode-and-transport-failures.md, docs/roadmap.md, docs/users-guide.md, docs/wireframe-client-design.md
Add ExecPlan and docs describing mapping of transport vs decode failures to WireframeError; mark milestone 10.2.2 complete; duplicate user-guide sections added.
Error Type Refactoring
src/client/error.rs
Introduce ClientProtocolError::Deserialize and ClientWireframeError alias; replace ClientError variants (Io, Deserialize, Disconnected) with Wireframe(#[from] ClientWireframeError); add From<io::Error>, crate helpers and unit tests.
Client Impl & Docs
src/client/messaging.rs, src/client/runtime.rs
Replace direct variant construction with ClientError::disconnected() and ClientError::decode(e); update docstrings to distinguish transport I/O vs protocol decode errors.
Public Exports
src/client/mod.rs, src/lib.rs
Re-export ClientProtocolError and ClientWireframeError publicly alongside ClientError, expanding the crate API surface.
Client Tests
src/client/tests/*, tests/client_runtime.rs
Update unit tests to assert ClientError::Wireframe(WireframeError::...); add integration tests (echo server, round-trip, malformed responses), adjust oversized-frame expectations to Io-only.
BDD Features, Fixtures & Steps
tests/features/*, tests/fixtures/client_runtime.rs, tests/steps/*, tests/scenarios/*
Rename/extend scenarios and steps to expect Wireframe transport/protocol errors; add malformed-response server fixture; add decode-error scenario and verification helpers.

Sequence Diagram(s)

sequenceDiagram
    participant Client as Client
    participant Transport as Transport
    participant Decoder as Decoder
    participant Wireframe as Wireframe
    Client->>Transport: send/receive frame
    alt Transport I/O failure
        Transport-->>Client: io::Error
        Client->>Wireframe: wrap as WireframeError::Io
        Wireframe-->>Client: ClientError::Wireframe(WireframeError::Io)
    else Frame received
        Client->>Decoder: attempt deserialize
        alt Decode failure
            Decoder-->>Client: Deserialize error
            Client->>Wireframe: wrap as WireframeError::Protocol(ClientProtocolError::Deserialize)
            Wireframe-->>Client: ClientError::Wireframe(WireframeError::Protocol(...))
        else Successful decode
            Decoder-->>Client: Parsed message
            Client->>Client: normal processing
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~65 minutes

Possibly related PRs

Poem

Transport trips and decoders sigh,
One Wireframe holds each fall and cry,
Client errors wrapped in tidy rows,
Tests and docs now show how it goes,
Celebrate the mapping — onward we fly! 🎉

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly captures the primary change: mapping client decode and transport failures to WireframeError variants, marking the feature complete.
Description check ✅ Passed The description thoroughly explains the changeset, detailing the error mapping rationale, affected files, staged plan of work, and validation strategy.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch map-client-decode-transport-failures-vae8sf

No actionable comments were generated in the recent review. 🎉


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

…iants

- Introduce ClientProtocolError and ClientWireframeError for client request/response error mapping.
- Transport failures map to WireframeError::Io within ClientError::Wireframe.
- Decode failures map to WireframeError::Protocol with ClientProtocolError::Deserialize.
- Refactor client error handling in messaging and runtime modules to use new error mapping.
- Add integration tests covering multiple message round-trips and error mappings.
- Update behavioural tests to check mapping of decode and transport errors.
- Upgrade rstest-bdd dependency to 0.5.0.
- Update client design and user guide documentation with error mapping details.
- Mark roadmap item 10.2.2 as complete.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos changed the title Plan mapping of client decode & transport failures to WireframeError Implement client decode/transport failure mapping to WireframeError Feb 12, 2026
@leynos leynos marked this pull request as ready for review February 12, 2026 09:59
sourcery-ai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Corrected multiple occurrences of British English spellings to American English
spellings (e.g., serialisation -> serialization, centralised -> centralized,
deserialisation -> deserialization) and improved consistency within the
execplans/10-2-2-client-decode-and-transport-failures.md documentation and
wireframe-client-design.md.

These are documentation spelling corrections and minor grammar fixes to enhance
clarity and standardize terminology.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos changed the title Implement client decode/transport failure mapping to WireframeError Plan and implement client decode/transport failure mapping to WireframeError Feb 12, 2026
coderabbitai[bot]

This comment was marked as resolved.

…for WireframeError variants

Correct spacing around `ClientError::Wireframe(WireframeError::Protocol(...))` variant in documentation files to improve clarity and consistency.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos changed the title Plan and implement client decode/transport failure mapping to WireframeError Map client decode/transport failures to WireframeError (complete) Feb 13, 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/execplans/10-2-2-client-decode-and-transport-failures.md`:
- Line 53: Update the sentence "a row without net progress, pause and document
the blocker." to include the Oxford comma by changing it to "a row without net
progress, pause, and document the blocker." Locate this exact phrase in
docs/execplans/10-2-2-client-decode-and-transport-failures.md and insert the
comma before "and" so the list uses the Oxford comma consistently across the
document.
- Line 124: The decision log entry "intent. Date/Author: 2026-02-12 / Codex" is
missing terminal punctuation; edit that exact string in the file and append a
period so it reads "intent. Date/Author: 2026-02-12 / Codex." to ensure the
entry ends with a full stop.
- Line 130: The decision log entry line containing the exact text "churn.
Date/Author: 2026-02-12 / Codex" is missing terminal punctuation; edit that line
(the string "churn. Date/Author: 2026-02-12 / Codex") to append a period so it
reads "churn. Date/Author: 2026-02-12 / Codex." ensuring the decision log entry
ends with a full stop.
- Line 135: The decision log entry "2026-02-12 / Codex" is missing terminal
punctuation; update that string (search for the exact text "2026-02-12 / Codex"
in the docs/execplans file and replace it with "2026-02-12 / Codex.") so it ends
with a full stop.

Comment thread docs/execplans/10-2-2-client-decode-and-transport-failures.md Outdated
Comment thread docs/execplans/10-2-2-client-decode-and-transport-failures.md Outdated
Comment thread docs/execplans/10-2-2-client-decode-and-transport-failures.md Outdated
Comment thread docs/execplans/10-2-2-client-decode-and-transport-failures.md Outdated
Corrected punctuation in author/date lines by adding periods.
Reworded iteration failure condition for clarity:
- changed 'fmt, lint, test' to 'fmt, lint, or test' for readability.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
…res docs

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos leynos merged commit 4b1eb9a into main Feb 15, 2026
6 checks passed
@leynos leynos deleted the map-client-decode-transport-failures-vae8sf branch February 15, 2026 00:14
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