Skip to content

Rename connection modules to inbound_handler and connection_spawner#472

Merged
leynos merged 3 commits intomainfrom
refactor-connection-modules-juj9qp
Feb 22, 2026
Merged

Rename connection modules to inbound_handler and connection_spawner#472
leynos merged 3 commits intomainfrom
refactor-connection-modules-juj9qp

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Feb 21, 2026

Summary

  • Rename internal modules to clarify directionality:
    • src/app/connection.rs -> src/app/inbound_handler.rs
    • src/server/connection.rs -> src/server/connection_spawner.rs
  • Update internal references accordingly. No public API changes.

Changes

  • Code
    • File moves/renames:
      • src/app/connection.rs renamed to inbound_handler.rs
      • src/server/connection.rs renamed to connection_spawner.rs
    • Module references updated across the codebase:
      • src/app/mod.rs now imports inbound_handler instead of connection
      • src/server/mod.rs now imports connection_spawner instead of connection
      • Updated imports/usages in runtime/accept.rs and related server/inbound paths
      • Tests migrated from src/app/connection/tests.rs to src/app/inbound_handler/tests.rs
  • Documentation
    • Updated docs, ADRs, and roadmap references to reflect inbound_handler and connection_spawner
    • Updated user guide and changelog references accordingly
  • Changelog
    • CHANGELOG.md Unreleased section updated with the module renames and rationale

Rationale

  • Improves clarity by explicitly distinguishing inbound vs outbound responsibilities and removes ambiguity with public src/connection module.

Public API Impact

  • None. Public API remains unchanged.

Migration/Upgrade Notes

  • Internal refactor only. If downstream code import paths relied on old internal module names, update to new paths.

Build and Test Plan

  • Run: cargo build
  • Run: cargo test
  • Tests and builds should pass after updating internal references as done in this change.

Additional Context

  • This aligns with ongoing directionality clarifications and ADR/planning work across the repository.

◳ Generated by DevBoxer


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

📎 Task: https://www.devboxer.com/task/8fed44c8-3462-4849-9cd3-95e13f1807e7

📝 Closes #460

Summary by Sourcery

Rename internal connection modules to clarify inbound handling and server connection task responsibilities, and align all references and documentation with the new names.

Enhancements:

  • Rename the app-level connection module to inbound_handler and the server connection module to connection_spawner to better reflect their roles.

Documentation:

  • Update execution plans, ADRs, roadmap, and user guide references to point to inbound_handler and connection_spawner instead of the old connection module paths.
  • Document the internal module renames and rationale in the changelog.

Tests:

  • Relocate app connection tests to match the new inbound_handler module path.

Chores:

  • Adjust server runtime imports and module wiring to use the new connection_spawner module.

Rename `src/app/connection.rs` to `src/app/inbound_handler.rs` and
`src/server/connection.rs` to `src/server/connection_spawner.rs` to
eliminate naming ambiguity with the public `src/connection/` module.

The public API is unchanged — only private (`mod`, not `pub mod`)
modules are renamed. Updated all internal imports, module-level
documentation, and 13 docs files referencing the old paths.

Closes #460

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Feb 21, 2026

Reviewer's Guide

Renames the internal app and server connection modules to inbound_handler and connection_spawner, updates all internal imports/usages and documentation to match, and records the change in the changelog without altering public APIs or runtime behavior.

Class diagram for renamed inbound_handler and connection_spawner modules

classDiagram
    namespace app {
        class WireframeApp {
            +process_stream(stream, frame_codec, serializer)
            +handle_frame(envelope, context)
            +decode_envelope(frame, frame_codec)
            +send_response(response, context)
            +send_response_framed_with_codec(response, frame_codec, context)
        }

        class inbound_handler {
        }
    }

    namespace server {
        class connection_spawner {
            +spawn_connection_task(stream, app_factory, preamble_handler, serializer, frame_metadata)
        }

        class runtime_accept_rs {
            +accept_loop(listener, app_factory, preamble_handler, serializer)
        }
    }

    class FrameCodec {
        <<interface>>
        +wrap_payload(payload)
        +frame_payload(frame)
    }

    class FramePipeline {
    }

    WireframeApp --> FrameCodec : uses
    WireframeApp --> FramePipeline : uses

    runtime_accept_rs --> connection_spawner : imports
    connection_spawner --> WireframeApp : spawns_tasks_for
    WireframeApp ..> inbound_handler : implemented_in
Loading

File-Level Changes

Change Details Files
Rename app-layer inbound connection module and update references.
  • Rename src/app/connection.rs to src/app/inbound_handler.rs, including its tests file.
  • Update app module wiring to expose inbound_handler instead of connection.
  • Adjust all documentation and exec plans that referenced src/app/connection.rs to use src/app/inbound_handler.rs, including ADRs, roadmap, and design docs.
  • Update user guide footnotes that pointed to the old connection module paths.
src/app/inbound_handler.rs
src/app/inbound_handler/tests.rs
src/app/mod.rs
docs/execplans/8-2-5-integrate-with-the-connection-actor-inbound-path.md
docs/execplans/9-3-1-fragment-adapter-trait.md
docs/execplans/8-2-1-message-assembler-hook-trait.md
docs/execplans/9-1-1-instance-aware-payload-wrapper.md
docs/execplans/9-1-2-introduce-a-codec-error-taxonomy.md
docs/execplans/pluggable-protocol-codecs.md
docs/multi-packet-and-streaming-responses-design.md
docs/execplans/9-1-3-fragment-adapter-trait.md
docs/adr-002-streaming-requests-and-shared-message-assembly.md
docs/execplans/9-1-3-enable-zero-copy-payload-extraction-for-codecs.md
docs/roadmap.md
docs/adr-004-pluggable-protocol-codecs.md
docs/users-guide.md
Rename server connection task module and update usages.
  • Rename src/server/connection.rs to src/server/connection_spawner.rs.
  • Update server module wiring to re-export connection_spawner instead of connection.
  • Change runtime accept-loop to import spawn_connection_task from connection_spawner.
  • Refresh user guide and execplan references pointing to the old server connection file.
src/server/connection_spawner.rs
src/server/mod.rs
src/server/runtime/accept.rs
docs/execplans/9-3-1-fragment-adapter-trait.md
docs/execplans/pluggable-protocol-codecs.md
docs/users-guide.md
Document the module rename in the changelog.
  • Add an Unreleased changelog entry describing the internal module renames and clarifying that no public API changes are involved.
CHANGELOG.md

Assessment against linked issues

Issue Objective Addressed Explanation
#460 Rename the inbound-focused app connection module (src/app/connection.rs) to a name that makes its inbound responsibility explicit, and update all code and documentation references accordingly.
#460 Eliminate naming ambiguity between inbound app connection handling and other connection-related modules by giving them more descriptive, directionally clear names and updating references.

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

No actionable comments were generated in the recent review. 🎉


Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced codec error handling with structured error types and recovery policies.
    • Added CodecDriver API for improved codec lifecycle management and per-connection state handling.
  • Documentation

    • Updated architecture documentation and execution plans to reflect current implementation details.

Walkthrough

Summarise the PR: rename internal modules to clarify directionality, add codec error and recovery modules and a new public CodecDriver bridging framed IO to connection actors, and update documentation and import paths across the repo. No breaking public-signature removals detected.

Changes

Cohort / File(s) Summary
Module renames & wiring
src/app/inbound_handler.rs, src/app/mod.rs, src/server/connection_spawner.rs, src/server/mod.rs, src/server/runtime/accept.rs
Replace internal connection modules with inbound_handler (app) and connection_spawner (server); update imports and spawn task reference. Minimal code changes; mostly module-path and docstring updates.
New codec & error surface
src/codec.rs, src/codec/error.rs, src/codec/recovery.rs, src/lib.rs, src/response.rs, src/app/error.rs, src/hooks.rs, src/metrics.rs
Introduce CodecError, RecoveryPolicy, CodecErrorContext, re-export types, add From<CodecError> for io::Error, add on_eof hook and inc_codec_error metric; update decoder EOF handling to emit structured errors.
New driver for codec-aware server runtime
src/app/codec_driver.rs
Add public CodecDriver<W, F, E> type with new constructor and async run method to bridge Framed<W, ConnectionCodec<F>> to ConnectionActor.
Frame/codec API changes (per-connection state)
src/codec.rs (trait updates), related call sites referenced in docs
Change FrameCodec::wrap_payload to take &self and Bytes, add Clone bound to FrameCodec; adapt LengthDelimitedFrameCodec implementation to use Bytes zero-copy.
Documentation & ADRs
CHANGELOG.md, docs/adr-002-...md, docs/adr-004-...md, docs/execplans/*, docs/execplans/pluggable-protocol-codecs.md, docs/multi-packet-and-streaming-responses-design.md, docs/roadmap.md, docs/users-guide.md
Update file-path references, narrative points, and cross-references from src/app/connection.rssrc/app/inbound_handler.rs and src/server/connection.rssrc/server/connection_spawner.rs. Align plans and ADRs with new codec, error, and per-connection-state descriptions.
Tests & module docs
src/app/inbound_handler/tests.rs
Adjust test module documentation strings to reflect inbound naming; no functional test changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

The modules shuffled, tidy and clear,
Inbound found its rightful sphere,
Codecs gained a wiser name and face,
Errors learnt to find their place,
The repo hums a steadier pace. 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and concisely describes the primary change: renaming internal modules from 'connection' to 'inbound_handler' and 'connection_spawner' to clarify directionality.
Description check ✅ Passed The description comprehensively explains the module renames, updated references, documentation changes, rationale, and confirms no public API impact, all aligned with the changeset.
Linked Issues check ✅ Passed The PR fully addresses issue #460 by renaming src/app/connection.rs to inbound_handler.rs and src/server/connection.rs to connection_spawner.rs, making inbound/outbound directionality explicit and reducing ambiguity.
Out of Scope Changes check ✅ Passed All changes are scoped to module renames, import updates, documentation corrections, and test relocations directly supporting the objective of clarifying directionality without introducing new functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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 refactor-connection-modules-juj9qp

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

@leynos leynos marked this pull request as ready for review February 21, 2026 20:32
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location> `docs/adr-004-pluggable-protocol-codecs.md:18` </location>
<code_context>
-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.

</code_context>

<issue_to_address>
**issue (typo):** Fix mismatched parentheses in the protocol list around "RESP".

The sentence currently has two opening parentheses (before "such as" and before "RESP") but only one closing parenthesis. Please either add a second closing parenthesis after `RESP))` or remove the outer "(" before "such as" so the parentheses are balanced.

```suggestion
as Hotline, MySQL, and Redis Serialization Protocol (RESP)) from reusing
```
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread docs/adr-004-pluggable-protocol-codecs.md Outdated
leynos and others added 2 commits February 22, 2026 12:36
Add missing closing parenthesis in the protocol list sentence
around "RESP" to balance the nested parenthetical.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… docs

Corrected line break formatting in docs/execplans/9-1-3-fragment-adapter-trait.md and docs/execplans/9-3-1-fragment-adapter-trait.md. These changes improve readability by removing unnecessary line splits and ensuring consistent sentence flow.

Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Feb 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 22, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos leynos merged commit 4616fb7 into main Feb 22, 2026
6 checks passed
@leynos leynos deleted the refactor-connection-modules-juj9qp branch February 22, 2026 21:57
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.

Ambiguous connection module naming causes confusion

1 participant