Skip to content

Implement client socket communication#3

Merged
leynos merged 5 commits intomainfrom
codex/implement-comenq-cli-client-main-function
Jul 26, 2025
Merged

Implement client socket communication#3
leynos merged 5 commits intomainfrom
codex/implement-comenq-cli-client-main-function

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 25, 2025

Summary

  • implement comenq client run function
  • use it from the async main
  • handle connection and serialisation errors via ClientError
  • add behavioural tests for the client socket logic
  • document design decision for new run API
  • mark roadmap entry as done

Testing

  • make lint
  • make test
  • make markdownlint
  • make nixie

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

Summary by Sourcery

Implement asynchronous client socket communication for the comenq CLI by adding a new run API that serializes and sends comment requests over a Unix domain socket, integrates it into the async main, and surfaces errors via ClientError.

New Features:

  • Add run function to serialize CommentRequest to JSON and send it over a Unix socket
  • Convert the CLI entry point to an async Tokio main that invokes run and exits on failure

Enhancements:

  • Introduce ClientError enum to wrap connection, serialization, and write failures
  • Update design documentation to describe the run API and mark related roadmap items as completed

Documentation:

  • Document the new run API design in the client design guide and update the roadmap status

Tests:

  • Add behavioral tests with Tokio and Cucumber to validate client socket logic

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 25, 2025

Warning

Rate limit exceeded

@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 058342c and eacdf3d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (3)
  • crates/comenq/Cargo.toml (1 hunks)
  • crates/comenq/src/client.rs (1 hunks)
  • docs/comenq-design.md (7 hunks)

Summary by CodeRabbit

  • New Features

    • Introduced a client module for the CLI, enabling communication with the daemon over Unix Domain Sockets.
    • The CLI now validates repository slugs and provides clear error messages for invalid input.
    • Improved error handling and user feedback for connection and serialisation failures.
    • Added comprehensive end-to-end and edge case tests for the client’s main functionality.
  • Documentation

    • Updated design documentation to describe the new client logic and error handling.
    • Marked relevant roadmap tasks as completed.
  • Tests

    • Added new Cucumber feature tests and step definitions for client-daemon interactions, including success, connection failure, and invalid input scenarios.
  • Chores

    • Updated dependencies to include required crates for new features and testing.

Walkthrough

Update the comenq CLI client to implement an asynchronous run function that serialises and sends a comment request to a daemon via Unix socket, with robust error handling. Extend the test suite with new Cucumber scenarios and supporting step definitions. Update documentation and mark related roadmap items as complete.

Changes

File(s) Change Summary
Cargo.toml Add tempfile as a new development dependency.
crates/comenq/Cargo.toml Add thiserror as a workspace dependency.
crates/comenq/src/lib.rs Derive Clone for Args. Introduce ClientError enum. Implement async run function and supporting logic.
crates/comenq/src/main.rs Convert main to async, invoke run, add error handling and process exit logic.
crates/comenq/src/client.rs Add new client module: async run function, ClientError enum, comment request serialisation and socket communication. Includes tests.
docs/comenq-design.md Document the new run function and ClientError reporting.
docs/roadmap.md Mark Milestone 2 tasks for comenq CLI client as completed.
tests/cucumber.rs Add ClientWorld test suite and run new client main feature tests in parallel.
tests/features/client_main.feature Introduce feature scenarios for client main: successful and failed daemon communication.
tests/steps/client_main_steps.rs Add step definitions for client main Cucumber tests, including dummy daemon setup and verification steps.
tests/steps/mod.rs Add client_main_steps module and publicly re-export ClientWorld.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Main
    participant LibRun
    participant Daemon (Unix Socket)

    User->>Main: Start CLI with arguments
    Main->>LibRun: Parse args, call run(args)
    LibRun->>LibRun: Parse repo slug
    LibRun->>LibRun: Serialise CommentRequest to JSON
    LibRun->>Daemon (Unix Socket): Connect and send request
    Daemon (Unix Socket)-->>LibRun: (Acknowledge / close)
    LibRun-->>Main: Return success or ClientError
    Main-->>User: Print error if any, exit process
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Possibly related PRs

Poem

The client speaks in bytes and streams,
To daemons hiding in Unix dreams.
With errors caught and tests anew,
The roadmap ticks another few.
Async flows and sockets spun—
Hooray! The groundwork’s deftly done.
🚀

✨ 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/implement-comenq-cli-client-main-function

🪧 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 generate unit tests to generate unit tests for 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.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jul 25, 2025

Reviewer's Guide

Introduce an asynchronous run API for the comenq client that serialises CommentRequest to JSON and communicates over a Unix domain socket with structured error handling, update the CLI binary to use this API, expand behavioural tests, adjust documentation, and bump relevant dependencies.

Sequence diagram for client run function sending a comment request

sequenceDiagram
    actor User
    participant CLI as comenq CLI
    participant Run as run(args)
    participant Socket as UnixStream

    User->>CLI: Provide CLI arguments
    CLI->>Run: Call run(args)
    Run->>Run: Parse repo_slug
    Run->>Run: Create CommentRequest
    Run->>Run: Serialize CommentRequest to JSON
    Run->>Socket: Connect to Unix socket
    Run->>Socket: Write JSON payload
    Run->>Socket: Shutdown connection
    Run-->>CLI: Return success or ClientError
    CLI-->>User: Print error and exit (if error)
Loading

File-Level Changes

Change Details Files
Implement asynchronous client run API and error handling
  • Define ClientError enum for connect, serialisation, and write failures
  • Implement run(args: Args) to parse slug, serialise request, connect and write to Unix socket
  • Add parse_slug helper to split owner/repo
crates/comenq/src/lib.rs
Integrate async run into CLI binary
  • Annotate main with #[tokio::main] and make it async
  • Invoke run(args).await, print errors to stderr and exit with code 1
crates/comenq/src/main.rs
Expand behavioural tests for client socket logic
  • Add run_sends_request and run_errors_when_socket_missing tests in the lib
  • Introduce ClientWorld steps and feature for Cucumber
  • Update test runner to include client_main.feature
crates/comenq/src/lib.rs
tests/steps/client_main_steps.rs
tests/features/client_main.feature
tests/cucumber.rs
tests/steps/mod.rs
Document design decisions and update roadmap
  • Describe the new run API and error model in comenq-design.md
  • Mark relevant roadmap entries as done
docs/comenq-design.md
docs/roadmap.md
Adjust dependencies for new features
  • Add thiserror to comenq crate for error definitions
  • Add tempfile for socket tests in root Cargo.toml
Cargo.toml
crates/comenq/Cargo.toml

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
Copy Markdown

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

  • In run(), map or propagate errors from stream.shutdown() instead of ignoring them so socket closure failures aren’t silently dropped.
  • Simplify parse_slug by using split_once('/') and handling the Option directly, since invalid slug formats should have been ruled out by validation.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In run(), map or propagate errors from stream.shutdown() instead of ignoring them so socket closure failures aren’t silently dropped.
- Simplify parse_slug by using split_once('/') and handling the Option directly, since invalid slug formats should have been ruled out by validation.

## Individual Comments

### Comment 1
<location> `crates/comenq/src/lib.rs:3` </location>
<code_context>
 //! Library utilities for the `comenq` CLI.

 use clap::Parser;
+use comenq_lib::CommentRequest;
 use std::path::PathBuf;
</code_context>

<issue_to_address>
Consider moving the client logic and related tests into a separate module and simplifying slug parsing to keep the main file focused on argument parsing.

```suggestion
Consider splitting out the “client” bits (`run`, `ClientError`, `parse_slug`, and its integration‐style tests) into their own module to keep this file focused on argument parsing + validation. You can also simplify `parse_slug` by using `str::split_once` now that you already validate the format.

1. Create `src/client.rs`:

   ```rust
   use crate::Args;
   use comenq_lib::CommentRequest;
   use thiserror::Error;
   use tokio::io::AsyncWriteExt;
   use tokio::net::UnixStream;

   /// Errors when interacting with the daemon.
   #[derive(Debug, Error)]
   pub enum ClientError {
       #[error("failed to connect to daemon: {0}")]
       Connect(#[from] std::io::Error),
       #[error("failed to serialise request: {0}")]
       Serialise(#[from] serde_json::Error),
       #[error("failed to write to daemon: {0}")]
       Write(#[source] std::io::Error),
   }

   /// Send a `CommentRequest` to the daemon.
   pub async fn run(args: Args) -> Result<(), ClientError> {
       // safe unwrap: `validate_repo_slug` ensures there are always two non-empty parts
       let (owner, repo) = args.repo_slug.split_once('/').unwrap();
       let req = CommentRequest { owner: owner.to_string(), repo: repo.to_string(), pr_number: args.pr_number, body: args.comment_body };
       let payload = serde_json::to_vec(&req)?;
       let mut sock = UnixStream::connect(&args.socket).await.map_err(ClientError::Connect)?;
       sock.write_all(&payload).await.map_err(ClientError::Write)?;
       let _ = sock.shutdown().await;
       Ok(())
   }

   #[cfg(test)]
   mod client_tests {
       use super::*;
       use clap::Parser;
       use rstest::rstest;
       use tempfile::tempdir;
       use tokio::io::AsyncReadExt;
       use tokio::net::UnixListener;

       // -- move your run_sends_request and run_errors_when_socket_missing tests here --
   }
   ```

2. In `src/lib.rs` or `src/main.rs`:

   ```rust
   mod client;
   pub use client::{run, ClientError};

   use clap::Parser;
   // keep only `Args`, `validate_repo_slug`, and unit‐tests for slug parsing here
   ```

3. Simplify `validate_repo_slug` if desired, but keep as is or:

   ```rust
   fn validate_repo_slug(s: &str) -> Result<String, String> {
       if let Some((o, r)) = s.split_once('/') {
           if !o.is_empty() && !r.is_empty() {
               return Ok(s.to_string());
           }
       }
       Err("invalid repository format, use 'owner/repo'".into())
   }
   ```

This reduces nesting in your main CLI module, makes each part testable in isolation, and keeps functionality intact.
</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 crates/comenq/src/lib.rs
Copy link
Copy Markdown
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: 8

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5704251 and 9b13960.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (10)
  • Cargo.toml (1 hunks)
  • crates/comenq/Cargo.toml (1 hunks)
  • crates/comenq/src/lib.rs (3 hunks)
  • crates/comenq/src/main.rs (1 hunks)
  • docs/comenq-design.md (1 hunks)
  • docs/roadmap.md (1 hunks)
  • tests/cucumber.rs (1 hunks)
  • tests/features/client_main.feature (1 hunks)
  • tests/steps/client_main_steps.rs (1 hunks)
  • tests/steps/mod.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
Cargo.toml

📄 CodeRabbit Inference Engine (AGENTS.md)

Use explicit version ranges in Cargo.toml and keep dependencies up-to-date.

Files:

  • Cargo.toml
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Comments must use en-GB-oxendict spelling and grammar.
Function documentation must include clear examples.
Every module must begin with a module level (//!) comment explaining the module's purpose and utility.
Document public APIs using Rustdoc comments (///) so documentation can be generated with cargo doc.
Place function attributes after doc comments.
Do not use return in single-line functions.
Prefer immutable data and avoid unnecessary mut bindings.
Handle errors with the Result type instead of panicking where feasible.
Avoid unsafe code unless absolutely necessary and document any usage clearly.
Clippy warnings MUST be disallowed.
Lints must not be silenced except as a last resort.
Lint rule suppressions must be tightly scoped and include a clear reason.
Prefer expect over allow.
Prefer .expect() over .unwrap().
Use predicate functions for conditional criteria with more than two branches.
Where a function is too long, extract meaningfully named helper functions adhering to separation of concerns and CQRS.
Where a function has too many parameters, group related parameters in meaningfully named structs.
Where a function is returning a large error consider using Arc to reduce the amount of data returned.
Write unit and behavioural tests for new functionality. Run both before and after making any change.
Fix any warnings emitted during tests in the code itself rather than silencing them.

Files:

  • crates/comenq/src/main.rs
  • tests/steps/mod.rs
  • tests/cucumber.rs
  • tests/steps/client_main_steps.rs
  • crates/comenq/src/lib.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.
  • 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:

  • crates/comenq/src/main.rs
  • tests/steps/mod.rs
  • tests/cucumber.rs
  • tests/steps/client_main_steps.rs
  • crates/comenq/src/lib.rs
**/*.md

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.md: Validate Markdown files using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Markdown Mermaid diagrams using by running make nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks must be wrapped at 120 columns.
Tables and headings must not be wrapped.
Use dashes (-) for list bullets.
Documentation must use en-GB-oxendict spelling and grammar (with the exception of "license" which is to be left unchanged for community consistency).

Files:

  • docs/roadmap.md
  • docs/comenq-design.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
  • Code blocks should be wrapped to 120 columns.
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/roadmap.md
  • docs/comenq-design.md
docs/**/*.md

📄 CodeRabbit Inference Engine (AGENTS.md)

docs/**/*.md: Use the markdown files within the docs/ directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
When new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve, proactively update the relevant file(s) in the docs/ directory to reflect the latest state. Ensure the documentation remains accurate and current.

Files:

  • docs/roadmap.md
  • docs/comenq-design.md
🧬 Code Graph Analysis (2)
crates/comenq/src/main.rs (1)
crates/comenq/src/lib.rs (1)
  • run (70-90)
tests/steps/client_main_steps.rs (1)
crates/comenq/src/lib.rs (2)
  • run (70-90)
  • serde_json (140-140)
🪛 LanguageTool
docs/comenq-design.md

[uncategorized] ~341-~341: Do not mix variants of the same word (‘serialise’ and ‘serialize’) within a single text.
Context: ...network logic directly. Any failures to serialise the request or communicate with the dae...

(EN_WORD_COHERENCY)

🔇 Additional comments (5)
crates/comenq/Cargo.toml (1)

15-15: Dependency addition uses workspace pin – looks good

thiserror is pulled in via the workspace table with an explicit 1.0 range, satisfying the version-pinning guideline without duplicating the version string here.

tests/cucumber.rs (1)

3-3: LGTM!

The new ClientWorld test suite is correctly integrated into the concurrent test execution.

Also applies to: 9-11

crates/comenq/src/main.rs (1)

4-15: LGTM!

The async main function correctly delegates to the run function and handles errors appropriately by printing to stderr and exiting with status 1.

crates/comenq/src/lib.rs (1)

130-172: LGTM!

The async tests provide comprehensive coverage for both success and error scenarios, properly verifying the serialized request content and error handling.

tests/steps/client_main_steps.rs (1)

1-82: LGTM!

The Cucumber step definitions are well-implemented, providing comprehensive test coverage for both daemon-present and daemon-absent scenarios. The use of expect and unwrap in tests is appropriately justified.

Comment thread Cargo.toml Outdated
Comment thread crates/comenq/src/lib.rs Outdated
Comment thread crates/comenq/src/lib.rs Outdated
Comment thread crates/comenq/src/lib.rs Outdated
Comment thread docs/comenq-design.md Outdated
Comment thread docs/roadmap.md Outdated
Comment thread tests/features/client_main.feature
Comment thread tests/steps/mod.rs
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jul 26, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 26, 2025

✅ 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
Copy link
Copy Markdown
Owner Author

leynos commented Jul 26, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 26, 2025

✅ 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.

Copy link
Copy Markdown
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: 3

♻️ Duplicate comments (4)
Cargo.toml (1)

18-18: LGTM: Workspace dependency correctly implemented.

The tempfile dependency is properly added to both the workspace dependencies and referenced in dev-dependencies using workspace = true. This follows Rust workspace best practices for dependency management.

Also applies to: 42-42

tests/steps/mod.rs (1)

1-6: LGTM: Module declarations properly alphabetised.

The module declarations are now correctly ordered alphabetically, maintaining a deterministic and easily scannable list. The new client_main_steps module appropriately supports the client socket communication functionality.

tests/features/client_main.feature (1)

1-14: LGTM: Well-structured feature tests with appropriate tags.

The feature file correctly defines test scenarios for client socket communication with proper tags (@client_main, @happy_path, @unhappy_path) enabling selective execution. Both success and failure paths are covered appropriately.

docs/comenq-design.md (1)

342-342: Fix spelling inconsistency: use "serialize" instead of "serialise".

The past review comment about this exact spelling inconsistency remains valid. Replace "serialise" with "serialize" to maintain consistency with the document's en-GB-oxendict conventions.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 9b13960 and e6497c6.

📒 Files selected for processing (7)
  • Cargo.toml (2 hunks)
  • crates/comenq/src/client.rs (1 hunks)
  • crates/comenq/src/lib.rs (1 hunks)
  • docs/comenq-design.md (1 hunks)
  • docs/roadmap.md (1 hunks)
  • tests/features/client_main.feature (1 hunks)
  • tests/steps/mod.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
  • Code blocks should be wrapped to 120 columns.
  • Headings must not be wrapped.
  • Documents must start with a level 1 heading
  • Headings must correctly increase or decrease by no more than one level at a time
  • Use GitHub-flavoured Markdown style for footnotes and endnotes.
  • Numbered footnotes must be numbered by order of appearance in the document.

Files:

  • docs/roadmap.md
  • docs/comenq-design.md
**/*.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.
  • 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:

  • crates/comenq/src/lib.rs
  • tests/steps/mod.rs
  • crates/comenq/src/client.rs
🧬 Code Graph Analysis (1)
crates/comenq/src/lib.rs (1)
crates/comenq/src/client.rs (1)
  • run (49-69)
🔇 Additional comments (5)
docs/roadmap.md (1)

22-29: LGTM: Roadmap accurately reflects completed client implementation.

The checklist items are correctly marked as completed and accurately describe the implemented client socket communication functionality. The text is properly wrapped and follows the en-GB-oxendict spelling conventions.

crates/comenq/src/lib.rs (2)

6-8: LGTM: Clean module structure with appropriate re-exports.

The client module is properly declared and the necessary public APIs (ClientError and run) are correctly re-exported. This maintains a clean separation between argument parsing and client logic.


11-11: LGTM: Clone derivation supports async operations.

Adding Clone to the Args struct derivation is appropriate as it enables the struct to be used in async contexts and shared between functions, which aligns with the new client socket communication functionality.

crates/comenq/src/client.rs (2)

14-29: Excellent error handling design.

The ClientError enum demonstrates best practices with clear error variants, proper use of #[from] and #[source] attributes, and descriptive error messages that aid debugging.


77-137: Comprehensive test coverage with excellent practices.

The test suite covers success paths, error handling, and helper functions. Good use of temporary directories, async testing patterns, and proper error variant verification.

Comment thread crates/comenq/src/client.rs Outdated
Comment thread crates/comenq/src/client.rs
Comment thread crates/comenq/src/client.rs
@leynos leynos merged commit ea1e975 into main Jul 26, 2025
1 check passed
@leynos leynos deleted the codex/implement-comenq-cli-client-main-function branch July 26, 2025 18:23
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