Skip to content

Add coverage test target#58

Merged
leynos merged 6 commits intomainfrom
codex/add-test-cov-target-to-makefile
Aug 13, 2025
Merged

Add coverage test target#58
leynos merged 6 commits intomainfrom
codex/add-test-cov-target-to-makefile

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Aug 9, 2025

Summary

  • add llvm-tools-preview component to rust toolchain so llvm-cov is available for coverage

Testing

  • make fmt
  • make lint
  • make test
  • make test-cov

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

Summary by Sourcery

Introduce a coverage test target by adding llvm-tools-preview to the Rust toolchain and updating the Makefile and documentation to support running tests with coverage

New Features:

  • Add test-cov Makefile target to run tests with coverage and print a text report

Enhancements:

  • Include llvm-tools-preview component in rust-toolchain.toml for llvm-cov support

Documentation:

  • Document the test-cov target in README.md

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Aug 9, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduce a new coverage testing workflow by adding the llvm-tools-preview component to the Rust toolchain, creating a test-cov Makefile target that uses cargo llvm-cov, and updating documentation to reflect the new target.

File-Level Changes

Change Details Files
Add test-cov Makefile target for coverage reporting
  • Include test-cov in .PHONY list
  • Define test-cov rule invoking cargo llvm-cov with warnings as errors and summary-only output
Makefile
Enable LLVM coverage tooling in Rust toolchain
  • Add llvm-tools-preview to toolchain components
rust-toolchain.toml
Document new coverage test target in README
  • Add make test-cov description to usage section
README.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 9, 2025

Summary by CodeRabbit

  • Tests

    • Added test coverage commands with optional threshold control and LCOV output.
    • Clean now removes coverage artefacts.
  • Documentation

    • Documented new coverage commands and usage.
    • Improved hyphen rendering, formatting, and British spelling.
  • Chores

    • Ignored coverage directory in version control.
    • Enabled LLVM tools in the Rust toolchain configuration.

Walkthrough

Add workspace-wide coverage targets to the Makefile (text and LCOV), introduce public COV_MIN threshold, require cargo-llvm-cov and llvm-tools-preview, ignore and clean the coverage directory, and document the new targets in README.md.

Changes

Cohort / File(s) Change Summary
Makefile: coverage targets & variable
Makefile
Add public variable COV_MIN (default 0); add .PHONY entries test-cov and test-cov-lcov; implement test-cov (ensure cargo-llvm-cov, workspace text summary) and test-cov-lcov (ensure cargo-llvm-cov, create coverage/, emit coverage/lcov.info) both using --fail-under-lines $(COV_MIN); update clean to remove coverage/ and run coverage cleanup when available.
Docs: README updates
README.md
Document make test-cov and make test-cov-lcov under Building and testing; fix hyphen escaping and minor wording (optimised).
Toolchain: add LLVM tools
rust-toolchain.toml
Add llvm-tools-preview to components alongside rustfmt and clippy on nightly-2025-07-22.
VCS ignore
.gitignore
Add coverage/ to ignore coverage artifacts.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant Make as Makefile
    participant Cargo as cargo-llvm-cov
    participant FS as Filesystem

    Dev->>Make: make test-cov / make test-cov-lcov
    Make->>Cargo: verify cargo-llvm-cov installed
    Make->>Cargo: run cargo-llvm-cov --workspace --all-features --summary-only --text --fail-under-lines $(COV_MIN)
    alt LCOV requested
        Make->>Cargo: run cargo-llvm-cov --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN)
        Cargo->>FS: write coverage/lcov.info
    end
    Cargo-->>Make: return coverage summary / status
    Make-->>Dev: exit status and report
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Poem

Add a target, run the cov parade,
Nightly summons llvm-tools to aid.
Fail the build if lines fall thin,
Save lcov output when you need to win.
🦀📈

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch codex/add-test-cov-target-to-makefile

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @leynos - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6f2893d and 80b230f.

📒 Files selected for processing (3)
  • Makefile (2 hunks)
  • README.md (1 hunks)
  • rust-toolchain.toml (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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 using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by running make 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:

  • README.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • 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:

  • README.md
🔍 MCP Research (1 server)

Deepwiki:

  • The CI workflow already includes a step for generating coverage using a shared GitHub Action that outputs coverage in lcov format and uploads it to CodeScene, implying the necessary tooling for llvm-cov might be handled by that action. (.github/workflows/ci.yml)
  • The addition of test-cov target fits into the existing Rust workspace and Makefile workflow by providing a local coverage testing command consistent with CI coverage generation. (Development Guide wiki page)
⏰ 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)
rust-toolchain.toml (1)

3-3: Enable LLVM tools for coverage (LGTM).

The llvm-tools-preview component is required by cargo-llvm-cov to access llvm-profdata/llvm-cov. Keep this.

Comment thread Makefile Outdated
Comment thread Makefile Outdated
Comment thread README.md Outdated
Comment thread rust-toolchain.toml
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🔭 Outside diff range comments (1)
Makefile (1)

16-21: Clean coverage artefacts with the clean target.

Remove the coverage/ directory during cleaning to keep the tree tidy.

Outside the selected lines, change the clean recipe to:

clean: ## Remove build artefacts
	$(CARGO) clean
	rm -rf coverage
♻️ Duplicate comments (1)
README.md (1)

17-20: Document the cargo-llvm-cov prerequisite via a footnote and reference it from the target.

Append a footnote marker to the test-cov bullet and add a footnote block explaining how to install cargo-llvm-cov and that llvm-tools-preview is required. Wrap lines at 80 columns and validate with markdownlint and fmt.

Apply this diff within the changed section:

- - `make test-cov` &ndash; run tests with coverage and print a text report
+ - `make test-cov` &ndash; run tests with coverage and print a text report[^cov]

Add this footnote block at the end of the file:

[^cov]: Install the `cargo-llvm-cov` subcommand: `cargo install cargo-llvm-cov`.
       Ensure the Rust toolchain includes the `llvm-tools_preview` component
       (configured in `rust-toolchain.toml`).

Then run:

#!/bin/bash
set -euo pipefail
make markdownlint
make fmt
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 80b230f and d72a666.

📒 Files selected for processing (2)
  • Makefile (2 hunks)
  • README.md (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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 using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by running make 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:

  • README.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • 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:

  • README.md
🔍 MCP Research (1 server)

Deepwiki:

  • GitHub Action step "Test and Measure Coverage": uses leynos/shared-actions/.github/actions/generate-coverage and produces lcov.info in lcov format (repository action path: leynos/shared-actions/.github/actions/generate-coverage)
  • Document "Development Guide" (wiki): contains a "Coverage Generation" section that notes CI generates coverage in lcov format
  • The underlying command(s) run by the shared generate-coverage action are not exposed in the retrieved snippets, so the exact local cargo/coverage command sequence used by CI could not be directly determined from the returned content.
🔇 Additional comments (3)
Makefile (3)

1-1: Declare new LCOV target in .PHONY.

The PHONY list correctly includes test-cov-lcov. No further action.


22-28: Hardened coverage target is correct and aligns with workspace-wide runs.

Pre‑flight check, --workspace, summary text output, and coverage gate via --fail-under-lines $(COV_MIN) are all on point.


29-36: Produce LCOV locally to mirror CI artefacts.

Generating coverage/lcov.info with a threshold aligns with the documented CI workflow that consumes LCOV. This satisfies organisational guidance.

Comment thread Makefile Outdated
Comment thread README.md Outdated
leynos added 2 commits August 13, 2025 00:53
Add the coverage/ directory to the gitignore to prevent accidentally committing local coverage reports.
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Bot Settings | Greptile

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Aug 13, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Aug 13, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Aug 13, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (1)
Makefile (1)

23-36: Deduplicate the pre-flight check and add a fresh-coverage clean before runs.

Avoid repeating the cargo-llvm-cov presence check and ensure each coverage run starts clean to prevent stale merges. Also align with CI’s LCOV output path per organisational standards.

Apply this diff within the selected lines:

 test-cov: ## Run tests with coverage and print report
-	@command -v cargo-llvm-cov >/dev/null || { \
-	  echo "error: cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; \
-	  exit 127; \
-	}
+	$(CHECK_CARGO_LLVM_COV)
+	$(CARGO) llvm-cov clean --workspace
 	RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

 test-cov-lcov: ## Run tests with coverage and write LCOV to coverage/lcov.info
-	@command -v cargo-llvm-cov >/dev/null || { \
-	  echo "error: cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; \
-	  exit 127; \
-	}
+	$(CHECK_CARGO_LLVM_COV)
 	mkdir -p coverage
+	$(CARGO) llvm-cov clean --workspace
 	RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

Add this macro near the variable block:

define CHECK_CARGO_LLVM_COV
	@command -v cargo-llvm-cov >/dev/null || { \
	  echo "error: cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov --locked"; \
	  exit 127; \
	}
endef

Run the following script to verify environment and CI alignment with organisational standards (LCOV artefacts and llvm-tools availability):

#!/bin/bash
set -euo pipefail

echo "Checking that llvm-tools-preview is enabled in rust-toolchain.toml..."
rg -n "llvm-tools-preview" || { echo "Missing llvm-tools-preview in rust-toolchain.toml"; exit 1; }

echo "Checking CI expects LCOV and/or CodeScene upload..."
rg -nI "lcov|LCOV|codescene|CodeScene|coverage/lcov\.info" .github/workflows || {
  echo "Warning: CI workflow files do not reference LCOV or CodeScene explicitly"; exit 0;
}

echo "Checking README mentions coverage targets and COV_MIN..."
rg -nI "test-cov|test-cov-lcov|COV_MIN" README.md || {
  echo "README lacks docs for coverage targets or COV_MIN"; exit 0;
}

echo "Done."
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d72a666 and 6fae294.

📒 Files selected for processing (2)
  • .gitignore (1 hunks)
  • Makefile (1 hunks)
🧰 Additional context used
🔍 MCP Research (1 server)

Deepwiki:

  • Page: Building and Testing — the CI is configured to generate coverage in LCOV format for CodeScene integration; the CI pipeline includes a "Coverage Measurement" step that produces LCOV-format coverage data and uploads it to CodeScene (see .github/workflows/ci.yml references in the page)
  • Page: Development Guide — the project's CI quality gates include a coverage step that expects LCOV-format coverage artifacts (used by CodeScene); coverage collection is part of CI's validated pipeline (references to coverage/LCOV and CodeScene upload appear in the CI/docs sections)
🔇 Additional comments (2)
.gitignore (1)

1-1: Ignore generated coverage artefacts — LGTM.

Ignore the coverage/ directory to keep generated LCOV and reports out of version control. This aligns with the new coverage targets.

Makefile (1)

1-1: Declare new coverage targets as phony — LGTM.

Expose test-cov and test-cov-lcov in .PHONY to avoid filename collisions.

Comment thread Makefile Outdated
CLIPPY_FLAGS ?= --all-targets --all-features -- -D warnings
MDLINT ?= markdownlint
NIXIE ?= nixie
COV_MIN ?= 0
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Document the coverage gate variable.

Document COV_MIN in README (and/or the help output) so contributors know how to enforce local thresholds (e.g., “make test-cov COV_MIN=75”).

🤖 Prompt for AI Agents
In Makefile around line 9 (COV_MIN ?= 0), document the COV_MIN coverage gate
variable by adding a short entry to the repository README and updating the
Makefile help output; state its purpose, default value (0), and show usage
example such as “make test-cov COV_MIN=75” to enforce a 75% threshold. In README
add one sentence in the testing/CI section and an example command line; in the
Makefile add or update the help target to list COV_MIN and its default so
contributors see it when running “make help”.

Comment thread Makefile
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🔭 Outside diff range comments (1)
Makefile (1)

59-61: Expose variable defaults in the help output (optional).

Augment help to show key variables and defaults so the coverage gate is discoverable from make help:

 help: ## Show available targets
 	@grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
-	awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf "  %-20s %s\n", $$1, $$2}'
+	awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf "  %-20s %s\n", $$1, $$2}'; \
+	echo; echo "Variables:"; \
+	printf "  %-20s %s\n" "COV_MIN" "Minimum line coverage gate (default: $(COV_MIN))"
♻️ Duplicate comments (2)
README.md (1)

17-20: Document the cargo-llvm-cov prerequisite with a footnote and keep within 80 columns.

Append a footnote marker to the test-cov bullet and add an installation note to the end of the file. This makes the external subcommand requirement explicit and aligns with the docs style guide.

Apply this diff within the selected lines:

- - `make test-cov` &ndash; run tests with coverage and print a text report.
+ - `make test-cov` &ndash; run tests with coverage and print a text report[^cov].

Add the following footnote block at the end of README.md (outside the selected range), wrapped at 80 columns:

[^cov]: Install the `cargo-llvm-cov` subcommand: `cargo install cargo-llvm-cov`.
       Ensure the Rust toolchain includes the `llvm-tools-preview` component
       (configured in `rust-toolchain.toml`).

Verify formatting and linting:

#!/bin/bash
set -euo pipefail
make markdownlint
make fmt
Makefile (1)

35-38: Mention the COV_MIN gate in the LCOV help text.

Apply this diff to mirror the README note:

-test-cov-lcov: ## Run tests with coverage and write LCOV to coverage/lcov.info
+test-cov-lcov: ## Run tests with coverage and write LCOV to coverage/lcov.info; honours COV_MIN
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6fae294 and cad9e65.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • README.md (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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 using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by running make 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:

  • README.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • 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:

  • README.md
🪛 LanguageTool
README.md

[style] ~15-~15: Would you like to use the Oxford spelling “optimized”? The spelling ‘optimised’ is also correct.
Context: ...ebug/-make release&ndash; produce optimised release binaries -make test` – ...

(OXFORD_SPELLING_Z_NOT_S)

🔍 Additional research (Context7, Deepwiki)

Summary of relevant context found for reviewing the PR:

  • Cargo external-subcommand behavior: Cargo will invoke an external tool named cargo- from the user's PATH (relevant to cargo-llvm-cov usage in Makefile targets).,

  • Documentation for cargo subcommands and environment variables (useful to verify Makefile assumptions about workspace/all-features flags and passing args to cargo subcommands).

  • Repository wiki/docs (comprehensive project docs) covering build/test workflows, CI, packaging, and that the project previously used tarpaulin — confirms related PRs' motivation to switch to cargo-llvm-cov and the README/Makefile changes align with existing CI/dev workflow. Key points: Make targets wrapping cargo commands, test steps in README, and packaging/toolchain guidance.,

🔇 Additional comments (2)
README.md (1)

4-6: Additions use real hyphens and maintain architectural clarity — LGTM.

Makefile (1)

31-39: Coverage targets are well-formed and enforce thresholds — LGTM.

Comment thread README.md Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

♻️ Duplicate comments (2)
Makefile (2)

1-1: Declare PHONY targets: good catch and now complete.

Include of test-cov and test-cov-lcov in .PHONY aligns with earlier feedback and avoids stale-target mismatches.


9-10: Expose COV_MIN in CLI help for discoverability.

Surface the default and usage in make help so contributors see the gate without reading the README.

Apply this diff outside the selected range to extend the help output:

 help: ## Show available targets
 	@grep -E '^[a-zA-Z_-]+:.*?##' $(MAKEFILE_LIST) | \
 	awk 'BEGIN {FS=":"; printf "Available targets:\n"} {printf "  %-20s %s\n", $$1, $$2}'
+	@echo
+	@echo "Environment:"
+	@echo "  COV_MIN=$(COV_MIN)  Minimum line coverage percentage for coverage targets"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between cad9e65 and 4e71bc7.

📒 Files selected for processing (2)
  • Makefile (1 hunks)
  • README.md (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.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 using make markdownlint.
Run make fmt after any documentation changes to format all Markdown files and fix table markup.
Validate Mermaid diagrams in Markdown files by running make 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:

  • README.md

⚙️ CodeRabbit Configuration File

**/*.md: * Avoid 2nd person or 1st person pronouns ("I", "you", "we")

  • Use en-GB-oxendict (-ize / -our) spelling and grammar
  • 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:

  • README.md
🪛 LanguageTool
README.md

[style] ~15-~15: Would you like to use the Oxford spelling “optimized”? The spelling ‘optimised’ is also correct.
Context: ...ebug/-make release&ndash; produce optimised release binaries -make test` – ...

(OXFORD_SPELLING_Z_NOT_S)

🔍 Additional research (Context7)

Summary of additional context found:

  • Makefile adds two coverage targets (test-cov, test-cov-lcov), a public COV_MIN variable (default 0), and cleans a coverage/ dir; README documents using make test-cov / make test-cov-lcov and how to set COV_MIN (e.g., COV_MIN=75).

  • rust-toolchain.toml now includes llvm-tools-preview (so llvm-cov is available); .gitignore ignores coverage/.

  • CI/workflows reference coverage generation producing LCOV (lcov.info) and upload to CodeScene via a shared generate-coverage action — this implies use of an lcov-producing tool (e.g., cargo-llvm-cov) in CI. Related PR (leynos/lille#106) also switches CI to cargo-llvm-cov.,

Sources used: Context7 read_wiki_structure, read_wiki_contents, ask_question.

🔇 Additional comments (3)
Makefile (1)

23-26: Clean coverage artefacts: LGTM.

Invoke cargo llvm-cov clean opportunistically and remove coverage/ to avoid stale merges.

README.md (2)

4-5: Use of en-dashes and hyphenation: LGTM.

Hyphenation for “daemon-client” and “cooling-off” reads cleanly and follows the style.


15-15: En‑GB spelling retained: LGTM.

“Optimised” matches the repository’s en‑GB requirement.

Comment thread Makefile
Comment on lines +11 to +16
define CHECK_CARGO_LLVM_COV
@command -v cargo-llvm-cov >/dev/null || { \
echo "error: cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; \
exit 127; \
}
endef
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Harden the pre-flight by checking llvm-tools-preview.

Fail fast with a clear message when the toolchain component is missing.

Apply this diff:

 define CHECK_CARGO_LLVM_COV
 	@command -v cargo-llvm-cov >/dev/null || { \
 	echo "error: cargo-llvm-cov not found. Install with: cargo install cargo-llvm-cov"; \
 	exit 127; \
 	}
+	@rustup component list --installed | grep -q '^llvm-tools-preview ' || { \
+	echo "error: rust toolchain component 'llvm-tools-preview' not installed. Install with: rustup component add llvm-tools-preview"; \
+	exit 127; \
+	}
 endef
🤖 Prompt for AI Agents
In Makefile around lines 11 to 16, the pre-flight check only verifies the
presence of the cargo-llvm-cov binary but doesn't verify the Rust toolchain
component llvm-tools-preview; add a check that `rustup component list
--installed | grep -q '^llvm-tools-preview$'` (or use `rustup component add
--toolchain $(RUST_TOOLCHAIN) --list` alternative) and if missing print a clear
error message instructing to install it (e.g., `rustup component add
llvm-tools-preview`) and exit with non-zero status so the make target fails
fast.

Comment thread Makefile
Comment on lines +31 to +34
$(CHECK_CARGO_LLVM_COV)
RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

test-cov-lcov: ## Run workspace-wide tests with coverage and write LCOV to coverage/lcov.info
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Optionally include doctests in coverage.

Include doctests in the coverage run to align numbers with CI expectations if doctests exist.

Apply this diff:

-RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)
+RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --doctests --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

If CI excludes doctests, skip this to keep parity.


🏁 Script executed:

#!/usr/bin/env bash
set -e
echo "Searching for code fences in Rust files to detect doctests"
rg -n '```' --glob '*.rs' | head -n 20

Length of output: 924


Include doctests in coverage run

Add the --doctests flag to the test-cov target so that code examples in documentation count toward coverage. Update the Makefile as follows:

• File: Makefile
• Target: test-cov

-RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)
+RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --doctests --summary-only --text --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

Skip this change only if your CI explicitly excludes doctests to maintain parity.

🤖 Prompt for AI Agents
In Makefile around lines 31 to 34, the test-cov target invokes `cargo llvm-cov`
but omits the `--doctests` flag so documentation examples aren't included in
coverage; update the test-cov target invocation to add `--doctests` to the
llvm-cov command line (keeping existing flags and variables) so doctests are
included in the workspace-wide coverage run.

Comment thread Makefile
Comment on lines +35 to 39
$(CHECK_CARGO_LLVM_COV)
mkdir -p coverage
RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

target/%/$(APP): ## Build binary in debug or release mode
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Generate LCOV with doctests (optional) and ensure deterministic output path.

Mirror the text run by enabling doctests if desired; output path is correct.

Apply this diff:

-RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)
+RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --doctests --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)

🌐 Web query:

Does cargo llvm-cov support the --doctests flag?

💡 Result:

Yes — cargo-llvm-cov has a --doctests option (it’s marked unstable). Use cargo llvm-cov --doctests to include doc-tests; note that the --doc subcommand automatically enables doctests and that some features (e.g. remap-path-prefix) are not fully compatible with doctest. Also, when merging/generating reports you may need to pass --doctests to the report command as well. (docs.rs, github.com)

Citations:


Enable doctest coverage in LCOV report
Add the --doctests flag to include documentation tests; keep the output path as coverage/lcov.info.

  • File: Makefile
  • Target: test-cov-lcov
  • Lines: 35–39
-RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)
+RUSTFLAGS="-D warnings" $(CARGO) llvm-cov --workspace --all-features --doctests --lcov --output-path coverage/lcov.info --fail-under-lines $(COV_MIN) $(BUILD_JOBS)
🤖 Prompt for AI Agents
In Makefile around lines 35 to 39, the test-cov-lcov target omits the --doctests
flag so documentation tests are not included in the LCOV report; update the
llvm-cov invocation to add the --doctests flag while keeping the output path as
coverage/lcov.info so doctests are collected into the same LCOV file.

Comment thread README.md
Comment on lines +17 to +20
- `make test-cov` &ndash; run workspace-wide tests with coverage and print a
text report. Set `COV_MIN=75` to fail if line coverage drops below 75%
- `make test-cov-lcov` &ndash; run workspace-wide tests with coverage and write
`coverage/lcov.info`. Also honours `COV_MIN`
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick (assertive)

Document the cargo-llvm-cov prerequisite via a footnote.

Add a footnote marker to coverage targets and append the installation note. Keep wrapping at 80 columns.

Apply this diff:

-- `make test-cov` &ndash; run workspace-wide tests with coverage and print a
+- `make test-cov` &ndash; run workspace-wide tests with coverage and print a
   text report. Set `COV_MIN=75` to fail if line coverage drops below 75%
-- `make test-cov-lcov` &ndash; run workspace-wide tests with coverage and write
+- `make test-cov-lcov` &ndash; run workspace-wide tests with coverage and write
   `coverage/lcov.info`. Also honours `COV_MIN`

Append this block at the end of the file:

[^cov]: Install the `cargo-llvm-cov` subcommand: `cargo install cargo-llvm-cov`.
       Ensure the Rust toolchain includes the `llvm-tools_preview` component
       (configured in `rust-toolchain.toml`).
🤖 Prompt for AI Agents
In README.md around lines 17 to 20, the coverage target entries lack a footnote
marker and the installation note for cargo-llvm-cov; add a footnote marker (e.g.
[^cov]) to both `make test-cov` and `make test-cov-lcov` lines, then append the
supplied footnote block at the end of the file exactly as given, wrapped at ~80
columns, mentioning installation via `cargo install cargo-llvm-cov` and the need
for the `llvm-tools_preview` component in rust-toolchain.toml.

@leynos leynos merged commit 4df0b66 into main Aug 13, 2025
1 of 2 checks passed
@leynos leynos deleted the codex/add-test-cov-target-to-makefile branch August 13, 2025 18:29
Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant