Skip to content

Add helpers for test configs and Octocrab#29

Merged
leynos merged 4 commits intomainfrom
sy5o6u-codex/add-test-helpers-module
Aug 1, 2025
Merged

Add helpers for test configs and Octocrab#29
leynos merged 4 commits intomainfrom
sy5o6u-codex/add-test-helpers-module

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Aug 1, 2025

Summary

  • provide reusable helper functions for creating test Config and Octocrab
  • import new module in the cucumber entrypoint
  • refactor listener and worker steps to use helpers
  • refactor daemon unit tests to use helpers

Testing

  • make test

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

Summary by Sourcery

Add reusable test helper functions for creating daemon Config and Octocrab instances and refactor existing tests to leverage them

Enhancements:

  • Introduce temp_config and octocrab_for helpers in tests/util for streamlined test setup
  • Add tests/util module and import its re-exports in the cucumber entrypoint

Tests:

  • Refactor daemon unit tests and Cucumber listener/worker steps to use the new test helpers

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 1, 2025

Reviewer's Guide

Introduce a reusable test_helpers module with temp_config and octocrab_for functions, and refactor existing daemon and Cucumber step tests to use these helpers instead of manual setup.

Class diagram for new test_helpers module and usage

classDiagram
    class test_helpers {
        +temp_config(tempdir) Config
        +octocrab_for(server) Arc<Octocrab>
    }
    class Config {
        +github_token: String
        +socket_path: PathBuf
        +queue_path: PathBuf
        +cooldown_period_seconds: u64
    }
    class Octocrab
    test_helpers ..> Config : returns
    test_helpers ..> Octocrab : returns
Loading

Class diagram for refactored daemon test setup

classDiagram
    class DaemonTest {
        +setup_run_worker(status: u16) (MockServer, Arc<Config>, Receiver, Arc<Octocrab>)
    }
    DaemonTest ..> test_helpers : uses
    DaemonTest ..> Config : uses
    DaemonTest ..> Octocrab : uses
    DaemonTest ..> MockServer : uses
    DaemonTest ..> Receiver : uses
Loading

File-Level Changes

Change Details Files
Add test_helpers module for shared test utilities
  • Create test_helpers.rs with temp_config and octocrab_for functions
  • Add util/mod.rs to export the helpers
tests/util/test_helpers.rs
tests/util/mod.rs
Refactor daemon tests to leverage test helpers
  • Include the test_helpers module via include!
  • Replace manual Config instantiation with temp_config calls
  • Replace manual Octocrab builder with octocrab_for usage
crates/comenqd/src/daemon.rs
Refactor Cucumber step definitions to use helpers
  • Replace manual Config instantiation with temp_config in worker_steps
  • Use octocrab_for instead of direct Octocrab builder in worker_steps
  • Replace manual Config instantiation with temp_config in listener_steps
tests/steps/worker_steps.rs
tests/steps/listener_steps.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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 1, 2025

Summary by CodeRabbit

  • Refactor

    • Simplified and unified test setup by introducing shared utility functions for configuration and client creation across multiple test files.
    • Reorganised test modules and imports for improved clarity and maintainability.
    • Reduced code duplication in test configuration.
  • Chores

    • Added new test utility modules and re-exports to centralise common test helpers.
    • Updated development dependencies to include required crates for testing.

Walkthrough

Refactor test code across several modules to replace manual configuration and Octocrab client setup with shared utility functions. Introduce new helper functions in the test-support crate and re-export them for use in tests. Update dependency declarations to support these utilities. No changes to production logic or exported entities outside test support.

Changes

Cohort / File(s) Change Summary
Daemon Test Refactor
crates/comenqd/src/daemon.rs
Refactor tests to use shared helpers (temp_config, octocrab_for) for config and client setup; remove trailing blank lines.
Cucumber Test Module Reordering
tests/cucumber.rs
Reorder module declarations by moving mod util; after mod support; without other changes.
Listener Steps Refactor
tests/steps/listener_steps.rs
Replace manual Config construction with temp_config helper function.
Worker Steps Refactor
tests/steps/worker_steps.rs
Use temp_config and octocrab_for helpers for config/client setup; remove direct Octocrab import.
Test Utility Module Addition
tests/util/mod.rs
Add new module re-exporting octocrab_for and temp_config from test_support.
Tempfile Dependency Addition
Cargo.toml
Add tempfile crate as a dev-dependency and workspace dependency.
Test-Support Crate Dependencies Update
test-support/Cargo.toml
Add dependencies: comenqd (local path), octocrab, tempfile, and wiremock (version 0.6).
Test-Support Daemon Helpers
test-support/src/daemon.rs
Add temp_config and octocrab_for helper functions for test setup with temporary directories and mock server.
Test-Support Crate Re-exports
test-support/src/lib.rs
Add daemon module and re-export octocrab_for and temp_config at crate root level.

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Case
    participant Util as util/temp_config, octocrab_for
    participant MockServer as MockServer

    Test->>Util: Call temp_config(tmp_dir)
    Util-->>Test: Return Config instance

    Test->>MockServer: Start mock server
    MockServer-->>Test: Provide URI

    Test->>Util: Call octocrab_for(mock_server)
    Util-->>Test: Return Octocrab client

    Test->>Test: Proceed with test logic using helpers
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

Refactor the tests, let helpers arise,
No more repeated code under the skies.
With temp configs and Octocrab in tow,
The tests now sparkle, swift as they go.
🍃 Code is cleaner, review is light—
Celebrate helpers, shining bright!

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sy5o6u-codex/add-test-helpers-module

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

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 and they look great!


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

leynos commented Aug 1, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 1, 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 Aug 1, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 1, 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: 2

🔭 Outside diff range comments (1)
tests/steps/worker_steps.rs (1)

1-5: Remove forbidden #![allow] block and add mandatory module-level docs

The coding guidelines ban #[allow]. Replace each suppression with a narrowly-scoped #[expect(..., reason = "...")] and prepend a //! module doc comment that explains this test module’s intent.

-#![allow(
-    clippy::expect_used,
-    clippy::unwrap_used,
-    reason = "simplify test output"
-)]
+//! Cucumber steps exercising the worker daemon.  
+//!  
+//! The test harness intentionally uses `.expect()` / `.unwrap()` for brevity.  
+#![expect(clippy::expect_used, reason = "Allowed in test code")]
+#![expect(clippy::unwrap_used, reason = "Allowed in test code")]
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ec8f010 and f8fd5a8.

📒 Files selected for processing (6)
  • crates/comenqd/src/daemon.rs (5 hunks)
  • tests/cucumber.rs (1 hunks)
  • tests/steps/listener_steps.rs (2 hunks)
  • tests/steps/worker_steps.rs (3 hunks)
  • tests/util/mod.rs (1 hunks)
  • tests/util/test_helpers.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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:

  • tests/cucumber.rs
  • tests/util/mod.rs
  • tests/steps/worker_steps.rs
  • tests/util/test_helpers.rs
  • tests/steps/listener_steps.rs
  • crates/comenqd/src/daemon.rs
🧬 Code Graph Analysis (4)
tests/util/mod.rs (1)
tests/util/test_helpers.rs (2)
  • octocrab_for (32-41)
  • temp_config (19-26)
tests/steps/worker_steps.rs (1)
tests/util/test_helpers.rs (2)
  • octocrab_for (32-41)
  • temp_config (19-26)
tests/steps/listener_steps.rs (1)
tests/util/test_helpers.rs (1)
  • temp_config (19-26)
crates/comenqd/src/daemon.rs (1)
tests/util/test_helpers.rs (2)
  • octocrab_for (32-41)
  • temp_config (19-26)
🔇 Additional comments (8)
tests/util/test_helpers.rs (1)

1-42: LGTM! Well-structured test helper module.

The implementation follows Rust coding guidelines excellently:

  • Proper module documentation with //!
  • Justified use of #[expect(clippy::expect_used)] for test context
  • Clear function documentation
  • Appropriate use of .expect() over .unwrap() with descriptive messages
  • Functions serve their single responsibility well

The helper functions will effectively centralise test setup and reduce duplication across the test suite.

tests/cucumber.rs (1)

3-3: LGTM! Proper module integration.

The addition of mod util; correctly integrates the new test utility module into the cucumber test framework.

tests/util/mod.rs (1)

1-6: LGTM! Clean module organisation.

The module structure is well-organised with:

  • Proper documentation following the //! requirement
  • Clear re-exports of the helper functions
  • Simple and effective module layout
tests/steps/listener_steps.rs (2)

15-15: LGTM! Proper import of test utilities.

The import correctly brings in the temp_config helper function from the centralised utilities module.


40-40: LGTM! Effective use of helper function.

The replacement of manual Config construction with temp_config(&dir) successfully centralises test setup logic whilst maintaining the same behaviour. This improves maintainability and reduces duplication.

crates/comenqd/src/daemon.rs (1)

268-268: LGTM! Correct usage of helper functions with struct updates.

The helper function usage is implemented correctly:

  • Proper use of struct update syntax to override specific fields whilst using helper defaults
  • octocrab_for(&server) correctly creates the mock client
  • All existing test behaviour is preserved

The refactoring successfully reduces duplication and centralises configuration setup.

Also applies to: 289-289, 309-309, 368-368

tests/steps/worker_steps.rs (2)

10-10: Good replacement of repetitive boiler-plate

Importing temp_config and octocrab_for centralises test setup and removes duplicated code.


84-85: Arc-wrapped helper simplifies client creation

Swapping the in-place builder for octocrab_for keeps the step concise and consistent with other tests.

Comment thread crates/comenqd/src/daemon.rs Outdated
Comment thread tests/steps/worker_steps.rs Outdated
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: 1

🔭 Outside diff range comments (1)
Cargo.toml (1)

20-20: Use caret requirements for dependency versions.

The coding guidelines mandate caret requirements for all dependencies. Change tempfile = "3.10" to tempfile = "^3.10" in both locations.

Apply this diff:

-tempfile = "3.10" # latest 3.x at time of writing; update as new patch versions release
+tempfile = "^3.10" # latest 3.x at time of writing; update as new patch versions release

And in workspace dependencies:

-tempfile = "3.10"
+tempfile = "^3.10"

Also applies to: 51-51

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between f8fd5a8 and b7eeb2b.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • Cargo.toml (1 hunks)
  • crates/comenqd/src/daemon.rs (5 hunks)
  • test-support/Cargo.toml (1 hunks)
  • test-support/src/daemon.rs (1 hunks)
  • test-support/src/lib.rs (1 hunks)
  • tests/steps/worker_steps.rs (3 hunks)
  • tests/util/mod.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
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.
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.
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.
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.
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 concat!() to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums. Derive std::error::Error (via the thiserror crate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary. Use eyre::Report for human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library. Convert to domain enums at API boundaries, and to eyre only in the main main() entrypoint or top-level async task.

Files:

  • tests/util/mod.rs
  • tests/steps/worker_steps.rs
  • test-support/src/lib.rs
  • crates/comenqd/src/daemon.rs
  • test-support/src/daemon.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:

  • tests/util/mod.rs
  • tests/steps/worker_steps.rs
  • test-support/src/lib.rs
  • crates/comenqd/src/daemon.rs
  • test-support/src/daemon.rs
Cargo.toml

📄 CodeRabbit Inference Engine (AGENTS.md)

Cargo.toml: Use explicit version ranges in Cargo.toml and keep dependencies up-to-date.
Mandate caret requirements for all dependencies: All crate versions specified in Cargo.toml must use SemVer-compatible caret requirements (e.g., some-crate = "1.2.3").
Prohibit unstable version specifiers: The use of wildcard (*) or open-ended inequality (>=) version requirements is strictly forbidden as they introduce unacceptable risk and unpredictability. Tilde requirements (~) should only be used where a dependency must be locked to patch-level updates for a specific, documented reason.

Files:

  • Cargo.toml
🧬 Code Graph Analysis (4)
tests/util/mod.rs (1)
test-support/src/daemon.rs (2)
  • octocrab_for (31-40)
  • temp_config (18-25)
tests/steps/worker_steps.rs (1)
test-support/src/daemon.rs (2)
  • octocrab_for (31-40)
  • temp_config (18-25)
test-support/src/lib.rs (1)
test-support/src/daemon.rs (2)
  • octocrab_for (31-40)
  • temp_config (18-25)
crates/comenqd/src/daemon.rs (2)
test-support/src/daemon.rs (2)
  • octocrab_for (31-40)
  • temp_config (18-25)
test-support/src/util.rs (1)
  • wait_for_file (22-30)
🔇 Additional comments (12)
tests/util/mod.rs (1)

1-3: LGTM! Clean utility module design.

The module provides a clear abstraction layer for test helpers with proper documentation and clean re-exports.

test-support/src/lib.rs (1)

3-3: LGTM! Proper module organisation.

The daemon module addition and re-exports follow Rust conventions and maintain clean crate-level API.

Also applies to: 6-6

crates/comenqd/src/daemon.rs (3)

249-249: Excellent refactoring to use proper imports.

This addresses the previous review concern about using include! by properly importing shared test utilities through the module system.


259-262: LGTM! Clean use of shared test utilities.

The refactoring successfully eliminates code duplication by using temp_config and octocrab_for helpers, improving maintainability whilst preserving the ability to customise configuration as needed.

Also applies to: 281-281


301-301: Excellent use of struct update syntax with helpers.

Using ..temp_config(&dir) allows customising specific fields whilst leveraging the shared helper for sensible defaults. This pattern strikes the right balance between code reuse and test-specific requirements.

Also applies to: 360-360

tests/steps/worker_steps.rs (3)

10-10: Import change looks good.

The import of helper functions from the new util module properly consolidates test setup utilities.


39-41: Excellent resolution of the field override issue.

This refactoring successfully addresses the previous review concern by using the helper function and then explicitly modifying the field, making the override clear and intentional rather than hidden in struct syntax.


83-83: Clean replacement with helper function.

The octocrab creation is now properly delegated to the centralised helper, improving consistency across tests.

test-support/src/daemon.rs (4)

1-5: Excellent module documentation.

The module-level documentation clearly explains the purpose and utility, fully complying with the coding guidelines requirement for every module to begin with a //! comment.


6-6: Proper lint expectation with clear reasoning.

The narrowly scoped expectation for clippy::expect_used with a clear reason follows the coding guidelines perfectly, avoiding blanket suppression whilst acknowledging the test context.


15-25: Well-documented and straightforward helper function.

The temp_config function has clear documentation explaining its purpose and parameters. The implementation provides sensible defaults for test scenarios.


27-40: Appropriate use of expect in test utility context.

The octocrab_for function is well-documented and properly uses .expect() over .unwrap() as required by the coding guidelines. The Arc wrapper is appropriate for the shared client usage pattern.

Comment thread test-support/Cargo.toml Outdated
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

🔭 Outside diff range comments (1)
crates/comenqd/src/daemon.rs (1)

248-256: Delete the include!-based helper module – the new test_support import makes it redundant.

mod test_helpers pulls in the same helper functions now provided by test_support::{…}. Keeping both definitions bloats the test binary, risks name clashes, and triggers dead-code / duplicate definitions warnings under Clippy.

Apply this surgical removal:

-    mod test_helpers {
-        include!(concat!(
-            env!("CARGO_MANIFEST_DIR"),
-            "/../../tests/util/test_helpers.rs"
-        ));
-    }

No other changes are required; all call-sites already use the test_support re-export.

♻️ Duplicate comments (1)
crates/comenqd/src/daemon.rs (1)

363-368: Keep test-fixture style consistent – reuse the proposed helper here too.

Once the cfg_with_cooldown helper is introduced (see previous comment), rewrite this initialisation accordingly to avoid duplicating the struct-update literal.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b7eeb2b and 5ea514d.

📒 Files selected for processing (2)
  • crates/comenqd/src/daemon.rs (4 hunks)
  • tests/cucumber.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
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.
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.
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.
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.
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 concat!() to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums. Derive std::error::Error (via the thiserror crate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary. Use eyre::Report for human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library. Convert to domain enums at API boundaries, and to eyre only in the main main() entrypoint or top-level async task.

Files:

  • tests/cucumber.rs
  • crates/comenqd/src/daemon.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:

  • tests/cucumber.rs
  • crates/comenqd/src/daemon.rs

Comment thread crates/comenqd/src/daemon.rs
Comment thread crates/comenqd/src/daemon.rs Outdated
Comment thread tests/cucumber.rs
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Aug 1, 2025

@coderabbitai please update these instructions to reflect the changes in this branch:

Update all usages of temp_config across the codebase:

Modified tests/util/test_helpers.rs:

//! Helper utilities for behavioural and unit tests.
//!
//! These functions create temporary daemon configuration objects and
//! Octocrab clients tailored for a `wiremock::MockServer`.

use std::sync::Arc;

use comenqd::config::Config;
use octocrab::Octocrab;
use tempfile::TempDir;
use wiremock::MockServer;

/// Build a temporary [`Config`] using paths under `tmp`.
///
/// # Parameters
/// - `tmp`: temporary directory for socket and queue paths.
/// - `cooldown_period_seconds`: cooldown period between GitHub API calls.
///
/// # Examples
///
/// ```
/// use tempfile::tempdir;
/// use comenqd::config::Config;
/// use util::test_helpers::temp_config;
///
/// let dir = tempdir().unwrap();
/// let cfg: Config = temp_config(&dir, 1);
/// let fast_cfg: Config = temp_config(&dir, 0);
/// assert!(cfg.socket_path.ends_with("sock"));
/// ```
pub fn temp_config(tmp: &TempDir, cooldown_period_seconds: u64) -> Config {
    Config {
        github_token: String::from("t"),
        socket_path: tmp.path().join("sock"),
        queue_path: tmp.path().join("q"),
        cooldown_period_seconds,
    }
}

/// Create an [`Octocrab`] instance configured for `server`.
///
/// # Examples
///
/// ```
/// use wiremock::MockServer;
/// use util::test_helpers::octocrab_for;
///
/// # tokio_test::block_on(async {
/// let server = MockServer::start().await;
/// let octocrab = octocrab_for(&server);
/// assert!(octocrab.base_url().as_str().contains(&server.uri()));
/// # });
/// ```
#[expect(clippy::expect_used, reason = "simplify test helper setup")]
pub fn octocrab_for(server: &MockServer) -> Arc<Octocrab> {
    Arc::new(
        Octocrab::builder()
            .personal_token("t".to_string())
            .base_uri(server.uri())
            .expect("base_uri")
            .build()
            .expect("build octocrab"),
    )
}

Modified tests/steps/listener_steps.rs:

#[given("a running listener")]
async fn running_listener(world: &mut ListenerWorld) {
    let dir = TempDir::new().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 1));
    let (sender, receiver) = channel(&cfg.queue_path).expect("channel");
    let (client_tx, writer_rx) = mpsc::unbounded_channel();
    let (shutdown_tx, shutdown_rx) = watch::channel(());

    let writer = tokio::spawn(daemon::queue_writer(sender, writer_rx));
    let handle = tokio::spawn(daemon::run_listener(cfg.clone(), client_tx, shutdown_rx));

    wait_for_file(&cfg.socket_path, 10, Duration::from_millis(10)).await;

    world.set_listener(cfg, receiver, handle, writer, shutdown_tx);
}

Modified tests/steps/worker_steps.rs:

#[given("a queued request")]
async fn queued_request(world: &mut WorkerWorld) {
    let dir = TempDir::new().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 0));
    let (sender, receiver) = channel(&cfg.queue_path).expect("channel");

    let req = CommentRequest {
        owner: "owner".into(),
        repo: "repo".into(),
        pr_number: 1,
        body: "Test comment".into(),
    };

    sender
        .send(serde_json::to_vec(&req).expect("serialize"))
        .await
        .expect("send");

    world.set_worker(cfg, receiver);
}

Modified crates/comenqd/src/daemon.rs (all test functions):

    async fn setup_run_worker(status: u16) -> (MockServer, Arc<Config>, Receiver, Arc<Octocrab>) {
        let dir = tempdir().expect("tempdir");
        let cfg = Arc::new(temp_config(&dir, 0));
        let (sender, rx) = channel(&cfg.queue_path).expect("channel");
        let req = CommentRequest {
            owner: "o".into(),
            repo: "r".into(),
            pr_number: 1,
            body: "b".into(),
        };
        sender
            .send(serde_json::to_vec(&req).expect("serialize"))
            .await
            .expect("send");

        let server = MockServer::start().await;
        Mock::given(method("POST"))
            .and(path("/repos/o/r/issues/1/comments"))
            .respond_with(ResponseTemplate::new(status).set_body_raw("{}", "application/json"))
            .mount(&server)
            .await;

        let octo = octocrab_for(&server);

        (server, cfg, rx, octo)
    }

    #[tokio::test]
    async fn run_creates_queue_directory() {
        let dir = tempdir().expect("Failed to create temporary directory");
        let cfg = temp_config(&dir, 1);

        assert!(!cfg.queue_path.exists());

        let handle = tokio::spawn(run(cfg.clone()));

        wait_for_file(&cfg.queue_path, 200, Duration::from_millis(10)).await;

        handle.abort();
        assert!(cfg.queue_path.is_dir(), "queue directory not created");
    }

    #[tokio::test]
    async fn run_listener_accepts_connections() {
        let dir = tempdir().expect("tempdir");
        let cfg = Arc::new(temp_config(&dir, 1));

        let (sender, mut receiver) = channel(&cfg.queue_path).expect("channel");
        let (client_tx, writer_rx) = mpsc::unbounded_channel();
        let (shutdown_tx, shutdown_rx) = watch::channel(());
        let writer = tokio::spawn(queue_writer(sender, writer_rx));

        let listener_task = tokio::spawn(run_listener(cfg.clone(), client_tx, shutdown_rx));

        wait_for_file(&cfg.socket_path, 10, Duration::from_millis(10)).await;

        let mut stream = UnixStream::connect(&cfg.socket_path)
            .await
            .expect("connect");
        let req = CommentRequest {
            owner: "o".into(),
            repo: "r".into(),
            pr_number: 1,
            body: "b".into(),
        };
        let payload = serde_json::to_vec(&req).expect("serialize");
        stream.write_all(&payload).await.expect("write");
        stream.shutdown().await.expect("shutdown");

        let guard = receiver.recv().await.expect("recv");
        let stored: CommentRequest = serde_json::from_slice(&guard).expect("parse");
        assert_eq!(stored, req);

        listener_task.abort();
        let _ = shutdown_tx.send(());
        drop(writer);
    }

This commit eliminates all mutable Config bindings by making temp_config accept the cooldown period as a parameter. Tests that need immediate execution (worker tests) use 0, while others use the standard 1 second cooldown.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 1, 2025

Tip

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

🧩 Analysis chain

@leynos I've analyzed the current codebase and can provide updated instructions. Based on the current implementation, here are the instructions to refactor temp_config to accept a cooldown_period_seconds parameter:

Updated Instructions for temp_config Refactoring

1. Update the helper function signature

Modify test-support/src/daemon.rs:

/// Build a temporary [`Config`] using paths under `tmp`.
///
/// # Parameters
/// - `tmp`: temporary directory for socket and queue paths.
/// - `cooldown_period_seconds`: cooldown period between GitHub API calls.
///
/// # Examples
///
/// ```
/// use tempfile::tempdir;
/// use comenqd::config::Config;
/// use test_support::{temp_config};
///
/// let dir = tempdir().unwrap();
/// let cfg: Config = temp_config(&dir, 1);
/// let fast_cfg: Config = temp_config(&dir, 0);
/// assert!(cfg.socket_path.ends_with("sock"));
/// ```
pub fn temp_config(tmp: &TempDir, cooldown_period_seconds: u64) -> Config {
    Config {
        github_token: String::from("t"),
        socket_path: tmp.path().join("sock"),
        queue_path: tmp.path().join("q"),
        cooldown_period_seconds,
    }
}

2. Update all call sites

Modify tests/steps/listener_steps.rs:
Replace temp_config(&dir) with temp_config(&dir, 1) for standard test execution.

Modify tests/steps/worker_steps.rs:
Replace the current Config construction with temp_config(&dir, 0) for immediate execution without cooldown.

Modify crates/comenqd/src/daemon.rs test functions:

  • In setup_run_worker: Use temp_config(&dir, 0) for immediate execution
  • In run_creates_queue_directory: Use temp_config(&dir, 1) for standard test execution
  • In run_listener_accepts_connections: Use temp_config(&dir, 1) for standard test execution

3. Standardized cooldown values

  • Worker tests: Use 0 seconds for immediate execution
  • All other tests: Use 1 second for standard cooldown period

4. Benefits of this refactoring

  • Eliminates mutable Config bindings throughout the test suite
  • Provides explicit control over cooldown periods per test scenario
  • Maintains consistency in test helper usage
  • Improves test performance where immediate execution is needed

This refactoring centralizes the cooldown period configuration while allowing each test to specify the appropriate timing behavior for its scenario.


🏁 Script executed:

#!/bin/bash
# First, let's examine the current temp_config implementation
echo "=== Current temp_config implementation ==="
fd -t f -e rs . | xargs rg -l "temp_config" | head -10

echo ""
echo "=== Finding temp_config function definition ==="
ast-grep --pattern 'pub fn temp_config($$$) {
  $$$
}'

echo ""
echo "=== Current temp_config usage patterns ==="
rg "temp_config" -A 2 -B 1

Length of output: 3776


🏁 Script executed:

#!/bin/bash
# Let's examine the specific files mentioned in the user's request
echo "=== test-support/src/daemon.rs current content ==="
cat test-support/src/daemon.rs

echo ""
echo "=== tests/steps/listener_steps.rs current temp_config usage ==="
rg "temp_config" tests/steps/listener_steps.rs -A 3 -B 3

echo ""
echo "=== tests/steps/worker_steps.rs current temp_config usage ==="
rg "temp_config" tests/steps/worker_steps.rs -A 3 -B 3

echo ""
echo "=== crates/comenqd/src/daemon.rs current temp_config usage ==="
rg "temp_config" crates/comenqd/src/daemon.rs -A 3 -B 3

Length of output: 4073


🏁 Script executed:

#!/bin/bash
# Check if the file path mentioned in user's request exists
echo "=== Checking if tests/util/test_helpers.rs exists ==="
ls -la tests/util/ 2>/dev/null || echo "tests/util/ directory does not exist"

echo ""
echo "=== Current tests/util structure ==="
find tests/util -type f 2>/dev/null || echo "No tests/util directory found"

echo ""
echo "=== Current test-support structure ==="
find test-support/src -type f -name "*.rs"

Length of output: 753


@leynos I've analyzed the current codebase state and can provide the updated instructions. I notice there are currently two temp_config implementations - one in test-support/src/daemon.rs (the main one) and another in tests/util/test_helpers.rs. Here are the corrected instructions:

Updated Instructions for temp_config Refactoring

1. Update the main helper function

Modify test-support/src/daemon.rs:

/// Build a [`Config`] using paths inside `tmp`.
///
/// # Parameters
/// - `tmp`: temporary directory for socket and queue paths.
/// - `cooldown_period_seconds`: cooldown period between GitHub API calls.
///
/// # Examples
///
/// ```
/// use tempfile::tempdir;
/// use comenqd::config::Config;
/// use test_support::temp_config;
///
/// let dir = tempdir().unwrap();
/// let cfg: Config = temp_config(&dir, 1);
/// let fast_cfg: Config = temp_config(&dir, 0);
/// assert!(cfg.socket_path.ends_with("sock"));
/// ```
pub fn temp_config(tmp: &TempDir, cooldown_period_seconds: u64) -> Config {
    Config {
        github_token: "t".into(),
        socket_path: tmp.path().join("sock"),
        queue_path: tmp.path().join("q"),
        cooldown_period_seconds,
    }
}

2. Update the duplicate implementation (if keeping it)

Modify tests/util/test_helpers.rs to match the same signature, or remove it entirely since it's redundant.

3. Update all call sites

Modify tests/steps/listener_steps.rs:

#[given("a running listener task")]
async fn running_listener(world: &mut ListenerWorld) {
    let dir = TempDir::new().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 1)); // Standard 1-second cooldown
    // ... rest of function
}

Modify tests/steps/worker_steps.rs:

#[given("a queued comment request")]
async fn queued_request(world: &mut WorkerWorld) {
    let dir = TempDir::new().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 0)); // Immediate execution, no cooldown
    // ... rest of function
}

Modify crates/comenqd/src/daemon.rs:

async fn setup_run_worker(status: u16) -> (MockServer, Arc<Config>, Receiver, Arc<Octocrab>) {
    let dir = tempdir().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 0)); // Immediate execution for worker tests
    // ... rest of function
}

#[tokio::test]
async fn run_creates_queue_directory() {
    let dir = tempdir().expect("Failed to create temporary directory");
    let cfg = temp_config(&dir, 1); // Standard cooldown
    // ... rest of test
}

#[tokio::test]
async fn run_listener_accepts_connections() {
    let dir = tempdir().expect("tempdir");
    let cfg = Arc::new(temp_config(&dir, 1)); // Standard cooldown
    // ... rest of test
}

4. Cooldown value conventions

  • Worker tests: Use 0 seconds for immediate execution without delays
  • Listener and other tests: Use 1 second for standard cooldown behavior

5. Benefits achieved

  • ✅ Eliminates all mutable Config bindings (let mut base = temp_config(&dir); base.cooldown_period_seconds = 0;)
  • ✅ Removes struct update syntax patterns (Config { cooldown_period_seconds: 1, ..temp_config(&dir) })
  • ✅ Provides explicit, parameterized control over cooldown periods
  • ✅ Improves test performance where immediate execution is needed
  • ✅ Maintains consistent test helper usage across the codebase

This refactoring will clean up the current pattern of creating mutable configs just to modify the cooldown period, making the test code more explicit and easier to maintain.

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

🔭 Outside diff range comments (2)
tests/cucumber.rs (1)

8-10: Insert function docs above the attribute
Place the doc comment before #[tokio::main] to satisfy the “attribute after doc comments” rule and silence Clippy’s missing_docs lint.

+
+/// Entry-point for the Cucumber test suite.
+/// Spawns each `World` and executes its feature file concurrently.
 #[tokio::main]
 async fn main() {
crates/comenqd/src/daemon.rs (1)

242-247: Delete the include!-based helper re-export.

test_support already exposes wait_for_file, temp_config, and octocrab_for. Keeping this include! duplicates code and risks symbol clashes. Remove the test_helpers module and import everything directly from test_support.

-    mod test_helpers {
-        include!(concat!(
-            env!("CARGO_MANIFEST_DIR"),
-            "/../../tests/util/test_helpers.rs"
-        ));
-    }
+    // No longer needed – all helpers come from `test_support`.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5ea514d and 9d13533.

📒 Files selected for processing (3)
  • crates/comenqd/src/daemon.rs (3 hunks)
  • test-support/Cargo.toml (1 hunks)
  • tests/cucumber.rs (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit Inference Engine (AGENTS.md)

**/*.rs: Clippy warnings MUST be disallowed.
Fix any warnings emitted during tests in the code itself rather than silencing them.
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.
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.
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.
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.
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 concat!() to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums. Derive std::error::Error (via the thiserror crate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary. Use eyre::Report for human-readable logs; these should not be exposed in public APIs.
Never export the opaque type from a library. Convert to domain enums at API boundaries, and to eyre only in the main main() entrypoint or top-level async task.

Files:

  • tests/cucumber.rs
  • crates/comenqd/src/daemon.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:

  • tests/cucumber.rs
  • crates/comenqd/src/daemon.rs
🔇 Additional comments (4)
tests/cucumber.rs (1)

3-3: Duplicate-module fix looks good
The earlier compilation error from declaring mod util; twice is resolved.

test-support/Cargo.toml (2)

11-11: Caret requirement for wiremock looks good.

The previous review request is satisfied; dependency now follows semver-compatible caret syntax.


4-4: Approve 2024 edition usage

Recognise that rust-toolchain.toml at the repository root already pins the nightly toolchain (nightly-2025-07-22), satisfying the requirement for edition = "2024".
No changes required.

  • rust-toolchain.toml (root): channel = "nightly-2025-07-22"
crates/comenqd/src/daemon.rs (1)

256-261: LGTM for the helper function.

The extracted cfg_with_cooldown eliminates repetition and keeps tests declarative.

Comment thread crates/comenqd/src/daemon.rs
Comment thread tests/cucumber.rs
@leynos leynos merged commit 9fd698e into main Aug 1, 2025
1 check passed
@leynos leynos deleted the sy5o6u-codex/add-test-helpers-module branch August 1, 2025 19:16
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