Skip to content

Conversation

leynos
Copy link
Owner

@leynos leynos commented Jun 13, 2025

Summary

  • ensure WireframeServer::new clamps worker count to at least one
  • document CPU-based worker default in README and design docs
  • clean up server and extractor docs
  • provide a worker count getter
  • add basic server tests

Testing

  • cargo fmt --all -- --check
  • cargo clippy -- -D warnings
  • cargo test
  • markdownlint README.md docs/roadmap.md docs/rust-binary-router-library-design.md
  • nixie README.md docs/*.md

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

Summary by Sourcery

Ensure the server defaults to at least one worker using the standard parallelism API, remove the num_cpus crate, document the CPU-based default, add a worker_count getter, and include basic tests for server and payload behavior.

New Features:

  • Introduce worker_count() getter on WireframeServer to retrieve the configured worker count.

Bug Fixes:

  • Clamp worker count to at least one in both WireframeServer::new and the workers() builder method.

Enhancements:

  • Replace num_cpus dependency with std::thread::available_parallelism() for default worker determination.
  • Clean up and enhance documentation comments in server, extractor, and middleware modules.

Documentation:

  • Document the CPU-based default worker count in README.md and design documentation, including fallback behavior.

Tests:

  • Add server tests for default, custom, and clamped worker counts.
  • Add extractor Payload unit tests for advance and remaining methods.

Summary by CodeRabbit

  • New Features
    • Added a method to display the current number of worker tasks in the server.
  • Documentation
    • Clarified that the default number of worker tasks matches the number of CPU cores in both the README and technical documentation.
    • Simplified and updated documentation for server-related methods and middleware usage.
    • Added detailed usage examples and explanations for shared state management and middleware components.
  • Refactor
    • Improved test organisation and updated documentation examples for consistency.
  • Tests
    • Added unit tests to verify default and minimum worker count behaviour in the server.
  • Chores
    • Removed an unused dependency from the project configuration.

Copy link
Contributor

sourcery-ai bot commented Jun 13, 2025

Reviewer's Guide

This PR refactors the server’s worker-count logic to use the standard library’s CPU-core detection with a fallback and minimum enforcement, exposes a new getter, removes the num_cpus crate, updates documentation to reflect the CPU-based default and cleans up module docs, and adds unit tests covering server worker counts and payload behavior.

Sequence diagram for WireframeServer::new() worker initialization

sequenceDiagram
    participant Caller
    participant WS as WireframeServer
    participant std_thread as "std::thread"

    Caller->>+WS: new(factory)
    WS->>+std_thread: available_parallelism()
    std_thread-->>-WS: Result<NonZeroUsize, Error>
    alt Ok(non_zero_val) from available_parallelism()
        WS-->>WS: workers = non_zero_val.get()
    else Error from available_parallelism() or count is zero
        WS-->>WS: workers = 1
    end
    WS-->>Caller: WireframeServer instance
Loading

Sequence diagram for WireframeServer::workers() clamping logic

sequenceDiagram
    participant Caller
    participant WS as WireframeServer

    Caller->>+WS: workers(count)
    WS-->>WS: self.workers = count.max(1)
    WS-->>-Caller: WireframeServer instance
Loading

Updated class diagram for WireframeServer

classDiagram
  class WireframeServer~F~ {
    -factory: F
    -listener: Option~TcpListener~
    -workers: usize
    +new(factory: F) WireframeServer~F~
    +workers(count: usize) WireframeServer~F~
    +worker_count() usize
    +bind~A: ToSocketAddrs~(addr: A) Result~WireframeServer~F~, std..io..Error~
    +run() Result~(), std..io..Error~
  }
Loading

File-Level Changes

Change Details Files
Enforce and expose server worker count
  • Use std::thread::available_parallelism() with a fallback of 1
  • Clamp .workers(count) to at least one
  • Add a const fn worker_count() getter
src/server.rs
Remove external num_cpus dependency
  • Eliminate num_cpus from Cargo.toml
  • Rely on std API for CPU count
  • Update lockfile accordingly
Cargo.toml
Cargo.lock
Update and clean up documentation
  • Document CPU-based worker default in README and design docs
  • Enhance doc comments in server, extractor, and middleware modules
  • Simplify and reorganize existing module docs
README.md
docs/rust-binary-router-library-design.md
src/server.rs
src/extractor.rs
src/middleware.rs
Add basic unit tests
  • Cover default and custom worker counts in a new tests/server.rs
  • Add extractor payload tests for advance() and remaining()
tests/server.rs
src/extractor.rs

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

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Walkthrough

This update clarifies the default worker count behaviour for WireframeServer in documentation and code. It introduces a worker_count method, enforces a minimum worker count, and adds related unit tests. Several documentation comments and examples were revised for clarity, and minor code structure improvements were made without changing runtime logic.

Changes

File(s) Change Summary
README.md, docs/rust-binary-router-library-design.md Added clarifications about the default worker count in WireframeServer.
src/extractor.rs Added doc comments with examples for SharedState::new and Deref; duplicated test module for Payload methods.
src/middleware.rs Enhanced doc comments for Next::new constructor and call method with examples and clearer descriptions.
src/server.rs Replaced num_cpus with std::thread::available_parallelism() for worker count; added worker_count method; improved docs and examples; ensured minimum worker count of 1.
tests/server.rs Added unit tests for default worker count, minimum enforcement, and large values in WireframeServer.
Cargo.toml Removed num_cpus crate dependency.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant WireframeServer

    User->>WireframeServer: create new instance
    WireframeServer-->>User: instance with default worker count (CPU cores)

    User->>WireframeServer: call worker_count()
    WireframeServer-->>User: return current worker count

    User->>WireframeServer: call workers(0)
    WireframeServer-->>User: enforce minimum worker count of 1
Loading

Possibly related PRs

Suggested reviewers

  • codescene-delta-analysis

Poem

In the meadow where servers run free,
A worker for each core, as busy as can be.
With tests and docs now clear and bright,
The worker count is always right.
🐇 Hopping along, code neat and sound,
WireframeServer’s workers abound!


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 226b417 and e9222a4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml (0 hunks)
  • README.md (1 hunks)
  • docs/rust-binary-router-library-design.md (1 hunks)
  • src/extractor.rs (2 hunks)
  • src/middleware.rs (2 hunks)
  • src/server.rs (1 hunks)
  • tests/server.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (6)
  • README.md
  • src/middleware.rs
  • tests/server.rs
  • src/extractor.rs
  • src/server.rs
  • docs/rust-binary-router-library-design.md
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: coverage
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

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

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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

@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: 1

🧹 Nitpick comments (6)
src/middleware.rs (1)

24-26: new does not benefit from being const

Marking Next::new as const provides no practical gain because:

  1. The function takes a non-'static reference, so it cannot be evaluated in a const context outside of static/const initialisers.
  2. Next is only ever constructed at run-time by middleware; compile-time construction isn’t expected.

Const-qualifying this API surface may mislead users and imposes additional const-stability constraints for future changes.

-    #[must_use]
-    pub const fn new(service: &'a S) -> Self {
+    #[must_use]
+    pub fn new(service: &'a S) -> Self {

Ensure no public docs or downstream crates rely on the const capability before dropping it.

src/server.rs (1)

65-69: Consider #[inline] on the trivial getter

worker_count is a tiny accessor that will likely be called in hot paths (e.g., tests, metrics). Marking it #[inline(always)] (or at least #[inline]) lets LLVM fold it away completely.

-    #[must_use]
-    pub const fn worker_count(&self) -> usize {
+    #[inline]
+    #[must_use]
+    pub const fn worker_count(&self) -> usize {
tests/server.rs (4)

1-1: Public-API visibility check

The test imports wireframe::{app::WireframeApp, server::WireframeServer}. Double-check that the app and server modules are re-exported at the crate root (e.g. pub mod app; pub mod server;). Otherwise the integration tests will not compile when the crate is published.


4-7: Replace unwrap() with expect() for clearer diagnostics

A failing unwrap() produces a generic panic, obscuring the root cause. Adding an explanatory message tightens feedback during CI runs:

-    let server = WireframeServer::new(|| WireframeApp::new().unwrap());
+    let server = WireframeServer::new(|| WireframeApp::new().expect("WireframeApp::new failed"));

5-7: Assert the exact default, not just positivity

The constructor deterministically sets the worker count to num_cpus::get().max(1). Checking equality guards against silent regressions:

-    assert!(server.worker_count() >= 1);
+    assert_eq!(server.worker_count(), num_cpus::get().max(1));

10-13: Consider adding upper-bound / large-value tests

The new clamping focuses on the minimum, but a quick test with a large explicit value (e.g. .workers(128)) would verify that the method also honours valid counts > 1, increasing branch coverage of workers().

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6b6f8c2 and 95dc0d7.

📒 Files selected for processing (6)
  • README.md (1 hunks)
  • docs/rust-binary-router-library-design.md (1 hunks)
  • src/extractor.rs (3 hunks)
  • src/middleware.rs (1 hunks)
  • src/server.rs (1 hunks)
  • tests/server.rs (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/server.rs (1)
src/server.rs (2)
  • new (42-48)
  • worker_count (67-69)
🔇 Additional comments (4)
src/extractor.rs (1)

108-129: Unit tests relocated properly – looks good

Moving the #[cfg(test)] module out of the impl block clarifies separation between production and test code, and the tests themselves remain concise and correct.
No further action needed.

src/server.rs (1)

59-63: Good defensive clamping in workers

The explicit count.max(1) guarantees at least one worker and prevents accidental mis-configuration.

README.md (1)

43-44: Nice clarification

Explicitly stating the CPU-core default helps users reason about scalability out of the box.

docs/rust-binary-router-library-design.md (1)

672-674: Documentation is consistent with implementation

The note about defaulting worker tasks to CPU cores matches the new constructor logic and README.

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 @leynos - I've reviewed your changes and they look great!

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

### Comment 1
<location> `src/middleware.rs:31` </location>
<code_context>

     /// Call the next service with the given request.
     ///
     /// # Errors
-    ///
-    /// Asynchronously invokes the next service in the middleware chain with the given request.
</code_context>

<issue_to_address>
Remove or populate the empty `# Errors` section

The `# Errors` header is empty; please either remove it or provide relevant error information.
</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.

Copy link
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: 0

🧹 Nitpick comments (1)
tests/server.rs (1)

4-8: Avoid unwrap() to keep the test (and code) portable and panic-free

std::thread::available_parallelism() may legitimately return an error on some platforms (e.g. when /proc/cpuinfo is unavailable inside certain containers). A failing call here would panic and mask the real intention of the test.

-    let expected = std::thread::available_parallelism().unwrap().get();
+    let expected = std::thread::available_parallelism()
+        .map_or(1, |n| n.get()); // fall back to a single worker if unavailable

(This also highlights that the production constructor in src/server.rs contains the same unwrap; consider the same graceful fallback there.)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 95dc0d7 and 978d55b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml (0 hunks)
  • src/middleware.rs (1 hunks)
  • src/server.rs (1 hunks)
  • tests/server.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/middleware.rs
  • src/server.rs
🧰 Additional context used
🧬 Code Graph Analysis (1)
tests/server.rs (1)
src/server.rs (2)
  • new (46-52)
  • worker_count (72-74)
🔇 Additional comments (2)
tests/server.rs (2)

11-15: Good boundary-value test

The assertion correctly verifies that calling .workers(0) is clamped to the documented minimum of one worker. No issues spotted.


18-22: Large-value path covered – looks solid

The test nicely exercises an upper-range value and documents that the builder happily accepts it. 👍

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Caution

An unexpected error occurred while opening a pull request: Reference already exists - https://docs.github.com/rest/git/refs#create-a-reference

1 similar comment
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Caution

An unexpected error occurred while opening a pull request: Reference already exists - https://docs.github.com/rest/git/refs#create-a-reference

coderabbitai bot added a commit that referenced this pull request Jun 13, 2025
…erver`

Docstrings generation was requested by @leynos.

* #16 (comment)

The following files were modified:

* `src/extractor.rs`
* `src/middleware.rs`
* `src/server.rs`
Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Note

Generated docstrings for this pull request at #19

leynos pushed a commit that referenced this pull request Jun 13, 2025
…erver` (#19)

Docstrings generation was requested by @leynos.

* #16 (comment)

The following files were modified:

* `src/extractor.rs`
* `src/middleware.rs`
* `src/server.rs`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
leynos and others added 4 commits June 13, 2025 20:04
…erver` (#19)

Docstrings generation was requested by @leynos.

* #16 (comment)

The following files were modified:

* `src/extractor.rs`
* `src/middleware.rs`
* `src/server.rs`

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@leynos leynos force-pushed the codex/ensure-minimum-of-one-worker-in-wireframeserver branch from 226b417 to e9222a4 Compare June 13, 2025 19:05
@leynos
Copy link
Owner Author

leynos commented Jun 13, 2025

@sourcery-ai review

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 @leynos - I've reviewed your changes - here's some feedback:

  • The WireframeServer::new docs include a # Panics section that’s misleading—using map_or(1, ...) will never panic, so consider removing or updating that section.
  • In the middleware examples you refer to your_crate::{Next, Service…}, but the actual crate name is wireframe—update the examples so they compile as-is.
  • The WireframeServer::new doc block has a lot of repeated descriptive text and examples; consider consolidating duplicated sentences to keep it concise.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `WireframeServer::new` docs include a `# Panics` section that’s misleading—using `map_or(1, ...)` will never panic, so consider removing or updating that section.
- In the middleware examples you refer to `your_crate::{Next, Service…}`, but the actual crate name is `wireframe`—update the examples so they compile as-is.
- The `WireframeServer::new` doc block has a lot of repeated descriptive text and examples; consider consolidating duplicated sentences to keep it concise.

## Individual Comments

### Comment 1
<location> `src/server.rs:48` </location>
<code_context>
+    ///
+    /// The server is initialised with a default worker count equal to the number of available CPU cores, or 1 if this cannot be determined. The TCP listener is unset and must be configured with `bind` before running the server.
+    ///
+    /// # Panics
+    ///
+    /// Panics if the number of available CPUs cannot be determined and the fallback to 1 fails.
+    ///
+    /// # Examples
</code_context>

<issue_to_address>
Panic section in docs is misleading

Since `map_or` ensures a fallback to 1, this constructor cannot panic. Please update or remove the `# Panics` section accordingly.
</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.

@leynos
Copy link
Owner Author

leynos commented Jun 13, 2025

@coderabbitai Please create the following Github issues:

The WireframeServer::new docs include a # Panics section that’s misleading—using map_or(1, ...) will never panic, so consider removing or updating that section.

In the middleware examples you refer to your_crate::{Next, Service…}, but the actual crate name is wireframe—update the examples so they compile as-is.

The WireframeServer::new doc block has a lot of repeated descriptive text and examples; consider consolidating duplicated sentences to keep it concise.

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

@leynos Sure thing — I’ll open three separate GitHub issues capturing each documentation task you listed.
Below is the script I’ll run to create them and assign them to you for follow-up.


🏁 Script executed:

#!/bin/bash
set -euo pipefail

REPO="leynos/wireframe"
PR_NUMBER=16
PR_URL="https://github.com/${REPO}/pull/${PR_NUMBER}"

# Try to locate the exact comment URL; fall back to PR if not found.
COMMENT_URL=$(gh api -H "Accept: application/vnd.github+json" \
  "repos/${REPO}/issues/${PR_NUMBER}/comments" \
  --jq '[ .[] | select(.body | contains("Please create the following Github issues")) ] | first | .html_url' 2>/dev/null || echo "$PR_URL")

create_issue () {
  local title="$1"
  local body="$2"
  gh issue create -R "$REPO" -t "$title" -b "$body" -a "leynos"
}

create_issue "Docs: Remove misleading # Panics section from \`WireframeServer::new\`" \
"The documentation block for \`WireframeServer::new\` contains a **# Panics** section explaining conditions under which the function may panic.  
However, the implementation now uses \`map_or(1, …)\`, so this path can no longer panic.

Please update or remove the **# Panics** section so that the docs accurately reflect the current behaviour.

Reported by @leynos in ${COMMENT_URL}."

create_issue "Docs: Fix crate name in middleware examples" \
"Several middleware documentation examples refer to \`your_crate::{Next, Service, …}\` instead of the actual crate name \`wireframe\`, meaning the snippets won’t compile when copied verbatim.

Update the examples to use the correct crate name so they compile as-is.

Reported by @leynos in ${COMMENT_URL}."

create_issue "Docs: Consolidate duplicated text in \`WireframeServer::new\` docs" \
"The doc comment for \`WireframeServer::new\` currently contains repeated descriptive sentences and example blocks, making it overly verbose.

Consolidate or deduplicate the content to keep the documentation concise while preserving all essential information.

Reported by @leynos in ${COMMENT_URL}."

Length of output: 2036


@leynos I tried to open the three GitHub issues, but the CLI needs a GH_TOKEN (or GITHUB_TOKEN) in the environment and the sandbox I’m running in doesn’t have one, so the attempt was rejected.

How would you like to proceed?

  1. Provide a GitHub token (with repo scope) that I can use just for this run, and I’ll re-execute the script to create the issues automatically;
  2. Let me switch to Linear if that’s easier (team code “DF1”); or
  3. I can simply paste the fully-formatted issue titles/bodies here for you to copy-paste manually.

Let me know which option you prefer and I’ll take care of it right away.

@leynos
Copy link
Owner Author

leynos commented Jun 13, 2025

@coderabbitai Please try again

Copy link
Contributor

coderabbitai bot commented Jun 13, 2025

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Repository and PR details
REPO="leynos/wireframe"
PR_NUMBER=16
PR_URL="https://github.com/${REPO}/pull/${PR_NUMBER}"

# Attempt to discover a more specific comment URL that contains the request
COMMENT_URL=$(gh api -H "Accept: application/vnd.github+json" \
  "repos/${REPO}/issues/${PR_NUMBER}/comments" \
  --jq '[ .[] | select(.body | contains("Please create the following Github issues")) ] | first | .html_url' 2>/dev/null || echo "$PR_URL")

create_issue () {
  local title="$1"
  local body="$2"
  # Create the issue and assign to leynos
  gh issue create -R "$REPO" -t "$title" -b "$body" -a "leynos"
}

# 1️⃣ Remove misleading # Panics section in WireframeServer::new docs
create_issue "Docs: Remove misleading # Panics section from \`WireframeServer::new\`" \
"The documentation block for \`WireframeServer::new\` contains a **# Panics** section describing conditions under which the function may panic.  
The current implementation uses \`map_or(1, …)\`, so this path can no longer panic.

Please update or remove the **# Panics** section so that the docs accurately reflect behaviour.

Reported by @leynos in ${COMMENT_URL}."

# 2️⃣ Fix crate name in middleware examples
create_issue "Docs: Fix crate name in middleware examples" \
"Several middleware documentation examples refer to \`your_crate::{Next, Service, …}\` instead of the actual crate name \`wireframe\`.  
Update the examples to use the correct crate name so they compile when copied verbatim.

Reported by @leynos in ${COMMENT_URL}."

# 3️⃣ Consolidate duplicated text in WireframeServer::new docs
create_issue "Docs: Consolidate duplicated text in \`WireframeServer::new\` docs" \
"The doc comment for \`WireframeServer::new\` contains repeated descriptive sentences and examples, making it overly verbose.  
Consolidate or deduplicate the content to keep the documentation concise while preserving essential information.

Reported by @leynos in ${COMMENT_URL}."

Length of output: 4566


@leynos All set! 🎉
The three documentation-cleanup issues have been opened and assigned to you:

  1. Docs: Remove misleading # Panics section from WireframeServer::newDocs: Remove misleading # Panics section from WireframeServer::new #20
  2. Docs: Fix crate name in middleware examples – Docs: Fix crate name in middleware examples #21
  3. Docs: Consolidate duplicated text in WireframeServer::new docs – Docs: Consolidate duplicated text in WireframeServer::new docs #22

Let me know if anything else needs tweaking.

@leynos leynos merged commit 0639b2d into main Jun 13, 2025
2 of 3 checks passed
@leynos leynos deleted the codex/ensure-minimum-of-one-worker-in-wireframeserver branch June 13, 2025 19:45
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