Public API surface cleanup: modular exports and prelude#470
Conversation
Reviewer's GuideRefactors the crate’s public API to a minimal root plus module-scoped exports, introduces a focused wireframe::prelude for ergonomic imports, tightens test-support visibility, and rewrites docs, examples, and tests to use the new module-based paths. Class diagram for wireframe root, modules, and prelude exportsclassDiagram
class WireframeRoot {
+Result Result
+WireframeError WireframeError
+mod app
+mod app_data_store
+mod client
+mod server
+mod codec
+mod error
+mod connection
+mod correlation
+mod fragment
+mod hooks
+mod message_assembler
+mod metrics
+mod request
+mod response
+mod serializer
+mod session
+mod prelude
+mod test_helpers (cfg(any(test, feature = "test-support")))
}
class Prelude {
+ClientError
+WireframeClient
+ServerError
+WireframeServer
+Envelope
+Handler
+Middleware
+WireframeApp
+Result
+WireframeError
+Message
+Response
+BincodeSerializer
+Serializer
}
class ClientModule {
+WireframeClient
+ClientError
+ClientProtocolError
+ClientWireframeError
+SocketOptions
+ClientCodecConfig
}
class ServerModule {
+WireframeServer
+ServerError
}
class AppModule {
+WireframeApp
+Envelope
+Handler
+Middleware
}
class ResponseModule {
+Response
+FrameStream
}
class SerializerModule {
+BincodeSerializer
+Serializer
}
class HooksModule {
+ConnectionContext
+ProtocolHooks
+WireframeProtocol
}
class ConnectionModule {
+ConnectionActor
+mod test_support (cfg(all(not(loom), any(test, feature = "test-support"))))
}
WireframeRoot --> Prelude : defines
WireframeRoot --> ClientModule : mod client
WireframeRoot --> ServerModule : mod server
WireframeRoot --> AppModule : mod app
WireframeRoot --> ResponseModule : mod response
WireframeRoot --> SerializerModule : mod serializer
WireframeRoot --> HooksModule : mod hooks
WireframeRoot --> ConnectionModule : mod connection
Prelude ..> ClientModule : reexports
Prelude ..> ServerModule : reexports
Prelude ..> AppModule : reexports
Prelude ..> ResponseModule : reexports
Prelude ..> SerializerModule : reexports
Prelude ..> WireframeRoot : reexports Result, WireframeError
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
WalkthroughSummarise the crate-root API contraction: move many root re-exports into module-qualified paths (e.g., Changes
Sequence Diagram(s)(Section omitted — changes are public API reorganisation and documentation updates; no new multi-component runtime flow introduced.) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location> `src/prelude.rs:18-23` </location>
<code_context>
+pub use crate::client::{ClientError, WireframeClient};
+#[cfg(not(loom))]
+pub use crate::server::{ServerError, WireframeServer};
+pub use crate::{
+ app::{Envelope, Handler, Middleware, WireframeApp},
+ error::{Result, WireframeError},
+ message::Message,
+ response::Response,
+ serializer::{BincodeSerializer, Serializer},
+};
</code_context>
<issue_to_address>
**suggestion:** Consider whether the prelude surface should also expose commonly used request-side types to avoid asymmetry.
Right now the prelude exposes app, error, message, response, serializer, and client/server types, but not the request-side types that many handlers use (e.g. `RequestParts`, `RequestBodyStream`). That makes response types convenient to import while comparable request types require going through `request::`. If the prelude is meant as the primary entry point for common handler workflows, consider adding a minimal set of request types here, or clarifying in docs that request types are intentionally omitted from the prelude.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 78-167: The long bullet list in
docs/v0-1-0-to-v0-2-0-migration-guide.md exceeds 80 columns; reflow each mapping
bullet (for example the lines containing mappings such as
`wireframe::AppDataStore -> wireframe::app_data_store::AppDataStore`,
`wireframe::BincodeSerializer, Serializer ->
wireframe::serializer::{BincodeSerializer, Serializer}`,
`wireframe::ConnectionActor -> wireframe::connection::ConnectionActor`, etc.) so
each line is wrapped at or before 80 characters and continuation lines are
indented to align with the bullet content; ensure commas and braces stay with
the related symbols and preserve the exact symbol names and arrow mappings while
breaking long RHS lists into multiple indented lines for readability.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/prelude.rs`:
- Around line 14-19: Consolidate the repeated #[cfg(not(loom))] attributes by
placing a single #[cfg(not(loom))] on a block that re-exports all symbols; wrap
the pub use lines for ClientError, WireframeClient, RequestBodyStream,
RequestParts, ServerError and WireframeServer in one cfg block so you only have
one cfg predicate instead of three separate ones (locate the current pub use
statements in prelude.rs and move them inside a single #[cfg(not(loom))] { ... }
block).
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
…omics The crate root exports are minimized to only canonical error/result types. Detailed APIs are moved to dedicated modules such as `client`, `response`, `serializer`, `hooks`, etc. Introduced an optional `prelude` module for common ergonomic imports. Tightened visibility of test-support items to avoid exposure in production builds. Updated documentation, examples, and tests to reflect new module paths and import styles. This restructuring promotes clearer public API boundaries and progressive API discovery, improving maintainability and user experience. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Add RequestBodyStream and RequestParts exports to the prelude module under the cfg(not(loom)) condition to enhance reusability and simplify imports in dependent modules. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
Moved the #[cfg(not(loom))] conditional re-exports to the bottom and grouped them in a single use statement block to improve code readability and maintainability. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
236c7a0 to
5ee5bdc
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@docs/users-guide.md`:
- Around line 12-16: Replace the British "-ised" spelling with the Oxford
"-ized" form in the documentation line using the path identifier
`wireframe::<module>::...`: change "specialised" to "specialized" so the phrase
reads "`wireframe::<module>::...` is the default path for specialized APIs" to
conform to the en-GB-oxendict "-ize" guideline.
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 84-88: Replace the word "specialised" with the Oxford -ize
spelling "specialized" in the migration guide sentence that refers to
module-specific APIs (the line mentioning wireframe::<module>::...), leaving the
references to wireframe::Result<T>, wireframe::WireframeError and
wireframe::prelude::* unchanged; simply edit the text to read "Use
wireframe::<module>::... for specialized APIs."
---
Duplicate comments:
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 92-144: The migration guide's module mapping bullets exceed the
80-column wrap rule; reflow each mapping bullet so no line exceeds 80 columns by
breaking long RHS module lists across continued indented lines or splitting
mappings into multiple bullets; update the lines containing mappings such as the
ones for wireframe::app_data_store::AppDataStore,
wireframe::serializer::{BincodeSerializer, Serializer},
wireframe::client::{...}, wireframe::codec::{...}, wireframe::fragment::{...},
wireframe::message_assembler::{...}, wireframe::metrics::{...},
wireframe::request::{...}, wireframe::response::{FrameStream, Response} and
wireframe::session::{ConnectionId, SessionRegistry} to ensure each bullet and
any continuation line is wrapped at or below 80 columns.
…n docs Corrected the spelling of "specialised" to "specialized" in users-guide.md and v0-1-0-to-v0-2-0-migration-guide.md to maintain consistent US English spelling in the documentation. Co-authored-by: devboxerhub[bot] <devboxerhub[bot]@users.noreply.github.com>
There was a problem hiding this comment.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Duplicate comments:
In `@docs/v0-1-0-to-v0-2-0-migration-guide.md`:
- Around line 92-151: The migration-guide bullet lines map many symbols (e.g.,
wireframe::AppDataStore -> wireframe::app_data_store::AppDataStore,
wireframe::BincodeSerializer -> wireframe::serializer::{BincodeSerializer,
Serializer}, wireframe::ConnectionActor ->
wireframe::connection::ConnectionActor, etc.) and currently exceed the 80‑column
Markdown rule; reflow each bullet so no line is longer than 80 columns, breaking
after commas or the arrow (->) and indent continuation lines so they align under
the bullet content (preserve backticks and commas, and keep grouped items like
{...} together when possible), e.g., split long right-hand module lists across
multiple indented lines while keeping each logical mapping on a single bullet
using consistent indentation.
Summary
Changes
Migration & Compatibility
client::{WireframeClient, ClientError},
response::Response,
serializer::{Serializer},
};
Testing
Why this approach
Notes for reviewers
If you want, I can add a brief section with a concrete before/after code snippet in the migration guide or add a short companion entry in CHANGELOG-style notes.
◳ Generated by DevBoxer ◰
ℹ️ Tag @devboxerhub to ask questions and address PR feedback
📎 Task: https://www.devboxer.com/task/3d53a3ef-2812-486e-a08a-9e87bc3039f3
Summary by Sourcery
Refine the crate's public API to favor module-based imports, introduce a focused prelude for common types, and tighten test-only visibility while updating docs and examples to match.
Enhancements:
Documentation:
Tests: