Conversation
Move temp_config and octocrab_for into test-support and update tests accordingly.
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR centralizes test helper implementations by delegating to the shared test-support crate, updating imports and dependencies accordingly, and removing duplicate helper code across crates and tests. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbit
WalkthroughRemove local implementations of the Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Test File
participant test_support as test_support Crate
Note right of Test: Request test helper (e.g., temp_config)
Test->>test_support: Use temp_config / octocrab_for
Note right of test_support: Provides implementation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (3)
tests/steps/listener_steps.rs (1)
40-46: Apply the same refactoring as suggested in worker_steps.rs.This file exhibits the same verbose field copying pattern. Implement the
From<TestConfig>trait as suggested in the worker_steps.rs review to eliminate this duplication.crates/comenqd/src/daemon.rs (2)
301-308: Apply the From trait refactoring for consistency.This function demonstrates the same verbose field copying pattern seen in other test files. Implement the
From<TestConfig>trait as suggested in previous reviews to maintain consistency across the codebase.
355-362: Apply the From trait refactoring for consistency.The worker_test_context fixture exhibits the same pattern. Use the suggested
From<TestConfig>implementation to reduce boilerplate.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
crates/comenqd/src/daemon.rs(2 hunks)test-support/Cargo.toml(0 hunks)test-support/src/daemon.rs(1 hunks)test-support/src/lib.rs(1 hunks)tests/steps/listener_steps.rs(2 hunks)tests/steps/worker_steps.rs(2 hunks)
💤 Files with no reviewable changes (1)
- test-support/Cargo.toml
🧰 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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/steps/worker_steps.rstests/steps/listener_steps.rscrates/comenqd/src/daemon.rstest-support/src/lib.rstest-support/src/daemon.rs
🧬 Code Graph Analysis (4)
tests/steps/worker_steps.rs (1)
test-support/src/daemon.rs (2)
octocrab_for(43-52)temp_config(30-37)
tests/steps/listener_steps.rs (2)
test-support/src/daemon.rs (1)
temp_config(30-37)test-support/src/util.rs (1)
wait_for_file(32-40)
crates/comenqd/src/daemon.rs (1)
test-support/src/daemon.rs (2)
octocrab_for(43-52)temp_config(30-37)
test-support/src/lib.rs (1)
test-support/src/daemon.rs (2)
octocrab_for(43-52)temp_config(30-37)
🔍 MCP Research (1 server)
Deepwiki:
- There are no reported issues, bugs, or incidents related to the test helper functions
temp_configoroctocrab_forin the filescrates/comenqd/src/daemon.rs,test-support/src/daemon.rs,test-support/src/lib.rs,tests/steps/listener_steps.rs, ortests/steps/worker_steps.rs. These functions are used in the test suite to set up configurations and mock GitHub API interactions for testing purposes. (Source: internal codebase context and wiki)
🔇 Additional comments (6)
test-support/src/lib.rs (1)
10-10: LGTM! TestConfig addition aligns with centralization.The addition of
TestConfigto the re-exports correctly supports the new test configuration struct introduced in the daemon module.tests/steps/worker_steps.rs (1)
15-15: LGTM! Import correctly updated to use centralized test helpers.The change from local
utiltotest_supportproperly reflects the centralization effort.tests/steps/listener_steps.rs (1)
11-11: LGTM! Import properly updated to centralized test support.The change correctly imports
temp_configfromtest_supportinstead of the local util module.crates/comenqd/src/daemon.rs (1)
291-291: LGTM! Proper import of centralized test helpers.The import correctly brings in
octocrab_forandtemp_configfrom the centralizedtest_supportcrate.test-support/src/daemon.rs (2)
30-37: LGTM! Clean implementation of centralized test config.The function properly returns the new
TestConfigstruct with sensible default values for testing. The implementation is clean and well-documented.
43-52: LGTM! octocrab_for function remains appropriately unchanged.The function correctly creates an Octocrab client for testing with proper error handling using
.expect()as per coding guidelines.
There was a problem hiding this comment.
Actionable comments posted: 8
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (6)
Cargo.toml(1 hunks)crates/comenqd/Cargo.toml(1 hunks)crates/comenqd/src/config.rs(1 hunks)crates/comenqd/src/daemon.rs(2 hunks)tests/steps/listener_steps.rs(2 hunks)tests/steps/worker_steps.rs(2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
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 are strictly forbidden, as are tilde requirements (~) except for documented reasons.
Files:
Cargo.toml
**/*.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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/config.rscrates/comenqd/src/daemon.rstests/steps/listener_steps.rstests/steps/worker_steps.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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/config.rscrates/comenqd/src/daemon.rstests/steps/listener_steps.rstests/steps/worker_steps.rs
🧬 Code Graph Analysis (2)
crates/comenqd/src/daemon.rs (1)
test-support/src/daemon.rs (2)
octocrab_for(43-52)temp_config(30-37)
tests/steps/worker_steps.rs (1)
test-support/src/daemon.rs (2)
octocrab_for(43-52)temp_config(30-37)
🪛 GitHub Check: build-test
crates/comenqd/src/daemon.rs
[failure] 353-353:
type annotations needed for Arc<_>
🪛 GitHub Actions: CI
crates/comenqd/src/daemon.rs
[error] 353-353: Rust compiler error E0282: type annotations needed for Arc<_> at line 353.
🔍 MCP Research (1 server)
Deepwiki:
-
The
test-supportcrate centralizes common test helpers such astemp_configandoctocrab_for, which were previously defined locally incrates/comenqd/src/daemon.rsand other test modules. This centralization improves organization and reusability of test utilities across the repository. (DeepWiki search result summary) -
In
crates/comenqd/src/daemon.rs, the test helper functionstemp_configandoctocrab_forare now imported from thetest-supportcrate instead of being locally defined. These helpers are used in tests likerun_creates_queue_directoryandworker_test_contextto set up temporary configurations and mock Octocrab clients. (DeepWiki search result summary) -
The
crates/comenqd/Cargo.tomlfile was updated to includetest-supportas a dependency, reflecting the migration of shared test utilities into this dedicated crate. (DeepWiki search result summary) -
Behavioral test step files
tests/steps/listener_steps.rsandtests/steps/worker_steps.rsnow import test helpers liketemp_config,octocrab_for, andwait_for_filefrom thetest_supportcrate, facilitating consistent test setup across different test suites. (DeepWiki search result summary)
🔇 Additional comments (5)
Cargo.toml (1)
18-18: Dependency feature flag looks correctPath-based dev-dependency
comenqdnow explicitly enables thetest-supportfeature; this is compliant with the workspace’s version-pinning rules.tests/steps/worker_steps.rs (1)
15-15: Import switch approvedImporting helpers from
test_supportremoves local duplication and aligns with the centralisation effort.tests/steps/listener_steps.rs (1)
11-11: Centralised helper import approvedSwitching to
test_supportkeeps tests DRY; no issues.crates/comenqd/src/daemon.rs (2)
303-303: Approve: use..temp_config(dir).into()to fill remainingConfigfields.The struct update gives
Intoa concrete target type (Config), avoiding inference issues. This is clean and idiomatic.
291-291: Verify test-support wiring – no action needed
crates/comenqd/Cargo.tomldeclaresso the crate pulls in[dependencies] test-support = { path = "../../test-support", optional = true } [features] default = [] test-support = ["dep:test-support"]test-supportonly when thetest-supportfeature is enabled.- In
crates/comenqd/src/daemon.rs, alluse test_support::…lines live inside the#[cfg(test)] mod tests { … }block.No changes required.
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
tests/steps/worker_steps.rs (1)
1-5: Replace blanketallowwith scopedexpect.Project guidelines forbid broad
#[allow]. Use#![expect(clippy::expect_used, reason = "simplify test output")]etc., or apply per-callexpecton the two offending sites.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (7)
Cargo.toml(2 hunks)crates/comenqd/Cargo.toml(1 hunks)crates/comenqd/src/config.rs(1 hunks)crates/comenqd/src/daemon.rs(2 hunks)test-support/src/daemon.rs(1 hunks)tests/steps/listener_steps.rs(2 hunks)tests/steps/worker_steps.rs(2 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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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/steps/listener_steps.rstests/steps/worker_steps.rscrates/comenqd/src/daemon.rscrates/comenqd/src/config.rstest-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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/steps/listener_steps.rstests/steps/worker_steps.rscrates/comenqd/src/daemon.rscrates/comenqd/src/config.rstest-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 are strictly forbidden, as are tilde requirements (~) except for documented reasons.
Files:
Cargo.toml
🧬 Code Graph Analysis (3)
tests/steps/listener_steps.rs (1)
test-support/src/daemon.rs (1)
temp_config(30-37)
tests/steps/worker_steps.rs (2)
crates/comenqd/src/daemon.rs (1)
run_worker(244-278)test-support/src/daemon.rs (2)
octocrab_for(51-60)temp_config(30-37)
crates/comenqd/src/daemon.rs (2)
test-support/src/util.rs (1)
poll_until(81-105)test-support/src/daemon.rs (2)
octocrab_for(51-60)temp_config(30-37)
🔍 MCP Research (1 server)
Deepwiki:
-
Added conditional implementations (gated by the
test-supportfeature) to convert fromtest_support::daemon::TestConfigto the mainConfigstruct. This includes twoFromtrait implementations: one consuming an ownedTestConfigand one for a borrowed reference that clones before conversion. Additionally, a new traitIntoConfigwas introduced with a single methodinto_configthat consumes aTestConfigand returns aConfig. This trait is implemented fortest_support::daemon::TestConfigby delegating to the existingFromimplementation. These additions provide explicit conversions from test configuration types to the main daemon configuration. (crates/comenqd/src/config.rs) -
The code removes the dependency on the external
Configtype and replaces it with a new local structTestConfigspecifically designed for daemon tests. This struct explicitly defines fields for GitHub token, socket path, queue path, and cooldown period, all with appropriate types and documentation. Thetemp_configfunction is updated to return aTestConfiginstance instead of aConfig. Additionally, a new methodwith_cooldownis added toTestConfigto allow overriding the cooldown period fluently. The import statements are adjusted to includePathBufand remove the import of the externalConfigtype. The rest of the code, including theoctocrab_forfunction, remains unchanged. (test-support/src/daemon.rs) -
The import of
IntoConfigfromcomenqd::configwas added. Thetemp_configfunction is now imported fromtest_supportinstead of being referenced from a local crate module. In therunning_listenerstep, the configuration object created bytemp_config(&dir)is converted into aConfiginstance by calling.into_config()before being wrapped in anArc. This replaces the previous direct wrapping of thetemp_configresult in anArc. The rest of the logic in the step, including channel creation, task spawning, and assertions, remains unchanged. (tests/steps/listener_steps.rs) -
The import source for the
octocrab_forandtemp_configfunctions was changed from the local crate'sutilmodule to an external or differently namedtest_supportmodule. Thequeued_requestfunction's construction of theConfigobject was refactored: instead of mutating thecooldown_period_secondsfield on a mutableConfigreturned bytemp_config, it now uses a method chain callingwith_cooldown(0)followed byinto_config()to produce the finalConfiginstance wrapped in anArc. This replaces the previous pattern of creating a mutable copy and manually setting the cooldown period. The rest of the function and the file remain unchanged. (tests/steps/worker_steps.rs)
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-test
🔇 Additional comments (10)
crates/comenqd/Cargo.toml (1)
21-22: Dependency and feature wiring looks sound.Optional
test-supportdependency is correctly gated behind the likewise-named feature; no action required.Also applies to: 29-32
tests/steps/listener_steps.rs (1)
41-41: Conversion chain is clear and explicit.
temp_config(...).into_config()expresses intent well; good job replacing the implicitFromcall.Cargo.toml (1)
18-19: Workspace alignment OK.
test-supportis now supplied through workspace metadata; no version drift risk spotted.Also applies to: 24-24, 58-58
tests/steps/worker_steps.rs (1)
40-40: Chain remains readable and concise.
with_cooldown(0).into_config()eliminates the earlier manual struct update—nice improvement.crates/comenqd/src/daemon.rs (4)
293-293: Centralise imports totest_support— good changeImport
octocrab_forandtemp_configfromtest_supportto remove duplication across tests. This aligns with the PR objective.
302-302: Builder-style config in tests — good refactorReturn
Configviatemp_config(dir).with_cooldown(secs).into_config()for clarity and immutability; this keeps functions short and single-purpose.
347-347: Promote inline note to fixture-level doc — goodDocument the cooldown behaviour at the fixture boundary and keep attributes after doc comments per guidelines.
284-284: Enable thetest-supportfeature on every test invocationThe
IntoConfigtrait and itsFrom<TestConfig>implementations are gated behind#[cfg(feature = "test-support")]. Your local and CI test runs must include--features test-supportto compile and link those conversions.Pinpoint updates:
- Makefile: change any
cargo testlines to
cargo test --features test-support [other args]- .github/workflows/*.yml: ensure every
run: cargo teststep includes
--features test-supportRun your CI locally and verify all test suites pass with
cargo test --features test-support.crates/comenqd/src/config.rs (2)
38-49: OwnedFrom<TestConfig>impl — correct and documentedMap fields 1:1, keep it gated behind
test-support, and document the conversion. This enables explicitConfig::from(test_cfg)without inference issues.
51-57: Delegate the borrowed impl to the owned one — goodDelegate via
Self::from(value.clone())to avoid duplicating field lists and reduce maintenance.
There was a problem hiding this comment.
Actionable comments posted: 3
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (5)
crates/comenqd/src/config.rs(1 hunks)crates/comenqd/src/daemon.rs(2 hunks)test-support/src/daemon.rs(1 hunks)tests/steps/listener_steps.rs(2 hunks)tests/steps/worker_steps.rs(2 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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/config.rstests/steps/listener_steps.rscrates/comenqd/src/daemon.rstest-support/src/daemon.rstests/steps/worker_steps.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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/config.rstests/steps/listener_steps.rscrates/comenqd/src/daemon.rstest-support/src/daemon.rstests/steps/worker_steps.rs
🧬 Code Graph Analysis (3)
tests/steps/listener_steps.rs (3)
test-support/src/daemon.rs (1)
temp_config(30-37)test-support/src/util.rs (1)
wait_for_file(32-40)crates/comenqd/src/config.rs (2)
from(41-48)from(54-56)
crates/comenqd/src/daemon.rs (2)
test-support/src/daemon.rs (2)
octocrab_for(52-61)temp_config(30-37)crates/comenqd/src/config.rs (2)
from(41-48)from(54-56)
tests/steps/worker_steps.rs (2)
test-support/src/daemon.rs (2)
octocrab_for(52-61)temp_config(30-37)crates/comenqd/src/config.rs (2)
from(41-48)from(54-56)
🔍 MCP Research (2 servers)
Deepwiki:
-
The
test-supportcrate centralizes common test helpers such astemp_configandoctocrab_forin itsdaemonmodule, which are re-exported for convenient use in other crates and tests. This consolidation replaces previous local or crate-specific implementations, improving code reuse and maintainability. (Source: repository-wide explanation from the ask_question response) -
In
crates/comenqd/src/config.rs, thetest-supportcrate'sTestConfigtype is integrated viaFromtrait implementations to convert fromtest_support::daemon::TestConfigto the mainConfigstruct, enabling seamless use of centralized test configurations in the main daemon code. (Source: PR summary forcrates/comenqd/src/config.rs) -
The
crates/comenqd/src/daemon.rstest module now importstemp_configandoctocrab_forfromtest_support::daemoninstead of defining them locally, and uses theIntoConfigtrait conversion to buildConfiginstances fromTestConfig. This reflects the centralization of test helpers and the newTestConfigstruct usage. (Source: PR summary forcrates/comenqd/src/daemon.rs) -
Behavioral test step files such as
tests/steps/listener_steps.rsandtests/steps/worker_steps.rshave updated imports to usetemp_configandoctocrab_forfrom the centralizedtest_supportcrate, replacing previous local or crate-specific imports. They also adopt the new pattern of convertingTestConfigintoConfigviaConfig::from(...). (Source: PR summaries for these test step files)
Context7:
-
File changes in
crates/comenqd/src/config.rsadd conditionalFromtrait implementations for convertingtest_support::daemon::TestConfiginto the mainConfigstruct, enabling seamless integration of the new test configuration type into existing code when thetest-supportfeature is enabled. (PR #56) -
In
test-support/src/daemon.rs, a newTestConfigstruct is defined with fields for GitHub token, socket path, queue path, and cooldown period. Thetemp_configfunction returns aTestConfiginstance, and a methodwith_cooldownallows fluent modification of the cooldown period. This replaces the previous use of the externalConfigtype in test helpers, isolating test configuration concerns withintest-support. (PR #56) -
The
test-utilscrate is refactored to remove its own implementations oftemp_configandoctocrab_for, instead re-exporting these fromtest_support. This simplifies dependencies and encourages direct use oftest_supportfor new code. (PR #56) -
Test files and steps (
tests/steps/listener_steps.rs,tests/steps/worker_steps.rs) update imports to usetemp_configandoctocrab_forfromtest_supportand adjust configuration construction to useConfig::from(temp_config(...))with the newTestConfigconversions, ensuring compatibility with the centralized helpers. (PR #56)
🔇 Additional comments (2)
tests/steps/listener_steps.rs (1)
11-11: Import set is spot-onImporting
temp_config,wait_for_file, and the retry constants fromtest_supportcleanly reflects the new centralised helpers.tests/steps/worker_steps.rs (1)
39-39: Nice use ofwith_cooldownCalling
with_cooldown(0)on theTestConfigkeeps tests expressive and avoids manual field edits.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (4)
crates/comenqd/src/config.rs(1 hunks)crates/comenqd/src/daemon.rs(4 hunks)test-support/Cargo.toml(1 hunks)test-support/src/daemon.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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/config.rscrates/comenqd/src/daemon.rstest-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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/config.rscrates/comenqd/src/daemon.rstest-support/src/daemon.rs
🔍 MCP Research (1 server)
Deepwiki:
- The
test-supportcrate now re-exports the helper functionstemp_configandoctocrab_foralong with the newTestConfigstruct, centralizing daemon test helpers for use across the project (test-support/src/lib.rs, test-support/src/daemon.rs). - In
crates/comenqd/src/config.rs, two conditionalFromtrait implementations were added (enabled by thetest-supportfeature) to convert fromtest_support::daemon::TestConfigto the mainConfigstruct, enabling seamless conversion between test and production configurations. - The
test-supportcrate removed its local dependency oncomenqdand added a workspace dependency onserde, reflecting internal dependency adjustments (test-support/Cargo.toml). - The
temp_configandoctocrab_forfunctions were removed fromcrates/comenqd/src/daemon.rsand replaced by imports fromtest_support, consolidating test helper usage and simplifying configuration construction via theIntoConfigtrait (crates/comenqd/src/daemon.rs).
⏰ Context from checks skipped due to timeout of 120000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: build-test
🔇 Additional comments (12)
test-support/Cargo.toml (1)
12-12: Approve test-support Cargo.toml setup
- Confirm no direct
comenqddependency in test-support/Cargo.toml- Verify root Cargo.toml’s workspace serde entry includes
features = ["derive"]- Confirm no
#[derive(Serialize|Deserialize)]usage in test-support/srcMerge changes without further edits.
crates/comenqd/src/config.rs (2)
38-49: Solid owned conversion; doc before attribute; aligns with centralised helpersKeep this as-is. The owned
From<TestConfig>maps fields directly and satisfies the consolidation strategy.
51-57: Correctly delegate borrowed conversion to the owned implDelegate via
value.clone()to keep a single field list. This is idiomatic and maintainable.crates/comenqd/src/daemon.rs (5)
291-292: Use centralised test helpers fromtest_supportImport
octocrab_forandtemp_configfrom the shared crate. This removes duplication and matches the PR objective.
342-344: Keep doc comment above#[fixture]per style guideDoc is clear and placed correctly. No change needed.
345-347: ConstructConfigviaConfig::from(temp_config(&dir))to avoid type inference issuesMake the
Intotarget explicit and drop the bespoke trait. This fixes E0282 and matches earlier guidance.
392-396: Inline cooldown override at call-siteUse
with_cooldown(1)for fast, deterministic tests without extra glue. Good trade-off.
443-446: WrapConfiginArcafter constructing fromTestConfigBuild
Arc<Config>directly and keep cooldown override inline. Clean and explicit.test-support/src/daemon.rs (4)
8-11: Importserdetraits alongsidePathBuf/ArcEnable serialisation for
TestConfigwithout ad-hoc glue. Good change.
15-27: DefineTestConfigwith complete derives and docsExpose the minimal surface for tests and derive
Clone,PartialEq,Eq,Default,Serialize,Deserialize. This unblocks assertions and snapshotting.
31-38: ReturnTestConfigfromtemp_configwith 1s cooldownDocument the cooldown; keep paths scoped to
TempDir. This is clear and predictable for tests.
40-47: Providewith_cooldownand mark it#[must_use]Prevent accidental discard of the updated value. This is the right ergonomics for a fluent test API.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
crates/comenqd/src/config.rs(1 hunks)crates/comenqd/src/lib.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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/config.rscrates/comenqd/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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/config.rscrates/comenqd/src/lib.rs
🔍 MCP Research (1 server)
Deepwiki:
-
Added two conditional
Fromtrait implementations for theConfigstruct, gated by thetest-supportfeature. The first implementation converts an ownedtest_support::daemon::TestConfiginto aConfigby directly copying all fields. The second implementation converts a borrowedtest_support::daemon::TestConfigby cloning it and delegating to the owned conversion. These additions enable seamless conversion from test-specific configuration types to the main daemon configuration. (crates/comenqd/src/config.rs) -
Added the crate-level attribute
#![cfg_attr(docsrs, feature(doc_cfg))]to enable thedoc_cfgfeature conditionally when building documentation with docs.rs. No other functional or structural changes were made. (crates/comenqd/src/lib.rs)
🔇 Additional comments (3)
crates/comenqd/src/lib.rs (2)
17-17: Enable doc_cfg on docs.rs — LGTMKeep this attribute to surface feature-gated APIs in generated docs on docs.rs.
17-17: Approve doc(cfg) annotations
Bothimpl From<test_support::daemon::TestConfig>andimpl From<&test_support::daemon::TestConfig>incrates/comenqd/src/config.rsalready carry#[cfg_attr(docsrs, doc(cfg(feature = "test-support")))]No further annotations required.
crates/comenqd/src/config.rs (1)
52-60: LGTM: Delegate borrowed conversion to the owned impl.Keep the delegation via
Self::from(value.clone())to avoid field duplication and centralise maintenance.
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (2)
crates/comenqd/src/config.rs(2 hunks)crates/comenqd/src/lib.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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/lib.rscrates/comenqd/src/config.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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/lib.rscrates/comenqd/src/config.rs
🪛 GitHub Check: build-test
crates/comenqd/src/config.rs
[failure] 252-252:
unused import: TestConfig
🪛 GitHub Actions: CI
crates/comenqd/src/config.rs
[error] 252-252: Rust compiler error: unused import 'TestConfig'.
🔍 MCP Research (2 servers)
Deepwiki:
-
The
Configstruct incrates/comenqd/src/config.rsnow includes conditionalFromtrait implementations converting fromtest_support::daemon::TestConfig, enabling seamless conversion from the centralized test configuration to the daemon's runtime configuration. A test case verifies correct field copying during conversion. (crates/comenqd/src/config.rs) -
The daemon's test modules in
crates/comenqd/src/daemon.rsimporttemp_configandoctocrab_forfrom the centralizedtest_supportcrate instead of defining them locally, usingConfig::from(temp_config(...).with_cooldown(...))for configuration construction, improving consistency and reducing duplication. (crates/comenqd/src/daemon.rs) -
The
test-utilscrate incrates/test-utils/src/lib.rsnow solely re-exportstemp_configandoctocrab_forfrom thetest_supportcrate, removing its own implementations and encouraging direct use oftest_supportfor new code. (crates/test-utils/src/lib.rs) -
Test step definitions in
tests/steps/listener_steps.rsandtests/steps/worker_steps.rsimport test helpers fromtest_supportinstead of local modules, constructing configuration objects viaConfig::from(temp_config(...))with optional cooldown adjustments usingwith_cooldown, reflecting centralized test helper usage. (tests/steps/listener_steps.rs, tests/steps/worker_steps.rs)
Context7:
-
Added two conditional
Fromtrait implementations for theConfigstruct, gated by thetest-supportfeature. The first implementation converts an ownedtest_support::daemon::TestConfiginto aConfigby directly copying all fields. The second implementation converts a borrowedtest_support::daemon::TestConfigby cloning it and delegating to the owned conversion. Additionally, a test case was added (also gated bytest-support) to verify that conversion fromTestConfigtoConfigcorrectly copies all configuration fields. (crates/comenqd/src/config.rs) -
Added the crate-level attribute
#![cfg_attr(docsrs, feature(doc_cfg))]to conditionally enable thedoc_cfgfeature when building documentation with docs.rs. No other functional or structural changes were made. (crates/comenqd/src/lib.rs)
🔇 Additional comments (3)
crates/comenqd/src/lib.rs (1)
1-2: Add LGTM for crate attribute placement.The
#![cfg_attr(docsrs, feature(doc_cfg))]attribute is correctly placed at the very top, ahead of inner docs, aligning with earlier guidance and project standards.crates/comenqd/src/config.rs (2)
54-63: ApproveFrom<TestConfig>conversion (field-for-field copy).The owned conversion copies all fields verbatim and is correctly feature-gated and documented. This matches the consolidation objective and prior guidance.
70-74: Approve borrowedFrom<&TestConfig>delegating to owned.Delegating via
Self::from(value.clone())avoids duplication and centralises the field list. This is concise and maintainable for the test-only feature.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
crates/comenqd/src/config.rs(2 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.
Use rstest fixtures for shared setup.
Replace duplicated tests with #[rstest(...)] parameterised cases.
Prefer mockall for mocks/stubs.
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:
crates/comenqd/src/config.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
returnin single-line functions.Move conditionals with >2 branches into a predicate function.
Avoid
unsafeunless 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
rstestfixtures for shared setup and to avoid repetition between tests.Replace duplicated tests with
#[rstest(...)]parameterised cases.Prefer
mockallfor 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/comenqd/src/config.rs
🧬 Code Graph Analysis (1)
crates/comenqd/src/config.rs (2)
test-support/src/daemon.rs (1)
temp_config(31-38)tests/steps/cli_steps.rs (1)
socket_path(47-53)
🔍 MCP Research (1 server)
Deepwiki:
- Added two conditional
Fromtrait implementations for theConfigstruct, gated by thetest-supportfeature. The first implementation converts an ownedtest_support::daemon::TestConfiginto aConfigby directly copying all fields. The second implementation converts a borrowedtest_support::daemon::TestConfigby cloning it and delegating to the owned conversion. Additionally, a test case was added (also gated bytest-support) to verify that conversion fromTestConfigtoConfigcorrectly copies all configuration fields. (crates/comenqd/src/config.rs)
🔇 Additional comments (1)
crates/comenqd/src/config.rs (1)
38-63: LGTM: Feature-gated owned conversion with clear docsKeep as-is. The conversion is correct, docs are explicit,
doc(cfg)is present, and it complies with the Deepwiki requirement to add aFrom<TestConfig>gated bytest-support.
Summary
temp_configandoctocrab_forintest-supporttest_supportTesting
make fmtmake lintmake testhttps://chatgpt.com/codex/tasks/task_e_6893d35949c083228a71115cae436ddc
Summary by Sourcery
Centralize common test helper functions in a dedicated test-support crate, update relevant crates and tests to use the shared implementations, and clean up obsolete local helpers.
Enhancements:
Tests: