Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR enhances the worker step tests by adding documentation for each step’s expected behavior and tightening mock behavior: it replaces blanket 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 2 minutes and 13 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 selected for processing (1)
Summary by CodeRabbit
WalkthroughReplace crate-level Clippy lint allowances with a crate attribute and add a module-level doc comment; replace multiple test unwrap() calls with expect(...) carrying explicit messages. Preserve existing control flow and public APIs; changes confined to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 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 (
|
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)
tests/steps/worker_steps.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:
tests/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:
tests/steps/worker_steps.rs
🔍 MCP Research (1 server)
Deepwiki:
-
Issue ENG-2040: The
tests/steps/worker_steps.rsfile contains crate-level lint directives forclippy::expect_usedandclippy::unwrap_usedwhich were previously set toallowbut are now changed toexpectwith the reason "simplify test output". This aligns with the project's linting standards that generally denyunwrap_usedandexpect_usedexcept in test files where they are allowed or expected to simplify test output. The file also includes a module-level documentation comment describing its purpose as behavioral test steps for the worker task, which drive Cucumber scenarios verifying the worker's posting of queued comments and graceful failure handling. No other code or logic changes were made. (ENG-2040) -
Document Development Guide (leynos/comenq): The project enforces strict Clippy linting rules workspace-wide, including pedantic rules and deny-level restrictions on many lints such as
unwrap_usedandexpect_used. However, in test files liketests/steps/worker_steps.rs, the lint rules forexpect_usedandunwrap_usedare allowed with a reason to simplify test output. Lint suppressions must be tightly scoped and include a clear reason. The CI pipeline runscargo clippy -- -D warningsto enforce these rules. (Development Guide) -
Document Behavioral Tests: The
WorkerWorldin the behavioral tests uses mock HTTP servers to test GitHub API interactions and verifies that requests are properly processed and GitHub API calls are made. The worker tests verify that successful API calls remove requests from the queue and failed calls leave requests queued for retry. The tests use thetest-supportcrate utilities such asoctocrab_for()for mocking andwait_for_file()for async synchronization. Theworker_steps.rsfile contains step definitions for these behavioral tests. (Behavioral Tests)
⏰ 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 (1)
tests/steps/worker_steps.rs (1)
6-7: Switch to #[expect] over #[allow] — good alignment with ENG-2040.Prefer #[expect] to keep the lints visible and intentional in tests; the reason is present and clear.
Summary
Testing
make fmtmake lintmake testhttps://chatgpt.com/codex/tasks/task_e_689665d527a08322941b61211ca2f8e6
Summary by Sourcery
Replace broad stubs with scoped expectations in worker step tests and document worker behavioural steps
Enhancements:
Tests: