Conversation
Reviewer's GuideReplace magic literals with named constants in listener tests and add documentation for the wait_for_file re-export in the test-support module to improve readability and convenience. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Rate limit exceeded@leynos has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 12 minutes and 45 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (4)
Summary by CodeRabbit
WalkthroughDocument the re-exported Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 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. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Consider moving SOCKET_RETRY_COUNT and SOCKET_RETRY_DELAY_MS into the test-support util module so they can be reused across tests and avoid duplication.
- In the doc comment for the wait_for_file re-export, add a brief usage example and clarify the units and meaning of the retry parameters for better clarity.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider moving SOCKET_RETRY_COUNT and SOCKET_RETRY_DELAY_MS into the test-support util module so they can be reused across tests and avoid duplication.
- In the doc comment for the wait_for_file re-export, add a brief usage example and clarify the units and meaning of the retry parameters for better clarity.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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)
test-support/src/lib.rs(1 hunks)tests/steps/listener_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 usingArcto 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 unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
Place function attributes after doc comments.
Do not usereturnin 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.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Useconcat!()to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums. Derivestd::error::Error(via thethiserrorcrate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary. Useeyre::Reportfor 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 toeyreonly in the mainmain()entrypoint or top-level async task.
Files:
tests/steps/listener_steps.rstest-support/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:
tests/steps/listener_steps.rstest-support/src/lib.rs
🧬 Code Graph Analysis (1)
tests/steps/listener_steps.rs (1)
test-support/src/util.rs (1)
wait_for_file(22-30)
🔇 Additional comments (1)
tests/steps/listener_steps.rs (1)
73-78: Verify that 100 ms total wait is sufficient on CI runners.
wait_for_filenow waits at most 10 × 10 ms = 100 ms. On slow or loaded CI hosts the listener might take longer to create the socket, causing sporadic test failures. Increase the window or make it configurable if flakiness appears.
There was a problem hiding this comment.
Actionable comments posted: 4
🔭 Outside diff range comments (1)
tests/steps/listener_steps.rs (1)
64-71: Increase socket retry budget for CI reliabilityRaise the retry count to 20 and the delay to 25 ms in test-support so slow runners don’t time out:
• In test-support/src/util.rs
– ChangeSOCKET_RETRY_COUNTfrom10to20
– ChangeSOCKET_RETRY_DELAYfromDuration::from_millis(10)toDuration::from_millis(25)• In test-support/src/lib.rs
– Update the commented example usages to reflect the new valuesProposed diff:
--- a/test-support/src/util.rs +++ b/test-support/src/util.rs @@ -7,7 +7,7 @@ pub const SOCKET_RETRY_COUNT: u32 = 10; pub const SOCKET_RETRY_COUNT: u32 = 20; - pub const SOCKET_RETRY_DELAY: Duration = Duration::from_millis(10); + pub const SOCKET_RETRY_DELAY: Duration = Duration::from_millis(25); // Wait for a file to appear, retrying on failure pub async fn wait_for_file(…--- a/test-support/src/lib.rs +++ b/test-support/src/lib.rs @@ -20,7 +20,7 @@ pub use util::{SOCKET_RETRY_COUNT, SOCKET_RETRY_DELAY}; // use test_support::{wait_for_file, SOCKET_RETRY_COUNT, SOCKET_RETRY_DELAY}; // let found = wait_for_file(path, SOCKET_RETRY_COUNT, SOCKET_RETRY_DELAY).await; // SOCKET_RETRY_COUNT = 20, SOCKET_RETRY_DELAY = 25 ms
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (3)
test-support/src/lib.rs(1 hunks)test-support/src/util.rs(1 hunks)tests/steps/listener_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 usingArcto 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 unnecessarymutbindings.
Handle errors with theResulttype instead of panicking where feasible.
Avoidunsafecode unless absolutely necessary and document any usage clearly.
Place function attributes after doc comments.
Do not usereturnin 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.
Preferexpectoverallow.
Prefer.expect()over.unwrap().
Useconcat!()to combine long string literals rather than escaping newlines with a backslash.
Prefer semantic error enums. Derivestd::error::Error(via thethiserrorcrate) for any condition the caller might inspect, retry, or map to an HTTP status.
Use an opaque error only at the app boundary. Useeyre::Reportfor 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 toeyreonly in the mainmain()entrypoint or top-level async task.
Files:
test-support/src/util.rstests/steps/listener_steps.rstest-support/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:
test-support/src/util.rstests/steps/listener_steps.rstest-support/src/lib.rs
|
@coderabbitai Please create new GitHub issues for the following: 64-71: Increase socket retry budget for CI reliability Raise the retry count to 20 and the delay to 25 ms in test-support so slow runners don’t time out: • In test-support/src/util.rs • In test-support/src/lib.rs Proposed diff: |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain@leynos I'll create a GitHub issue for the socket retry budget improvements for CI reliability. 🏁 Script executed: Length of output: 1437 @leynos I've successfully created GitHub issue #41 for increasing the socket retry budget for CI reliability. The issue includes:
You can view the issue at: #41 |
|
@coderabbitai Please suggest how best to resolve the following merge conflict: test-support/src/lib.rs: |
|
Tip For best results, initiate chat on the files or code changes. @leynos The merge conflict shows that Here's the recommended resolution that combines both sets of changes: //! Test support utilities.
pub mod daemon;
pub mod util;
// Re-exports from daemon module (added in main)
pub use daemon::{octocrab_for, temp_config};
// Re-exports from util module with documentation (from your branch)
/// Maximum number of times to poll for an expected file.
pub use util::SOCKET_RETRY_COUNT;
/// Delay between polls when waiting for a file to appear.
///
/// Multiply by [`SOCKET_RETRY_COUNT`] for the worst-case wait duration.
pub use util::SOCKET_RETRY_DELAY;
/// Wait for a file to appear, retrying with a fixed delay.
///
/// This is re-exported from [`util`] for convenience in tests.
///
/// # Arguments
/// * `path` – Path to the file that is expected to be created.
/// * `tries` – Maximum number of polling attempts.
/// * `delay` – Pause between attempts as a [`std::time::Duration`].
/// The total wait time is `tries * delay`.
///
/// # Returns
/// `true` if the file appears within `tries` attempts, otherwise `false`.
///
/// # Examples
/// ```rust,no_run
/// use std::path::Path;
/// use test_support::{wait_for_file, SOCKET_RETRY_COUNT, SOCKET_RETRY_DELAY};
///
/// #[tokio::main]
/// async fn main() {
/// let path = Path::new("/tmp/example.sock");
/// let found = wait_for_file(path, SOCKET_RETRY_COUNT, SOCKET_RETRY_DELAY).await;
/// assert!(found);
/// }
/// ```
pub use util::wait_for_file;This resolution:
After applying this resolution, run |
Summary
wait_for_filere-exportTesting
make lintmake testhttps://chatgpt.com/codex/tasks/task_e_688be00363688322b31033440634887a
Summary by Sourcery
Document the wait_for_file re-export in test-support and replace magic retry values in listener_steps tests with named constants
Enhancements:
Documentation: