Conversation
Reviewer's GuideThis PR refines the packaging workflow by switching to the goreleaser-rust plugin for automated cross-compiles, centralizing the default daemon config in a shared directory, enhancing the Linux preremove hook with systemctl presence checks, and clarifying github_token behavior in the default config. Flow diagram for Linux preremove hook with systemctl checkflowchart TD
A[Start preremove.sh] --> B{Is systemctl present and /run/systemd/system exists?}
B -- No --> F[Exit]
B -- Yes --> C{Is comenqd.service active?}
C -- Yes --> D[Stop comenqd.service]
C -- No --> E
D --> E{Is comenqd.service enabled?}
C -- No --> E
E -- Yes --> G[Disable comenqd.service]
E -- No --> F[Exit]
G --> F
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 7 minutes and 59 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 (11)
Summary by CodeRabbit
WalkthroughUpdate the build and packaging process to use the Rust GoReleaser plugin with explicit Rust targets, replacing the previous Go builder and manual Cargo hooks. Standardise all references to the configuration file path as Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GoReleaser
participant Rust Plugin
participant Cargo
participant Archive/Package
User->>GoReleaser: Trigger release
GoReleaser->>Rust Plugin: Build binaries (targets: Linux/macOS x86_64/aarch64)
Rust Plugin->>Cargo: Compile comenq, comenqd
Cargo-->>Rust Plugin: Built binaries
Rust Plugin-->>GoReleaser: Return binaries
GoReleaser->>Archive/Package: Package binaries and config from packaging/shared/config.toml
Archive/Package-->>User: Distribute release artifacts
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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:
- It looks like you’re using the goreleaser-rust plugin but there’s no
pluginssection in your.goreleaser.yaml—you’ll need to add and configure the plugin so GoReleaser actually loads it. - You’ve repeated the same
targetslist in several build sections—consider using a YAML anchor or a shared variable to DRY up the configuration and simplify future maintenance.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- It looks like you’re using the goreleaser-rust plugin but there’s no `plugins` section in your `.goreleaser.yaml`—you’ll need to add and configure the plugin so GoReleaser actually loads it.
- You’ve repeated the same `targets` list in several build sections—consider using a YAML anchor or a shared variable to DRY up the configuration and simplify future maintenance.
## Individual Comments
### Comment 1
<location> `docs/automated-cross-platform-packaging.md:412` </location>
<code_context>
Here is the complete `.goreleaser.yaml` with both Linux and macOS
-configurations:
+configurations. It relies on the `goreleaser-rust` plugin to simplify
+cross-compiling:
```yaml
</code_context>
<issue_to_address>
This line, as part of the previous paragraph, exceeds the 80 column limit.
Ensure that all lines in paragraphs and bullet points are wrapped to 80 columns or fewer.
</issue_to_address>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: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (4)
.goreleaser.yaml(3 hunks)docs/automated-cross-platform-packaging.md(6 hunks)packaging/linux/preremove.sh(1 hunks)packaging/shared/config.toml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
docs/**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
docs/**/*.md: Reference: Use the markdown files within thedocs/directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Update: When new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve, proactively update the relevant file(s) in thedocs/directory to reflect the latest state. Ensure the documentation remains accurate and current.
Files:
docs/automated-cross-platform-packaging.md
**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.md: Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Validate Markdown files usingmake markdownlint.
Runmake fmtafter any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by runningmake nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks must be wrapped at 120 columns.
Tables and headings must not be wrapped.
Use dashes (-) for list bullets.
Use GitHub-flavoured Markdown footnotes ([^1]) for references and footnotes.
Files:
docs/automated-cross-platform-packaging.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
docs/automated-cross-platform-packaging.md
🔇 Additional comments (6)
packaging/shared/config.toml (1)
3-4: Retain the added clarification; it increases user understanding.The new comments accurately describe that an empty token disables GitHub integration and introduce no functional risk.
packaging/linux/preremove.sh (1)
4-11: Guard correctly against non-systemd environments.The combined
command -v systemctland runtime directory check avoids failures on systems without systemd while still stopping/disabling the service when relevant. Good defensive scripting..goreleaser.yaml (4)
10-15: Anchor reuse is sound; ensurecargotargets compile on CI.The target matrix covers the required Linux and macOS triples. Verify the CI runner has corresponding Rust targets installed (
rustup target add …) before invoking GoReleaser.
29-30: Reference the shared config path consistently; looks correct.The archive now ships
packaging/shared/config.toml, matching the new unified location.
54-55: Ensure the daemon package still installs the config astype: config.
nfpms.contentskeeps the correct mapping. Confirm ownership/permissions through a post-install test.
3-5: Pin the Rust plugin version for deterministic buildsAdd a
versionfield so Goreleaser doesn’t track the plugin’s latest release and risk unexpected breakage.• File:
.goreleaser.yaml
• Section:pluginsApply the diff:
plugins: - name: rust + version: vX.Y.Z # pin to the latest stable releaseVerify the actual latest stable tag on the goreleaser-plugin-rust GitHub and update deliberately.
There was a problem hiding this comment.
Actionable comments posted: 1
📜 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 (1)
crates/comenq/Cargo.toml(1 hunks)
🔇 Additional comments (1)
crates/comenq/Cargo.toml (1)
19-19: Loosen the patch pin onrstest
"0.18.0"locks you to one patch release despite the comment inviting patch updates. Replace with"0.18"to receive any 0.18.* bug-fixes automatically.-rstest = "0.18.0" +rstest = "0.18"Likely an incorrect or invalid review comment.
| [dev-dependencies] | ||
| rstest = "0.18.0" | ||
| tempfile = "3.10" # latest 3.x at time of writing; update as new patch versions release |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Promote dev-dependencies to the workspace to avoid duplication
Multiple crates will likely need rstest and tempfile for tests. Declare them once in the root Cargo.toml under [workspace.dependencies] (or [workspace.dev-dependencies] when stabilised) and delete these lines to keep versions synchronised across crates.
-[dev-dependencies]
-rstest = "0.18.0"
-tempfile = "3.10" # latest 3.x at time of writing; update as new patch versions release
+# dev-dependencies declared at workspace level🤖 Prompt for AI Agents
In crates/comenq/Cargo.toml at lines 18 to 20, the dev-dependencies rstest and
tempfile are declared locally, causing potential duplication across crates. Move
these dependencies to the root workspace Cargo.toml under
[workspace.dependencies] or [workspace.dev-dependencies] if supported, then
remove these lines from this file to centralize and synchronize versions across
all crates.
There was a problem hiding this comment.
Actionable comments posted: 3
🔭 Outside diff range comments (1)
crates/comenqd/Cargo.toml (1)
1-4: Downgrade theeditionto2021unless the 2024 edition is explicitly requiredThe Rust 2024 edition is not yet stabilised on the stable toolchain. Setting
edition = "2024"forces nightly and will break users building with stable CI images. Drop back to"2021"or gate the crate behind a nightly feature flag.
♻️ Duplicate comments (1)
crates/comenq/Cargo.toml (1)
18-20: Local declaration still required—previous comment superseded.Referencing workspace versions here is correct; Cargo does not pull a dependency into a crate automatically. The earlier review asking for removal is obsolete. Keep these lines.
📜 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 (8)
Cargo.toml(2 hunks)crates/comenq/Cargo.toml(1 hunks)crates/comenqd/Cargo.toml(1 hunks)crates/comenqd/src/config.rs(2 hunks)crates/comenqd/src/daemon.rs(2 hunks)crates/comenqd/src/logging.rs(1 hunks)docs/automated-cross-platform-packaging.md(7 hunks)tests/support/env_guard.rs(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.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/support/env_guard.rscrates/comenqd/src/logging.rscrates/comenqd/src/daemon.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:
tests/support/env_guard.rscrates/comenqd/src/logging.rscrates/comenqd/src/daemon.rscrates/comenqd/src/config.rs
Cargo.toml
📄 CodeRabbit Inference Engine (AGENTS.md)
Cargo.toml: Use explicit version ranges inCargo.tomland keep dependencies up-to-date.
Mandate caret requirements for all dependencies: All crate versions specified inCargo.tomlmust 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
docs/**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
docs/**/*.md: Reference: Use the markdown files within thedocs/directory as a knowledge base and source of truth for project requirements, dependency choices, and architectural decisions.
Update: When new decisions are made, requirements change, libraries are added/removed, or architectural patterns evolve, proactively update the relevant file(s) in thedocs/directory to reflect the latest state. Ensure the documentation remains accurate and current.
Files:
docs/automated-cross-platform-packaging.md
**/*.md
📄 CodeRabbit Inference Engine (AGENTS.md)
**/*.md: Documentation must use en-GB-oxendict spelling and grammar. (EXCEPTION: the naming of the "LICENSE" file, which is to be left unchanged for community consistency.)
Validate Markdown files usingmake markdownlint.
Runmake fmtafter any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by runningmake nixie.
Markdown paragraphs and bullet points must be wrapped at 80 columns.
Code blocks must be wrapped at 120 columns.
Tables and headings must not be wrapped.
Use dashes (-) for list bullets.
Use GitHub-flavoured Markdown footnotes ([^1]) for references and footnotes.
Files:
docs/automated-cross-platform-packaging.md
⚙️ CodeRabbit Configuration File
**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")
- Use en-GB-oxendict (-ize / -our) spelling and grammar
- Paragraphs and bullets must be wrapped to 80 columns, except where a long URL would prevent this (in which case, silence MD013 for that line)
- Code blocks should be wrapped to 120 columns.
- Headings must not be wrapped.
- Documents must start with a level 1 heading
- Headings must correctly increase or decrease by no more than one level at a time
- Use GitHub-flavoured Markdown style for footnotes and endnotes.
- Numbered footnotes must be numbered by order of appearance in the document.
Files:
docs/automated-cross-platform-packaging.md
🔇 Additional comments (13)
Cargo.toml (1)
47-54: 👍 Feature set extension looks correct.Adding the
jsonfeature totracing-subscriberand surfacing shared dev-dependencies at the workspace root matches the coding-guideline requirements. Versions use caret semantics implicitly, so no action needed.crates/comenqd/src/daemon.rs (2)
248-252: Prune the unusedUnixListenerimport—good cleanup.Replacing the dead import with the required
UnixStreamsilences Clippy and keeps the test module minimal.
349-351: Drop unnecessarymutbindings—nice catch.Removing
mutfromwriter_rxavoids needless mutability and pleases the lint suite.crates/comenqd/src/logging.rs (1)
69-72: Unsafe block is justified and documented.Nightly marking
set_varas unsafe is an oddity; the accompanying comment clarifies the rationale, and the scope is tightly limited to tests. No further change necessary.crates/comenqd/Cargo.toml (1)
23-26: Adopt workspace-scoped dev-dependencies consistentlyReplace the hard-coded versions with
workspace = true, aligning this crate with the rest of the workspace. The change removes duplication and centralises version management.crates/comenqd/src/config.rs (2)
23-23: AddClonederive – LGTM
Confignow implementsClone, enabling cheap duplication in tests or async contexts without touching interior mutability. All contained fields already implementClone, so this is harmless.
129-130: Approve removal ofset_env_varre-export
All remaining calls toset_env_varlive intests/support/env_guard.rs. No tests or benchmarks outside that module reference it. Removal of the re-export is safe.docs/automated-cross-platform-packaging.md (6)
79-80: No actionable issues spotted in this path update.
168-170: Path correction looks soundThe package now ships the shared configuration from the canonical location.
236-244: Preremove example now mirrors real scriptThe guard for
systemctlprevents failures on non-systemd hosts. Good job.
420-433: Solid addition of plugin block and YAML anchorDeclaring the
rustplugin once and re-using&targetskeeps the final
configuration DRY and readable.
446-447: No further issues observed with the archive file list.
471-473: Configuration path consistently updated in the NFPM section.
| tempfile = { workspace = true } | ||
| yaque = { workspace = true } | ||
| wiremock = "0.6" | ||
| wiremock = { workspace = true } | ||
| octocrab = { workspace = true } | ||
| serde_yaml = "0.9" | ||
| serde_yaml = { version = "0.9", default-features = false } | ||
| rstest = { workspace = true } | ||
| serial_test = { workspace = true } |
There was a problem hiding this comment.
🧹 Nitpick (assertive)
Keep workspace dev-dependency metadata lean.
Listing tempfile, wiremock, serde_yaml, rstest, and serial_test twice (here and again under [workspace.dependencies]) invites divergence if one side drifts. Declare the versions only once at workspace level and let individual crates reference them with workspace = true.
No functional breakage, but tidier metadata reduces maintenance overhead.
🤖 Prompt for AI Agents
In Cargo.toml lines 20 to 26, remove the duplicate version declarations for
tempfile, wiremock, serde_yaml, rstest, and serial_test from the
dev-dependencies section since they are already declared under
[workspace.dependencies]. Keep only the workspace = true references here to
ensure a single source of truth for these dependencies and reduce maintenance
overhead.
c6fb3b4 to
81be798
Compare
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
Stale |
Summary
github_tokendisables integrationTesting
make fmtmake lintmake testmake markdownlintmake nixiehttps://chatgpt.com/codex/tasks/task_e_688bdbaa192c8322996bf4ba6ac23484
Summary by Sourcery
Apply review feedback to packaging: improve the Linux preremove script, migrate the default config to a shared directory, switch to the goreleaser-rust plugin for builds, and clarify GitHub token behavior.
Bug Fixes:
Enhancements:
Documentation: