diff --git a/CHANGELOG.md b/CHANGELOG.md index 41ed118e..13a3e0b1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. ## Unreleased +- Renamed internal module `src/app/connection.rs` to + `src/app/inbound_handler.rs` and `src/server/connection.rs` to + `src/server/connection_spawner.rs` to clarify directionality and eliminate + naming ambiguity with the public `src/connection/` module. No public API + changes. - Deprecated `SharedState::new` (since 0.2.0); construct via `inner.into()` instead. - Breaking: Marked `ServerError` as `#[non_exhaustive]`. Downstream consumers diff --git a/docs/adr-002-streaming-requests-and-shared-message-assembly.md b/docs/adr-002-streaming-requests-and-shared-message-assembly.md index b332a134..0f3522d0 100644 --- a/docs/adr-002-streaming-requests-and-shared-message-assembly.md +++ b/docs/adr-002-streaming-requests-and-shared-message-assembly.md @@ -137,7 +137,7 @@ sequenceDiagram #### Implementation decisions (2026-02-12) -- The inbound integration seam for this ADR is `src/app/connection.rs` and +- The inbound integration seam for this ADR is `src/app/inbound_handler.rs` and `src/app/frame_handling/`, not `src/connection/`, because inbound decode and dispatch already occur in the app-layer connection loop. - Message-assembly parsing, length, and continuity violations are treated as diff --git a/docs/adr-004-pluggable-protocol-codecs.md b/docs/adr-004-pluggable-protocol-codecs.md index c1be0c96..a5c0c66e 100644 --- a/docs/adr-004-pluggable-protocol-codecs.md +++ b/docs/adr-004-pluggable-protocol-codecs.md @@ -13,9 +13,9 @@ length-delimited implementation. Wireframe currently hardcodes `tokio_util::codec::LengthDelimitedCodec` with a 4-byte big-endian length prefix in the connection pipeline (notably in -`src/app/connection.rs` and `src/app/frame_handling.rs`). This makes framing -inflexible and prevents protocols with alternative framing rules (such as -Hotline, MySQL, and Redis Serialization Protocol (RESP) from reusing +`src/app/inbound_handler.rs` and `src/app/frame_handling.rs`). This makes +framing inflexible and prevents protocols with alternative framing rules (such +as Hotline, MySQL, and Redis Serialization Protocol (RESP)) from reusing Wireframe's routing, middleware, and serialization infrastructure. A pluggable framing layer is required that can: diff --git a/docs/execplans/8-2-1-message-assembler-hook-trait.md b/docs/execplans/8-2-1-message-assembler-hook-trait.md index 73dd3279..70d745d1 100644 --- a/docs/execplans/8-2-1-message-assembler-hook-trait.md +++ b/docs/execplans/8-2-1-message-assembler-hook-trait.md @@ -47,11 +47,11 @@ Success is observable when: ## Surprises & Discoveries - Observation: Streaming request primitives exist (`src/request/mod.rs` and - `src/extractor.rs`), but the inbound pipeline in `src/app/connection.rs` does - not yet invoke a message-assembly hook. This plan keeps integration scoped to - 8.2.1/8.2.2 and documents the limitation in the user guide until 8.2.5. - Evidence: `WireframeApp::handle_frame` decodes to `Envelope` and dispatches - directly to handlers after fragmentation reassembly. + `src/extractor.rs`), but the inbound pipeline in `src/app/inbound_handler.rs` + does not yet invoke a message-assembly hook. This plan keeps integration + scoped to 8.2.1/8.2.2 and documents the limitation in the user guide until + 8.2.5. Evidence: `WireframeApp::handle_frame` decodes to `Envelope` and + dispatches directly to handlers after fragmentation reassembly. ## Decision Log @@ -76,7 +76,7 @@ Not started yet. ## Context and Orientation Wireframe’s inbound path decodes frames into `Envelope` values inside -`src/app/connection.rs`, then optionally applies transport fragmentation +`src/app/inbound_handler.rs`, then optionally applies transport fragmentation reassembly via `src/app/fragmentation_state.rs` and `frame_handling::reassemble_if_needed`. Handlers receive buffered payloads through `ServiceRequest` and `PacketParts` in `src/middleware.rs`. diff --git a/docs/execplans/8-2-5-integrate-with-the-connection-actor-inbound-path.md b/docs/execplans/8-2-5-integrate-with-the-connection-actor-inbound-path.md index f582035e..5dfb77aa 100644 --- a/docs/execplans/8-2-5-integrate-with-the-connection-actor-inbound-path.md +++ b/docs/execplans/8-2-5-integrate-with-the-connection-actor-inbound-path.md @@ -62,9 +62,9 @@ completed payloads to handlers. Unit tests (`rstest`) and behavioural tests - Risk: The term "connection actor inbound path" is ambiguous because `src/connection/` is outbound-focused, while inbound routing lives in - `src/app/connection.rs`. Severity: medium Likelihood: high Mitigation: - Implement in `src/app/connection.rs` and record this naming clarification in - the design docs. + `src/app/inbound_handler.rs`. Severity: medium Likelihood: high Mitigation: + Implement in `src/app/inbound_handler.rs` and record this naming + clarification in the design docs. - Risk: Message assembly error handling may diverge from existing inbound decode-failure policy. Severity: high Likelihood: medium Mitigation: Route @@ -85,7 +85,7 @@ completed payloads to handlers. Unit tests (`rstest`) and behavioural tests - [x] (2026-02-12 00:00Z) Drafted ExecPlan for roadmap items 8.2.5 and 8.2.6. - [x] Confirmed and documented the exact inbound integration seam in - `src/app/connection.rs` and `src/app/frame_handling/`. + `src/app/inbound_handler.rs` and `src/app/frame_handling/`. - [x] Upgraded behavioural test dependencies to `rstest-bdd` v0.5.0 and restored green compilation. @@ -104,14 +104,15 @@ completed payloads to handlers. Unit tests (`rstest`) and behavioural tests ## Surprises & discoveries - Observation: `WireframeApp::with_message_assembler` is currently a stored - configuration only; inbound code in `src/app/connection.rs` does not yet call - the hook. Evidence: no `message_assembler` usage in inbound frame handling. - Impact: 8.2.5 requires runtime integration work, not only API exposure. + configuration only; inbound code in `src/app/inbound_handler.rs` does not yet + call the hook. Evidence: no `message_assembler` usage in inbound frame + handling. Impact: 8.2.5 requires runtime integration work, not only API + exposure. - Observation: `src/connection/` is centred on outbound frame delivery and does not own inbound decode/reassembly. Evidence: `src/connection/mod.rs` actor loop handles push/response streams, while inbound decode happens in - `src/app/connection.rs`. Impact: roadmap wording must be interpreted as + `src/app/inbound_handler.rs`. Impact: roadmap wording must be interpreted as inbound path in `WireframeApp` connection handling. - Observation: the workspace currently pins `rstest-bdd = "0.4.0"` in @@ -126,7 +127,7 @@ completed payloads to handlers. Unit tests (`rstest`) and behavioural tests ## Decision log -- Decision: Integrate message assembly in `src/app/connection.rs` using +- Decision: Integrate message assembly in `src/app/inbound_handler.rs` using `frame_handling` helpers, immediately after `reassemble_if_needed` and before handler lookup. Rationale: this is the existing inbound choke point and preserves ADR 0002 layer ordering. Date/Author: 2026-02-12 / Codex. @@ -147,7 +148,7 @@ completed payloads to handlers. Unit tests (`rstest`) and behavioural tests Completed. - Inbound runtime now applies message assembly after transport reassembly in - `src/app/connection.rs` via `src/app/frame_handling/assembly.rs`. + `src/app/inbound_handler.rs` via `src/app/frame_handling/assembly.rs`. - Failure handling is unified with the existing deserialization-failure policy for parse, continuity, and declared-length errors. - Unit coverage includes interleaving, ordering violations, and timeout purge @@ -164,7 +165,7 @@ Completed. ## Context and orientation -The inbound runtime pipeline in `src/app/connection.rs` is now: +The inbound runtime pipeline in `src/app/inbound_handler.rs` is now: - `decode_envelope` converts codec frames into `Envelope` values. - `frame_handling::reassemble_if_needed` applies transport-level fragment @@ -207,7 +208,7 @@ or a completed envelope for dispatch. Keep this helper small and explicitly route failures through existing deserialization failure accounting. Stage C integrates the helper into connection processing. Extend connection -state in `src/app/connection.rs` to hold optional message assembly runtime +state in `src/app/inbound_handler.rs` to hold optional message assembly runtime state, invoke the new helper after transport reassembly, and purge expired assemblies on idle read timeouts alongside existing fragmentation purging. Go/no-go: if composition order or failure policy differs from ADR 0002, stop @@ -249,7 +250,7 @@ mark roadmap entries 8.2.5 and 8.2.6 as done only after all gates pass. 3. Wire runtime state in connection handling. - - Update `src/app/connection.rs` to: + - Update `src/app/inbound_handler.rs` to: - hold optional inbound message assembly state per connection; - call assembly helper after `reassemble_if_needed` and before route lookup; @@ -259,7 +260,7 @@ mark roadmap entries 8.2.5 and 8.2.6 as done only after all gates pass. 4. Add or extend unit tests with `rstest`. - Add targeted tests in `src/app/frame_handling/tests.rs` and/or - `src/app/connection/tests.rs`: + `src/app/inbound_handler/tests.rs`: - interleaved keyed assembly dispatches only completed messages; - out-of-order continuation is rejected and does not dispatch; - timeout purge evicts stale partial state and later continuation fails as @@ -342,7 +343,7 @@ specific files introduced by this feature branch. Expected deliverables: -- inbound message assembly integration in `src/app/connection.rs` and +- inbound message assembly integration in `src/app/inbound_handler.rs` and `src/app/frame_handling/`; - `rstest` unit tests for inbound interleaving, ordering violation, timeout; - `rstest-bdd` v0.5.0 behavioural scenarios for the same behaviours; diff --git a/docs/execplans/9-1-1-instance-aware-payload-wrapper.md b/docs/execplans/9-1-1-instance-aware-payload-wrapper.md index 0b653561..16bc6480 100644 --- a/docs/execplans/9-1-1-instance-aware-payload-wrapper.md +++ b/docs/execplans/9-1-1-instance-aware-payload-wrapper.md @@ -60,15 +60,15 @@ The codec abstraction lives in `src/codec.rs` with the `FrameCodec` trait and `LengthDelimitedFrameCodec` default. The outbound send path uses `FrameCodec::wrap_payload` in two places: -- `src/app/connection.rs` in `WireframeApp::send_response` and +- `src/app/inbound_handler.rs` in `WireframeApp::send_response` and `WireframeApp::send_response_framed_with_codec`. - `src/app/frame_handling.rs` in `send_response_payload`, which feeds the `Framed` stream used by `handle_connection_result`. Inbound decoding uses `FrameCodec::frame_payload` in -`WireframeApp::decode_envelope` (`src/app/connection.rs`). Connection framing -uses `CombinedCodec` in `src/app/combined_codec.rs` to pair a codec decoder and -encoder into a `Framed` stream. +`WireframeApp::decode_envelope` (`src/app/inbound_handler.rs`). Connection +framing uses `CombinedCodec` in `src/app/combined_codec.rs` to pair a codec +decoder and encoder into a `Framed` stream. Tests and examples that implement `FrameCodec` live in: @@ -113,7 +113,7 @@ roadmap item 9.1.1 as done, then run the required Makefile gates. ## Concrete Steps 1. Inspect the existing trait and send paths to catalogue `wrap_payload` usage: - `src/codec.rs`, `src/app/connection.rs`, `src/app/frame_handling.rs`, + `src/codec.rs`, `src/app/inbound_handler.rs`, `src/app/frame_handling.rs`, `tests/frame_codec.rs`, `tests/example_codecs.rs`, and the codec examples. 2. Update the trait signature in `src/codec.rs`: @@ -131,7 +131,7 @@ roadmap item 9.1.1 as done, then run the required Makefile gates. - Extend `ResponseContext` (and any related context structs) to carry a `&F` so `send_response_payload` can use the per-connection codec instance. - - In `WireframeApp::process_stream` (`src/app/connection.rs`), create a + - In `WireframeApp::process_stream` (`src/app/inbound_handler.rs`), create a per-connection codec value (for example `let mut codec = self.codec.clone();`) and use it both to build the `CombinedCodec` and to populate the response diff --git a/docs/execplans/9-1-2-introduce-a-codec-error-taxonomy.md b/docs/execplans/9-1-2-introduce-a-codec-error-taxonomy.md index 01ea3484..7b8b0330 100644 --- a/docs/execplans/9-1-2-introduce-a-codec-error-taxonomy.md +++ b/docs/execplans/9-1-2-introduce-a-codec-error-taxonomy.md @@ -31,7 +31,7 @@ integration, and behavioural tests. - [x] (2026-01-07) Update `LengthDelimitedDecoder` to produce structured EOF errors. - [ ] Integrate `CodecErrorContext` population in connection processing. -- [ ] Add recovery policy evaluation in `src/app/connection.rs`. +- [ ] Add recovery policy evaluation in `src/app/inbound_handler.rs`. - [ ] Add structured logging with codec error fields. - [ ] Add `on_eof` hook to `ProtocolHooks`. - [x] (2026-01-07) Add codec error metrics. @@ -102,7 +102,7 @@ Codec implementation: Error handling paths: -- `src/app/connection.rs` - Connection processing and error handling +- `src/app/inbound_handler.rs` - Connection processing and error handling - `src/app/frame_handling.rs` - Frame deserialization and response forwarding - `src/hooks.rs` - Protocol hooks including error callbacks @@ -182,7 +182,7 @@ Update `LengthDelimitedDecoder` to produce structured EOF errors: Integrate the error taxonomy into connection processing: 1. Populate `CodecErrorContext` from connection state in - `src/app/connection.rs` + `src/app/inbound_handler.rs` 2. Evaluate recovery policies when codec errors occur 3. Apply recovery actions (drop frame, quarantine, disconnect) 4. Track consecutive drop count and escalate to disconnect if exceeded @@ -286,7 +286,7 @@ Update documentation: - Return appropriate `CodecError::Eof` variant - Convert to `io::Error` for trait compatibility -7. Update `src/app/connection.rs`: +7. Update `src/app/inbound_handler.rs`: - Add `CodecErrorContext` population from connection state - Add recovery policy evaluation on decode errors - Track consecutive drop count @@ -438,7 +438,7 @@ Record key evidence here once available: | `src/codec.rs` | Modify: Re-export error types | | `src/app/error.rs` | Modify: Add Codec variant | | `src/response.rs` | Modify: Add Codec variant | -| `src/app/connection.rs` | Modify: Integrate error handling | +| `src/app/inbound_handler.rs` | Modify: Integrate error handling | | `src/hooks.rs` | Modify: Add on_eof hook | | `src/metrics.rs` | Modify: Add codec error metrics | | `src/lib.rs` | Modify: Re-export types | diff --git a/docs/execplans/9-1-3-enable-zero-copy-payload-extraction-for-codecs.md b/docs/execplans/9-1-3-enable-zero-copy-payload-extraction-for-codecs.md index d7a85a7c..1068684b 100644 --- a/docs/execplans/9-1-3-enable-zero-copy-payload-extraction-for-codecs.md +++ b/docs/execplans/9-1-3-enable-zero-copy-payload-extraction-for-codecs.md @@ -160,7 +160,7 @@ The `HotlineFrameCodec::wrap_payload()` method copies: ### Primary Usage Site -The connection handling code in `src/app/connection.rs` calls +The connection handling code in `src/app/inbound_handler.rs` calls `F::frame_payload(frame)` to extract payload bytes for envelope parsing. This works with `&[u8]` and would also work with `Bytes` via `as_ref()`. diff --git a/docs/execplans/9-1-3-fragment-adapter-trait.md b/docs/execplans/9-1-3-fragment-adapter-trait.md index 011d96b3..e07fa3e3 100644 --- a/docs/execplans/9-1-3-fragment-adapter-trait.md +++ b/docs/execplans/9-1-3-fragment-adapter-trait.md @@ -189,8 +189,8 @@ Current app integration points are: - `src/app/builder/core.rs` and `src/app/builder/codec.rs`, where `default_fragmentation(...)` currently auto-enables fragmentation. -- `src/app/connection.rs`, which instantiates optional fragmentation state and - calls purge on read-timeout ticks. +- `src/app/inbound_handler.rs`, which instantiates optional fragmentation state + and calls purge on read-timeout ticks. - `src/app/frame_handling/response.rs` and `src/app/frame_handling/reassembly.rs`, which apply fragmentation and reassembly around handler processing. @@ -278,7 +278,7 @@ Go/no-go: 2. Refactor connection-facing adapter implementation: `src/app/fragmentation_state.rs`, `src/app/frame_handling/core.rs`, `src/app/frame_handling/reassembly.rs`, - `src/app/frame_handling/response.rs`, `src/app/connection.rs`. + `src/app/frame_handling/response.rs`, `src/app/inbound_handler.rs`. 3. Enforce opt-in builder behaviour: `src/app/builder_defaults.rs`, `src/app/builder/core.rs`, diff --git a/docs/execplans/9-3-1-fragment-adapter-trait.md b/docs/execplans/9-3-1-fragment-adapter-trait.md index 7afe16cb..8dc2aaf6 100644 --- a/docs/execplans/9-3-1-fragment-adapter-trait.md +++ b/docs/execplans/9-3-1-fragment-adapter-trait.md @@ -37,7 +37,7 @@ After this work: - App-level request and response handling is routed through the actor codec path so protocol hooks apply consistently. -- Duplicate codec construction in `src/app/connection.rs` is removed; the +- Duplicate codec construction in `src/app/inbound_handler.rs` is removed; the actor path owns framing. - Integration tests cover streaming responses and push traffic through the unified path. @@ -284,7 +284,7 @@ crate under `wireframe_testing/`. Two outbound frame-processing paths exist today: -**Path 1 — App router** (`src/app/connection.rs`, +**Path 1 — App router** (`src/app/inbound_handler.rs`, `src/app/frame_handling/response.rs`): - `WireframeApp::process_stream()` creates a `Framed>` @@ -315,7 +315,8 @@ Two outbound frame-processing paths exist today: - Used by standalone tests, client code, and custom protocol harnesses. **Not used by the server runtime.** -**Server runtime** (`src/server/connection.rs`, `src/server/runtime/accept.rs`): +**Server runtime** (`src/server/connection_spawner.rs`, +`src/server/runtime/accept.rs`): - `spawn_connection_task()` spawns a Tokio task per TCP connection. - The task calls `app.handle_connection_result(stream)`, which enters @@ -323,7 +324,7 @@ Two outbound frame-processing paths exist today: ### Key files -- `src/app/connection.rs` — app router's `process_stream()` and +- `src/app/inbound_handler.rs` — app router's `process_stream()` and `handle_frame()`. - `src/app/frame_handling/response.rs` — `forward_response()`, `fragment_responses()`, `send_response_payload()`. @@ -338,7 +339,7 @@ Two outbound frame-processing paths exist today: - `src/hooks.rs` — `WireframeProtocol` trait and `ProtocolHooks` struct. - `src/response.rs` — `Response` enum, `FrameStream`, `WireframeError`. - `src/codec.rs` — `FrameCodec` trait and `LengthDelimitedFrameCodec`. -- `src/server/connection.rs` — `spawn_connection_task()`. +- `src/server/connection_spawner.rs` — `spawn_connection_task()`. - `src/app/builder/core.rs` — `WireframeApp` builder. - `src/app/builder/codec.rs` — codec configuration methods. - `src/app/builder/protocol.rs` — `with_protocol()` method. @@ -560,7 +561,7 @@ All commands must exit 0. If Mermaid diagrams are edited, also run: ### Inbound/outbound split -In `src/app/connection.rs`, the current `process_stream()` method (lines +In `src/app/inbound_handler.rs`, the current `process_stream()` method (lines 235-284) performs both decode and response send in a single loop. The unified design splits this: @@ -612,7 +613,7 @@ Acceptance is complete when all of the following are true: `process_frame_with_hooks_and_metrics()` before reaching the wire. - `WireframeProtocol::before_send` fires for every outbound frame on server connections. -- Duplicate codec construction in `src/app/connection.rs` is removed. +- Duplicate codec construction in `src/app/inbound_handler.rs` is removed. - Integration tests exercise streaming responses, push traffic, multi-packet channels, and back-pressure through the unified path. - BDD scenarios covering hook consistency, streaming, push interleaving, @@ -695,14 +696,14 @@ Sketch of the driver's public surface: ### Modified files (expected) -- `src/app/connection.rs` — refactor `process_stream()` to use +- `src/app/inbound_handler.rs` — refactor `process_stream()` to use `CodecDriver`. - `src/app/frame_handling/response.rs` — simplify `forward_response()` to produce response values rather than writing directly. - `src/app/frame_handling/core.rs` — remove or simplify `ResponseContext`. - `src/app/combined_codec.rs` — no changes expected; driver reuses it. -- `src/server/connection.rs` — may need minor adjustment if the connection - task setup changes. +- `src/server/connection_spawner.rs` — may need minor adjustment if the + connection task setup changes. - `src/app/builder/protocol.rs` — wire `ProtocolHooks` into the connection driver. - `docs/asynchronous-outbound-messaging-design.md` diff --git a/docs/execplans/pluggable-protocol-codecs.md b/docs/execplans/pluggable-protocol-codecs.md index 00a6b393..ff6343bf 100644 --- a/docs/execplans/pluggable-protocol-codecs.md +++ b/docs/execplans/pluggable-protocol-codecs.md @@ -71,7 +71,7 @@ Key files: - `src/app/builder.rs` defines `WireframeApp`, its builder methods, and the `buffer_capacity` configuration currently tied to length-delimited framing. -- `src/app/connection.rs` builds `Framed` streams with +- `src/app/inbound_handler.rs` builds `Framed` streams with `LengthDelimitedCodec` and reserves buffer capacity for reads. - `src/app/frame_handling.rs` writes responses through `Framed<_, LengthDelimitedCodec>`. @@ -99,7 +99,7 @@ needed. Update documentation where new decisions are captured. ## Concrete Steps 1. Inspect existing framing usage to confirm the integration points. - Review `src/app/connection.rs`, `src/app/frame_handling.rs`, and + Review `src/app/inbound_handler.rs`, `src/app/frame_handling.rs`, and `src/app/builder.rs`. 2. Add `src/codec.rs` with: @@ -119,7 +119,7 @@ needed. Update documentation where new decisions are captured. - Add builder method `.with_codec()` and wire it through type transitions. - Decide how to handle `buffer_capacity()` (deprecate or re-map to codec). -5. Update connection handling in `src/app/connection.rs` and +5. Update connection handling in `src/app/inbound_handler.rs` and `src/app/frame_handling.rs`: - Replace `LengthDelimitedCodec` with `FrameCodec` decoder/encoder. - Parameterize `FrameHandlingContext` and `ResponseContext` over the codec @@ -131,8 +131,8 @@ needed. Update documentation where new decisions are captured. 6. Propagate the codec type parameter through server types in `src/server/mod.rs`, `src/server/runtime.rs`, and - `src/server/connection.rs`. Ensure factory bounds remain ergonomic with - default type parameters. + `src/server/connection_spawner.rs`. Ensure factory bounds remain ergonomic + with default type parameters. 7. Add examples for Hotline and MySQL codecs if included in scope. Ensure they compile with `cargo build --example hotline_codec` and diff --git a/docs/multi-packet-and-streaming-responses-design.md b/docs/multi-packet-and-streaming-responses-design.md index 03ef5a22..7d45dbe4 100644 --- a/docs/multi-packet-and-streaming-responses-design.md +++ b/docs/multi-packet-and-streaming-responses-design.md @@ -515,12 +515,12 @@ staying true to the architecture already in production use. mirrors the message attribution strategy outlined in the capability roadmap. - **Correlation provenance today.** The current implementation expects correlation to live inside the serialised `Envelope` payload. See the decode - path in `src/app/connection.rs` and the payload-carried correlation fields in - `src/app/envelope.rs`. + path in `src/app/inbound_handler.rs` and the payload-carried correlation + fields in `src/app/envelope.rs`. - **Header correlation (if that is not the intent).** The boundary for injecting header correlation is the frame-to-`Envelope` step in - `WireframeApp::decode_envelope` (`src/app/connection.rs`). That is where the - decoded frame and the deserialised `Envelope` are both available, so the + `WireframeApp::decode_envelope` (`src/app/inbound_handler.rs`). That is where + the decoded frame and the deserialised `Envelope` are both available, so the runtime can merge header correlation into `Envelope::correlation_id` (for example, “if payload correlation is `None`, inherit from the header; if both exist and differ, log and pick a precedence rule”). On the outbound path, diff --git a/docs/roadmap.md b/docs/roadmap.md index 89582963..de385954 100644 --- a/docs/roadmap.md +++ b/docs/roadmap.md @@ -392,7 +392,7 @@ integration boundaries. actor.[^outbound-design] - [x] Route app-level request and response handling through the `FramePipeline` so fragmentation and metrics apply consistently. - - [x] Remove duplicate codec construction in `src/app/connection.rs`; the + - [x] Remove duplicate codec construction in `src/app/inbound_handler.rs`; the `FramePipeline` owns outbound fragmentation. - [x] Add integration tests covering the unified pipeline (round-trip, fragmentation, sequential requests, disabled fragmentation). diff --git a/docs/users-guide.md b/docs/users-guide.md index 49e3c183..2742bc2e 100644 --- a/docs/users-guide.md +++ b/docs/users-guide.md @@ -1625,8 +1625,8 @@ call these helpers to maintain consistent telemetry.[^6][^7][^31][^20] [^3]: Implemented in `src/app/builder.rs` (lines 100-121, 347-360). [^4]: Implemented in `src/app/builder.rs` (lines 326-344). [^5]: Implemented in `src/error.rs` (lines 1-68). -[^6]: Implemented in `src/app/connection.rs` (lines 41-205). -[^7]: Implemented in `src/app/connection.rs` (lines 207-289). +[^6]: Implemented in `src/app/inbound_handler.rs` (lines 41-205). +[^7]: Implemented in `src/app/inbound_handler.rs` (lines 207-289). [^8]: Implemented in `src/app/envelope.rs` (lines 11-172). [^9]: Implemented in `src/frame/metadata.rs` (lines 1-40). [^10]: Implemented in `src/message.rs` (lines 4-41). @@ -1640,7 +1640,7 @@ call these helpers to maintain consistent telemetry.[^6][^7][^31][^20] [^18]: Implemented in `src/server/runtime.rs` (lines 90-233). [^19]: Implemented in `src/server/runtime.rs` (lines 240-333). [^20]: Implemented in `src/server/config/preamble.rs` (lines 14-135) and - `src/server/connection.rs` (lines 1-222). + `src/server/connection_spawner.rs` (lines 1-222). [^21]: Implemented in `src/server/error.rs` (lines 7-18). [^23]: Implemented in `src/push/queues/mod.rs` (lines 41-190). [^24]: Implemented in `src/push/queues/errors.rs` (lines 7-28). diff --git a/src/app/connection.rs b/src/app/inbound_handler.rs similarity index 99% rename from src/app/connection.rs rename to src/app/inbound_handler.rs index 937affb1..2952cf0e 100644 --- a/src/app/connection.rs +++ b/src/app/inbound_handler.rs @@ -1,4 +1,4 @@ -//! Connection handling and response utilities for `WireframeApp`. +//! Inbound connection handling and response utilities for `WireframeApp`. use std::{collections::HashMap, sync::Arc}; diff --git a/src/app/connection/tests.rs b/src/app/inbound_handler/tests.rs similarity index 98% rename from src/app/connection/tests.rs rename to src/app/inbound_handler/tests.rs index d1f6cb63..6221e6ce 100644 --- a/src/app/connection/tests.rs +++ b/src/app/inbound_handler/tests.rs @@ -1,4 +1,4 @@ -//! Tests for Wireframe connection handling. +//! Tests for Wireframe inbound connection handling. use bytes::{Bytes, BytesMut}; use tokio_util::codec::{Decoder, Encoder}; diff --git a/src/app/mod.rs b/src/app/mod.rs index 00c1a054..52c82009 100644 --- a/src/app/mod.rs +++ b/src/app/mod.rs @@ -12,12 +12,12 @@ mod builder; mod builder_defaults; mod codec_driver; mod combined_codec; -mod connection; mod envelope; pub mod error; pub mod fragment_utils; mod fragmentation_state; mod frame_handling; +mod inbound_handler; mod lifecycle; mod memory_budgets; mod middleware_types; diff --git a/src/server/connection.rs b/src/server/connection_spawner.rs similarity index 99% rename from src/server/connection.rs rename to src/server/connection_spawner.rs index 3c009a5b..0cc79770 100644 --- a/src/server/connection.rs +++ b/src/server/connection_spawner.rs @@ -1,4 +1,4 @@ -//! Connection handling for [`WireframeServer`]. +//! Connection task spawning for [`WireframeServer`]. use std::{io, net::SocketAddr, time::Duration}; diff --git a/src/server/mod.rs b/src/server/mod.rs index 28450bc0..90361976 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -262,7 +262,7 @@ impl ServerState for Bound {} mod config; pub use config::{binding, preamble}; -mod connection; +mod connection_spawner; pub mod error; pub use error::ServerError; mod runtime; diff --git a/src/server/runtime/accept.rs b/src/server/runtime/accept.rs index ce5b24ed..d8ec7bea 100644 --- a/src/server/runtime/accept.rs +++ b/src/server/runtime/accept.rs @@ -18,7 +18,12 @@ use crate::{ frame::FrameMetadata, preamble::Preamble, serializer::Serializer, - server::{AppFactory, PreambleFailure, PreambleHandler, connection::spawn_connection_task}, + server::{ + AppFactory, + PreambleFailure, + PreambleHandler, + connection_spawner::spawn_connection_task, + }, }; /// Abstraction for sources of incoming connections consumed by the accept loop.