Skip to content

Conversation

leynos
Copy link
Owner

@leynos leynos commented Aug 15, 2025

Summary

  • fix broken intra-doc links across app, extractor and server modules
  • expose MAX_PUSH_RATE so docs reference a public constant
  • clarify protocol hook documentation for WireframeError::Protocol

Testing

  • cargo doc --no-deps
  • make fmt
  • make lint
  • make test

https://chatgpt.com/codex/tasks/task_e_689e54048724832288ec3a7fea3daa6e

Summary by Sourcery

Fix rustdoc link warnings by updating intra-doc links, exposing MAX_PUSH_RATE, and clarifying protocol hook documentation

New Features:

  • Expose MAX_PUSH_RATE as a public constant for documentation

Enhancements:

  • Fix broken intra-doc links in app, extractor, server, session, and hooks modules
  • Clarify documentation for WireframeError::Protocol hook

Copy link
Contributor

coderabbitai bot commented Aug 15, 2025

Summary by CodeRabbit

  • New Features

    • Exposed MAX_PUSH_RATE as a public constant, allowing external reference.
  • Documentation

    • Updated multiple documentation links and references across app, extractor, hooks, server, and session modules for accuracy and consistency.
    • Clarified method and type paths in comments; no behavioural or API changes beyond the public constant exposure.

Walkthrough

Summarise documentation link/reference updates across app, extractor, hooks, server, and session modules; expose MAX_PUSH_RATE as a public constant in src/push.rs. Do not change runtime logic, control flow, or type signatures elsewhere.

Changes

Cohort / File(s) Summary
Documentation link and reference updates
src/app.rs, src/extractor.rs, src/hooks.rs, src/session.rs, src/server/config/mod.rs, src/server/error.rs, src/server/mod.rs
Update intra-doc links and type paths (e.g., crate-qualified references, Self::prune, binding paths). Do not modify code, signatures, or behaviour.
Public constant visibility change
src/push.rs
Change MAX_PUSH_RATE from private const to public pub const (value unchanged at 10_000).

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

Nudge the notes, align each link,
Let modules point where authors think.
A constant steps into the sun—
MAX_PUSH_RATE now shared by everyone.
No codepaths twist, no engines churn;
Just cleaner maps for minds to learn.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

💡 Knowledge Base configuration:

  • Jira integration is disabled

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between c9e1aa3 and 831a6fb.

📒 Files selected for processing (8)
  • src/app.rs (2 hunks)
  • src/extractor.rs (1 hunks)
  • src/hooks.rs (1 hunks)
  • src/push.rs (1 hunks)
  • src/server/config/mod.rs (1 hunks)
  • src/server/error.rs (1 hunks)
  • src/server/mod.rs (1 hunks)
  • src/session.rs (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Use precise names; boolean names should start with is/has/should
Use en-GB-oxendict spelling and grammar in comments
Function documentation must include clear examples; test documentation should omit redundant examples
Keep code files ≤ 400 lines; split long switch/dispatch logic by feature; move large test data to external files
Disallow Clippy warnings
Fix warnings emitted during tests in code rather than silencing them
Extract helper functions for long functions; adhere to separation of concerns and CQRS
Group related parameters into meaningful structs when functions have many parameters
Consider using Arc for large error returns to reduce data size
Each Rust module must begin with a module-level //! comment describing purpose and utility
Document public APIs with Rustdoc /// comments to enable cargo doc generation
Prefer immutable data; avoid unnecessary mut
Handle errors with Result instead of panicking where feasible
Avoid unsafe code unless necessary and document any usage clearly
Place function attributes after doc comments
Do not use return in single-line functions
Use predicate functions for conditional criteria with more than two branches
Do not silence lints except as a last resort
Lint suppressions must be tightly scoped and include a clear reason
Prefer #[expect(..)] over #[allow(..)] for lints
Prefer .expect() over .unwrap()
Use concat!() to combine long string literals rather than escaping newlines
Prefer single-line function bodies where appropriate (e.g., pub fn new(id: u64) -> Self { Self(id) })
Prefer semantic error enums deriving std::error::Error via thiserror for inspectable conditions

Files:

  • src/server/config/mod.rs
  • src/extractor.rs
  • src/server/mod.rs
  • src/server/error.rs
  • src/app.rs
  • src/push.rs
  • src/session.rs
  • src/hooks.rs

⚙️ CodeRabbit Configuration File

**/*.rs: * Seek to keep the cyclomatic complexity of functions no more than 12.

  • Adhere to single responsibility and CQRS

  • Place function attributes after doc comments.

  • Do not use return in single-line functions.

  • Move conditionals with >2 branches into a predicate function.

  • Avoid unsafe unless absolutely necessary.

  • Every module must begin with a //! doc comment that explains the module's purpose and utility.

  • Comments and docs must follow en-GB-oxendict (-ize / -our) spelling and grammar

  • Lints must not be silenced except as a last resort.

    • #[allow] is forbidden.
    • Only narrowly scoped #[expect(lint, reason = "...")] is allowed.
    • No lint groups, no blanket or file-wide suppression.
    • Include FIXME: with link if a fix is expected.
  • Where code is only used by specific features, it must be conditionally compiled or a conditional expectation for unused_code applied.

  • Use rstest fixtures for shared setup and to avoid repetition between tests.

  • Replace duplicated tests with #[rstest(...)] parameterised cases.

  • Prefer mockall for mocks/stubs.

  • Prefer .expect() over .unwrap()

  • Ensure that any API or behavioural changes are reflected in the documentation in docs/

  • Ensure that any completed roadmap steps are recorded in the appropriate roadmap in docs/

  • Files must not exceed 400 lines in length

    • Large modules must be decomposed
    • Long match statements or dispatch tables should be decomposed by domain and collocated with targets
    • Large blocks of inline data (e.g., test fixtures, constants or templates) must be moved to external files and inlined at compile-time or loaded at run-time.

Files:

  • src/server/config/mod.rs
  • src/extractor.rs
  • src/server/mod.rs
  • src/server/error.rs
  • src/app.rs
  • src/push.rs
  • src/session.rs
  • src/hooks.rs
{src,tests}/**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

Write unit and behavioural tests for new functionality

Files:

  • src/server/config/mod.rs
  • src/extractor.rs
  • src/server/mod.rs
  • src/server/error.rs
  • src/app.rs
  • src/push.rs
  • src/session.rs
  • src/hooks.rs
🔍 Remote MCP (Deepwiki)

Here are some concrete details to help verify the PR’s doc‐link fixes:

  1. WireframeApp::handle_connection

    • Defined in src/app.rs as a public async method on WireframeApp:
      pub async fn handle_connection<W>(&self, mut stream: W)
      where
          W: AsyncRead + AsyncWrite + Send + Unpin + ’static,
      {}
    • This matches the updated intra-doc link to WireframeApp::handle_connection.
  2. SharedState

    • Defined in src/extractor.rs as:
      #[derive(Clone)]
      pub struct SharedState<T: Send + Sync>(Arc<T>);
    • It lives at crate::extractor::SharedState and implements the extractor trait for pulling app data into handlers.
  3. WireframeError::Protocol

    • The generic enum WireframeError<E> is in src/response.rs with variants:
      pub enum WireframeError<E> {
          Io(std::io::Error),
          Protocol(E),
      }
    • Protocol(E) is exactly what the docs now link as crate::WireframeError::Protocol.
  4. MAX_PUSH_RATE

    • Originally const MAX_PUSH_RATE: usize = 10_000; in src/push.rs, now changed to pub const MAX_PUSH_RATE: usize = 10_000;.
    • It’s used to validate rates in PushQueues::bounded_with_rate_dlq and appears in error messages (PushConfigError::InvalidRate) and docs (e.g. “Rate Limiting Configuration” table).

These confirm that all updated intra-doc links point to existing, correctly-scoped items and that making MAX_PUSH_RATE public enables linking to it from docs.

⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build-test
🔇 Additional comments (9)
src/extractor.rs (1)

21-21: LGTM – fix intra-doc link to crate::app::WireframeApp

Linking to the fully qualified crate::app::WireframeApp resolves rustdoc warnings and is the correct target for the app type.

src/hooks.rs (1)

37-37: LGTM – correct link to crate::WireframeError::Protocol

Reference the variant via its fully qualified path to ensure rustdoc resolves it. The example remains accurate with the trait’s ProtocolError associated type.

src/server/config/mod.rs (1)

58-61: LGTM – use in-module link target for binding

Use [binding] within the same module scope. The link resolves to pub mod binding; and removes the redundant self:: prefix.

src/server/error.rs (1)

1-1: LGTM – qualify WireframeServer via super in module docs

Use [super::WireframeServer] to reference the type from the parent module. This is the correct path for rustdoc in this module.

src/app.rs (2)

204-204: LGTM – doc points to WireframeApp::handle_connection

Link directly to WireframeApp::handle_connection so rustdoc can cross-reference the connection entrypoint in examples and API docs.


428-429: LGTM – qualify SharedState path in docs

Reference crate::extractor::SharedState to resolve the extractor state type without relying on local imports.

src/push.rs (1)

29-29: Expose MAX_PUSH_RATE publicly to unblock intra-doc links

Make MAX_PUSH_RATE public to enable rustdoc links and external references. This aligns with the PR goal and does not affect runtime behaviour.

src/session.rs (1)

85-86: Link to associated method with Self::prune

Target Self::prune in docs to correctly reference the associated method. This resolves intra-doc link warnings as intended.

Also applies to: 95-96

src/server/mod.rs (1)

69-70: Fix intra-doc links to bind methods on WireframeServer

Reference WireframeServer::bind and WireframeServer::bind_existing_listener directly. This matches the actual API and removes the spurious binding:: path prefix.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/fix-unresolved-links-in-documentation

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

sourcery-ai bot commented Aug 15, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR resolves rustdoc link warnings by updating intra-doc references across modules (app, extractor, server, session, hooks, config) to fully qualified paths and exposes the previously private MAX_PUSH_RATE constant as a public API for documentation consistency.

Class diagram for the updated PushQueues constants

classDiagram
    class PushQueues {
    }
    class MAX_PUSH_RATE {
        <<constant>>
        +MAX_PUSH_RATE: usize
    }
    PushQueues ..> MAX_PUSH_RATE : uses
Loading

Class diagram for updated doc references in WireframeApp and MessageRequest

classDiagram
    class WireframeApp {
        +handle_connection()
        +app_data<T>(state: T) -> Self
    }
    class MessageRequest {
        +peer_addr: SocketAddr
        +state: WireframeApp
    }
    MessageRequest ..> WireframeApp : accesses state
Loading

File-Level Changes

Change Details Files
Correct intra-doc links in app module
  • Updated link for handle_connection to refer to WireframeApp::handle_connection
  • Changed SharedState link to crate::extractor::SharedState
src/app.rs
Fix documentation links in server module
  • Removed outdated binding:: prefix for WireframeServer::bind
  • Updated binding::WireframeServer::bind_existing_listener link to direct path
src/server/mod.rs
Adjust prune method links in session module
  • Replaced bare prune references with Self::prune in two doc comments
src/session.rs
Update extractor module doc link
  • Changed WireframeApp link to crate::app::WireframeApp
src/extractor.rs
Clarify WireframeError::Protocol link in hooks
  • Qualified Protocol variant link as crate::WireframeError::Protocol
src/hooks.rs
Correct binding module link in server config
  • Updated config docs to use [binding] instead of explicit path
src/server/config/mod.rs
Expose MAX_PUSH_RATE as a public constant
  • Changed MAX_PUSH_RATE from private const to pub const for doc accessibility
src/push.rs

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

Copy link
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 there - I've reviewed your changes and found some issues that need to be addressed.

Blocking issues:

  • The module does not begin with a //! comment as required by the instructions. (link)
  • The module does not begin with a //! comment as required by the instructions. (link)
  • The module does not begin with a //! comment as required by the instructions. (link)
  • The module does not begin with a //! comment as required by the instructions. (link)
  • The module does not begin with a //! comment as required by the instructions. (link)

General comments:

  • Add a changelog entry to highlight that MAX_PUSH_RATE has become part of the public API.
  • Update any example code or documentation in README or sample snippets to reference MAX_PUSH_RATE instead of hard-coded values.
  • Consider whether DEFAULT_PUSH_RATE should also be exposed or documented, or clearly mark it as an internal implementation detail.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add a changelog entry to highlight that MAX_PUSH_RATE has become part of the public API.
- Update any example code or documentation in README or sample snippets to reference MAX_PUSH_RATE instead of hard-coded values.
- Consider whether DEFAULT_PUSH_RATE should also be exposed or documented, or clearly mark it as an internal implementation detail.

## Individual Comments

### Comment 1
<location> `src/server/mod.rs:69` </location>
<code_context>
 /// [`Unbound`] (not yet bound to a TCP listener) or [`Bound`]. New
-/// servers start `Unbound` and must call [`binding::WireframeServer::bind`] or
-/// [`binding::WireframeServer::bind_existing_listener`] before running. A worker task is spawned
+/// servers start `Unbound` and must call [`WireframeServer::bind`] or
+/// [`WireframeServer::bind_existing_listener`] before running. A worker task is spawned
 /// per thread; each receives its own `WireframeApp` from the provided factory
</code_context>

<issue_to_address>
The module does not begin with a `//!` comment as required by the instructions.

Please add a `//!` module-level comment at the top of this file to describe its purpose and usage.
</issue_to_address>

### Comment 2
<location> `src/extractor.rs:21` </location>
<code_context>
 ///
 /// This type contains metadata about the current connection and provides
-/// access to application state registered with [`WireframeApp`].
+/// access to application state registered with [`crate::app::WireframeApp`].
 #[derive(Default)]
 pub struct MessageRequest {
</code_context>

<issue_to_address>
The module does not begin with a `//!` comment as required by the instructions.

Please add a `//!` module-level comment at the top of this file to describe its purpose and usage.
</issue_to_address>

### Comment 3
<location> `src/hooks.rs:37` </location>
<code_context>
     fn on_command_end(&self, _ctx: &mut ConnectionContext) {}

-    /// Called when a handler returns a [`WireframeError::Protocol`].
+    /// Called when a handler returns a [`crate::WireframeError::Protocol`].
     ///
     /// ```no_run
</code_context>

<issue_to_address>
The module does not begin with a `//!` comment as required by the instructions.

Please add a `//!` module-level comment at the top of this file to describe its purpose and usage.
</issue_to_address>

### Comment 4
<location> `src/push.rs:29` </location>
<code_context>
 const DEFAULT_PUSH_RATE: usize = 100;
 /// Highest supported rate for [`PushQueues::bounded_with_rate`].
-const MAX_PUSH_RATE: usize = 10_000;
+pub const MAX_PUSH_RATE: usize = 10_000;

 /// Priority level for outbound messages.
</code_context>

<issue_to_address>
The module does not begin with a `//!` comment as required by the instructions.

Please add a `//!` module-level comment at the top of this file to describe its purpose and usage.
</issue_to_address>

### Comment 5
<location> `src/server/config/mod.rs:60` </location>
<code_context>
     /// [`bind`](WireframeServer::bind) or
     /// [`bind_existing_listener`](WireframeServer::bind_existing_listener)
-    /// (methods provided by the [`binding`](self::binding) module) before running the server.
+    /// (methods provided by the [`binding`] module) before running the server.
     ///
     /// # Examples
</code_context>

<issue_to_address>
The module does not begin with a `//!` comment as required by the instructions.

Please add a `//!` module-level comment at the top of this file to describe its purpose and usage.
</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.

/// [`Unbound`] (not yet bound to a TCP listener) or [`Bound`]. New
/// servers start `Unbound` and must call [`binding::WireframeServer::bind`] or
/// [`binding::WireframeServer::bind_existing_listener`] before running. A worker task is spawned
/// servers start `Unbound` and must call [`WireframeServer::bind`] or
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (review_instructions): The module does not begin with a //! comment as required by the instructions.

Please add a //! module-level comment at the top of this file to describe its purpose and usage.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

///
/// This type contains metadata about the current connection and provides
/// access to application state registered with [`WireframeApp`].
/// access to application state registered with [`crate::app::WireframeApp`].
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (review_instructions): The module does not begin with a //! comment as required by the instructions.

Please add a //! module-level comment at the top of this file to describe its purpose and usage.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

fn on_command_end(&self, _ctx: &mut ConnectionContext) {}

/// Called when a handler returns a [`WireframeError::Protocol`].
/// Called when a handler returns a [`crate::WireframeError::Protocol`].
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (review_instructions): The module does not begin with a //! comment as required by the instructions.

Please add a //! module-level comment at the top of this file to describe its purpose and usage.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

const DEFAULT_PUSH_RATE: usize = 100;
/// Highest supported rate for [`PushQueues::bounded_with_rate`].
const MAX_PUSH_RATE: usize = 10_000;
pub const MAX_PUSH_RATE: usize = 10_000;
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (review_instructions): The module does not begin with a //! comment as required by the instructions.

Please add a //! module-level comment at the top of this file to describe its purpose and usage.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

/// [`bind`](WireframeServer::bind) or
/// [`bind_existing_listener`](WireframeServer::bind_existing_listener)
/// (methods provided by the [`binding`](self::binding) module) before running the server.
/// (methods provided by the [`binding`] module) before running the server.
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (review_instructions): The module does not begin with a //! comment as required by the instructions.

Please add a //! module-level comment at the top of this file to describe its purpose and usage.

Review instructions:

Path patterns: **/*.rs

Instructions:
Every module must begin with a //! comment.

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.

1 participant