Skip to content

Add ratcheting option to generate-coverage action#24

Merged
leynos merged 4 commits intomainfrom
codex/integrate-ratcheting-coverage-into-generate-coverage
Jul 6, 2025
Merged

Add ratcheting option to generate-coverage action#24
leynos merged 4 commits intomainfrom
codex/integrate-ratcheting-coverage-into-generate-coverage

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jul 6, 2025

Summary

  • add with-ratchet option to generate-coverage
  • track Rust and Python baselines separately
  • output coverage percentage from language runners
  • document new behaviour and bump version

Testing

  • python -m py_compile scripts/generate_coverage/run_rust.py scripts/generate_coverage/run_python.py

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

Summary by Sourcery

Add optional ratcheting support to the generate-coverage action by tracking separate Rust and Python baselines, enforcing coverage retention, emitting coverage percentages, and updating documentation.

New Features:

  • Add with-ratchet option to fail the action if coverage drops below the stored baseline
  • Support separate Rust and Python baseline files for coverage ratcheting
  • Expose coverage percentage as an output from both Rust and Python coverage runners

Enhancements:

  • Update coverage scripts to extract and emit coverage percentages

CI:

  • Add GitHub Action steps to restore, ratchet, and save Rust and Python coverage baselines

Documentation:

  • Document new ratcheting options and baseline inputs in the action README
  • Bump action version to v1.3.0 in CHANGELOG

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 6, 2025

Reviewer's Guide

This PR introduces optional ratcheting support for the generate-coverage action—tracking and enforcing separate Rust and Python coverage baselines—enhances both runners to extract and expose coverage percentages, and updates documentation and version accordingly.

Class diagram for updated run_rust.py and run_python.py scripts

classDiagram
    class run_rust {
        +main(output_path, features, fmt, with_default)
        +get_cargo_coverage_cmd(fmt, out, features, with_default)
        +extract_percent(output)
    }
    class run_python {
        +main(output_path, lang, fmt)
        +coverage_cmd_for_fmt(fmt, out)
        +percent_from_xml(xml_file)
    }
Loading

Flow diagram for ratcheting logic in generate-coverage action

flowchart TD
    Start([Start])
    Detect[Detect language]
    RatchetCheck{with-ratchet enabled?}
    LangCheck{Language: Rust, Python, or Mixed?}
    RestoreBaseline[Restore baseline from cache]
    RunCoverage[Run coverage script]
    ExtractPercent[Extract coverage percent]
    Ratchet[Run ratchet_coverage.py]
    SaveBaseline[Save new baseline to cache]
    End([End])

    Start --> Detect --> RatchetCheck
    RatchetCheck -- No --> RunCoverage
    RatchetCheck -- Yes --> LangCheck
    LangCheck -- Rust or Mixed --> RestoreBaseline
    LangCheck -- Python or Mixed --> RestoreBaseline
    RestoreBaseline --> RunCoverage
    RunCoverage --> ExtractPercent --> Ratchet
    Ratchet --> SaveBaseline --> End
    RunCoverage --> End
Loading

File-Level Changes

Change Details Files
Implement ratcheting with separate Rust and Python baselines
  • Add with-ratchet, baseline-rust-file and baseline-python-file inputs
  • Restore and save caches for Rust and Python baselines conditionally
  • Invoke ratchet coverage script when ratcheting is enabled
.github/actions/generate-coverage/action.yml
Extract and report Rust coverage percentage
  • Add --summary-only flag to llvm-cov invocation
  • Capture stdout, stderr, and exit code instead of direct execution
  • Implement extract_percent and write percent output
scripts/generate_coverage/run_rust.py
Extract and report Python coverage percentage
  • Generate and parse Cobertura XML for coveragepy format
  • Implement percent_from_xml and cleanup temporary XML
  • Write percent output for all formats
scripts/generate_coverage/run_python.py
Document new ratcheting behavior and bump version
  • Add with-ratchet and baseline inputs to README with example usage
  • Update CHANGELOG with v1.3.0 entry for ratcheting support
.github/actions/generate-coverage/README.md
.github/actions/generate-coverage/CHANGELOG.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 Jul 6, 2025

Summary by CodeRabbit

  • New Features

    • Introduced optional coverage ratcheting, allowing separate tracking and enforcement of Rust and Python coverage baselines.
    • Added new input options for enabling ratcheting and specifying baseline file paths.
  • Bug Fixes

    • Improved security of coverage XML parsing for Python.
    • Enhanced formatting and coverage parsing for Python and Rust reports.
  • Documentation

    • Updated documentation to reflect new ratcheting features and input parameters, including example usage.

Summary by CodeRabbit

  • New Features

    • Introduced optional coverage ratcheting for Rust and Python, enabling workflows to fail if coverage drops below a stored baseline.
    • Added support for specifying custom file paths for Rust and Python coverage baselines.
  • Documentation

    • Updated usage instructions and examples to reflect new ratcheting options and input parameters.
  • Bug Fixes

    • Improved baseline caching and management for more reliable ratcheting behaviour.

Walkthrough

This update introduces a coverage ratcheting feature to the generate-coverage GitHub Action, allowing separate baseline tracking and enforcement for Rust and Python code coverage. The change adds new input parameters, updates documentation, modifies workflow logic for caching and comparing baselines, and enhances scripts to extract and report coverage percentages.

Changes

File(s) Change Summary
.github/actions/generate-coverage/CHANGELOG.md Added entry for version 1.3.0: introduces optional ratcheting, separate Rust/Python baselines, and improved baseline caching.
.github/actions/generate-coverage/README.md Updated documentation to describe new ratchet-related inputs and provide usage examples.
.github/actions/generate-coverage/action.yml Added inputs and workflow steps for ratcheting, baseline file management, and caching.
scripts/generate_coverage/run_python.py Added XML parsing to extract coverage percentage; outputs percent to GitHub Actions output.
scripts/generate_coverage/run_rust.py Added function to extract coverage percentage from output; outputs percent to GitHub Actions output.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Action
    participant Rust Script
    participant Python Script
    participant Baseline Cache

    User->>GitHub Action: Trigger workflow (with-ratchet enabled)
    GitHub Action->>Baseline Cache: Restore baseline files (Rust & Python)
    GitHub Action->>Rust Script: Run coverage (if Rust present)
    Rust Script->>GitHub Action: Output coverage percent
    GitHub Action->>Python Script: Run coverage (if Python present)
    Python Script->>GitHub Action: Output coverage percent
    GitHub Action->>GitHub Action: Compare coverage to baseline(s)
    alt Coverage decreased
        GitHub Action->>User: Fail workflow
    else Coverage maintained/increased
        GitHub Action->>Baseline Cache: Update and save new baseline(s)
        GitHub Action->>User: Workflow succeeds
    end
Loading

Possibly related PRs

  • Pin nightly toolchain mxd#146: Introduced the initial generate-coverage GitHub Action, laying the groundwork for coverage reporting extended by this PR.

Poem

In the meadow of code where the green bars grow,
A rabbit hops by, with coverage in tow.
Rust and Python, side by side,
Their baselines guarded, their numbers supplied.
Ratchets in place, no slipping allowed—
The code stays strong, and the bunny is proud!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 09ca2ff and 84b444a.

📒 Files selected for processing (3)
  • .github/actions/generate-coverage/CHANGELOG.md (1 hunks)
  • scripts/generate_coverage/run_python.py (3 hunks)
  • scripts/generate_coverage/run_rust.py (4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`.github/actions/*/{action.yml,README.md,CHANGELOG.md,src/,tests/}`: Each action...

.github/actions/*/{action.yml,README.md,CHANGELOG.md,src/,tests/}: Each action must have its own directory under .github/actions/, containing action.yml, README.md, src/, tests/, and CHANGELOG.md

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/CHANGELOG.md
`.github/actions/*/CHANGELOG.md`: Each action must have a CHANGELOG.md that follows SemVer-based changelog for this action only

.github/actions/*/CHANGELOG.md: Each action must have a CHANGELOG.md that follows SemVer-based changelog for this action only

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/CHANGELOG.md
🔇 Additional comments (13)
scripts/generate_coverage/run_rust.py (5)

9-9: LGTM: Required import for regex functionality.

The re module import is necessary for the new coverage percentage extraction functionality.


27-27: LGTM: Appropriate flag for summary output.

The --summary-only flag is well-suited for extracting coverage percentages without verbose output.


36-46: LGTM: Robust regex pattern and proper error handling.

The regex pattern addresses the previous review feedback by being more specific and robust. The error handling with clear messaging and appropriate exit codes is well-implemented.


66-72: LGTM: Comprehensive error handling for command execution.

The error handling covers both expected ProcessExecutionError and unexpected failures, with clear error messages and appropriate exit codes.


73-77: LGTM: Proper output handling and percentage extraction.

The implementation correctly outputs the command results, extracts the coverage percentage, and writes both file path and percentage to the GitHub Actions output.

scripts/generate_coverage/run_python.py (6)

4-4: LGTM: Security enhancement with defusedxml.

Adding defusedxml to the dependencies addresses the XML security vulnerability identified in previous reviews.


9-10: LGTM: Proper imports for new functionality.

The imports for contextlib and defusedxml.ElementTree are correctly added to support the new coverage extraction features.


40-48: LGTM: Robust XML parsing with proper error handling.

The function correctly parses Cobertura XML format, handles potential parsing errors gracefully, and returns the coverage percentage in the expected format.


51-65: LGTM: Well-implemented context manager with proper cleanup.

The context manager properly handles temporary XML file generation and ensures cleanup even if exceptions occur. The error handling for the coverage XML command is comprehensive.


87-91: LGTM: Clean integration of new functionality.

The conditional logic properly handles different coverage formats, using the context manager for coveragepy format and direct XML parsing for cobertura format.


95-95: LGTM: Correct output of coverage percentage.

The percentage is properly written to the GitHub Actions output file alongside the file path.

.github/actions/generate-coverage/CHANGELOG.md (2)

3-8: LGTM: Clear documentation of ratcheting feature.

The changelog entry accurately describes the new ratcheting functionality with separate baseline tracking for Rust and Python, along with the caching improvements.


10-13: LGTM: Proper documentation of security and quality improvements.

The changelog entry correctly documents the security enhancement with defusedxml and the formatting/parsing improvements made to the runner scripts.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in a Comment
  • Commit Unit Tests in branch codex/integrate-ratcheting-coverage-into-generate-coverage

🪧 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.
    • Explain this complex logic.
    • 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. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • 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 src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

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

Documentation and Community

  • 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
Contributor

@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 - here's some feedback:

  • Make sure the actions/cache restore/save steps handle first-run (missing baseline file) gracefully—e.g. initialize the baseline file so the cache step actually picks it up.
  • There’s a lot of duplicated if-condition logic for Rust vs Python ratcheting in action.yml—consider consolidating or templating those steps to reduce verbosity and chance for drift.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Make sure the `actions/cache` restore/save steps handle first-run (missing baseline file) gracefully—e.g. initialize the baseline file so the cache step actually picks it up.
- There’s a lot of duplicated if-condition logic for Rust vs Python ratcheting in action.yml—consider consolidating or templating those steps to reduce verbosity and chance for drift.

## Individual Comments

### Comment 1
<location> `.github/actions/generate-coverage/action.yml:77` </location>
<code_context>
+        INPUT_BASELINE_FILE: ${{ inputs.baseline-rust-file }}
+        CURRENT_PERCENT: ${{ steps.rust.outputs.percent }}
+      shell: bash
+    - name: Save Rust baseline
+      if: success() && inputs.with-ratchet == 'true' && (steps.detect.outputs.lang == 'rust' || steps.detect.outputs.lang == 'mixed')
+      uses: actions/cache@v4
+      with:
+        path: ${{ inputs.baseline-rust-file }}
+        key: ratchet-baseline-rust-${{ runner.os }}
     - name: Install uv and set the python version
       if: steps.detect.outputs.lang == 'python' || steps.detect.outputs.lang == 'mixed'
</code_context>

<issue_to_address>
Saving the baseline with the same cache key as restore may prevent updates.

GitHub Actions cache does not overwrite existing keys, so using the same key for saving and restoring may prevent updates. Use a different key for saving or implement a restore-keys strategy to ensure the baseline updates correctly.
</issue_to_address>

### Comment 2
<location> `.github/actions/generate-coverage/action.yml:115` </location>
<code_context>
+        INPUT_BASELINE_FILE: ${{ inputs.baseline-python-file }}
+        CURRENT_PERCENT: ${{ steps.python.outputs.percent }}
+      shell: bash
+    - name: Save Python baseline
+      if: success() && inputs.with-ratchet == 'true' && (steps.detect.outputs.lang == 'python' || steps.detect.outputs.lang == 'mixed')
+      uses: actions/cache@v4
+      with:
+        path: ${{ inputs.baseline-python-file }}
+        key: ratchet-baseline-python-${{ runner.os }}
     - if: steps.detect.outputs.lang == 'mixed'
       run: uv run --script scripts/generate_coverage/merge_cobertura.py
</code_context>

<issue_to_address>
Python baseline cache save uses the same key as restore, which may block updates.

Since GitHub Actions cache does not overwrite existing keys, this setup may prevent the Python baseline from being updated. Please use a different cache key strategy to ensure the baseline can be refreshed.
</issue_to_address>

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.

uses: actions/cache@v4
with:
path: ${{ inputs.baseline-rust-file }}
key: ratchet-baseline-rust-${{ runner.os }}
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.

issue (bug_risk): Saving the baseline with the same cache key as restore may prevent updates.

GitHub Actions cache does not overwrite existing keys, so using the same key for saving and restoring may prevent updates. Use a different key for saving or implement a restore-keys strategy to ensure the baseline updates correctly.

uses: actions/cache@v4
with:
path: ${{ inputs.baseline-python-file }}
key: ratchet-baseline-python-${{ runner.os }}
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.

issue (bug_risk): Python baseline cache save uses the same key as restore, which may block updates.

Since GitHub Actions cache does not overwrite existing keys, this setup may prevent the Python baseline from being updated. Please use a different cache key strategy to ensure the baseline can be refreshed.

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: 3

♻️ Duplicate comments (1)
.github/actions/generate-coverage/action.yml (1)

92-100: Address cache key strategy to enable baseline updates.

The current cache key strategy may prevent baseline updates as highlighted in past reviews. Using the same key for restore and save operations can prevent cache updates.

Consider using a more sophisticated cache key strategy:

-        key: ratchet-baseline-${{ runner.os }}-${{ github.run_id }}
-        restore-keys: ratchet-baseline-${{ runner.os }}-
+        key: ratchet-baseline-${{ runner.os }}-${{ github.run_id }}
+        restore-keys: |
+          ratchet-baseline-${{ runner.os }}-

This approach uses a unique key with the run ID for saving whilst allowing restoration from any previous baseline.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 662597c and 09ca2ff.

📒 Files selected for processing (5)
  • .github/actions/generate-coverage/CHANGELOG.md (1 hunks)
  • .github/actions/generate-coverage/README.md (2 hunks)
  • .github/actions/generate-coverage/action.yml (2 hunks)
  • scripts/generate_coverage/run_python.py (3 hunks)
  • scripts/generate_coverage/run_rust.py (4 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
`.github/actions/*/{action.yml,README.md,CHANGELOG.md,src/,tests/}`: Each action...

.github/actions/*/{action.yml,README.md,CHANGELOG.md,src/,tests/}: Each action must have its own directory under .github/actions/, containing action.yml, README.md, src/, tests/, and CHANGELOG.md

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/CHANGELOG.md
  • .github/actions/generate-coverage/README.md
  • .github/actions/generate-coverage/action.yml
`.github/actions/*/CHANGELOG.md`: Each action must have a CHANGELOG.md that follows SemVer-based changelog for this action only

.github/actions/*/CHANGELOG.md: Each action must have a CHANGELOG.md that follows SemVer-based changelog for this action only

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/CHANGELOG.md
`.github/actions/*/README.md`: Each action's README.md must contain a one-liner ...

.github/actions/*/README.md: Each action's README.md must contain a one-liner summary, table of inputs, table of outputs, usage example, and release history link to CHANGELOG
Add a DEPRECATED: banner to README and repository description when deprecating an action

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/README.md
`.github/actions/*/action.yml`: Fill in action.yml with every input and output; ...

.github/actions/*/action.yml: Fill in action.yml with every input and output; mark required ones clearly
For composite actions and path context, use "${{ github.action_path }}" when referencing sibling scripts for portability

📄 Source: CodeRabbit Inference Engine (AGENTS.md)

List of files the instruction was applied to:

  • .github/actions/generate-coverage/action.yml
🪛 Ruff (0.11.9)
scripts/generate_coverage/run_python.py

42-42: Using xml to parse untrusted data is known to be vulnerable to XML attacks; use defusedxml equivalents

(S314)


74-74: Trailing comma missing

Add trailing comma

(COM812)

🔇 Additional comments (13)
.github/actions/generate-coverage/CHANGELOG.md (1)

3-9: Well-structured changelog entry.

The changelog entry clearly documents the new ratcheting feature with proper versioning and follows the established format.

.github/actions/generate-coverage/README.md (2)

39-41: Comprehensive documentation for new ratcheting inputs.

The new input parameters are clearly documented with appropriate descriptions and sensible defaults.


90-98: Clear usage example for ratcheting feature.

The example demonstrates proper usage of the new ratcheting functionality in a concise manner.

scripts/generate_coverage/run_rust.py (4)

9-9: Import addition for regex functionality.

The re module import is correctly added to support coverage percentage extraction.


27-27: Appropriate addition of summary-only flag.

The --summary-only flag is correctly added to facilitate coverage percentage extraction from the output.


62-69: Improved error handling and output processing.

The changes to use .run(retcode=None) and explicit return code checking improve error handling. The addition of stdout output and percentage extraction is well-implemented.


73-73: Proper output of coverage percentage.

The coverage percentage is correctly written to the GitHub Actions output for use in ratcheting steps.

scripts/generate_coverage/run_python.py (3)

39-48: Well-implemented XML parsing function.

The percent_from_xml function correctly extracts coverage percentages from Cobertura XML files with proper error handling.


69-82: Proper handling of different coverage formats.

The logic correctly handles both coveragepy and other formats, generating temporary XML files when needed and extracting percentages appropriately.


85-85: Correct output of coverage percentage.

The coverage percentage is properly written to the GitHub Actions output for ratcheting functionality.

.github/actions/generate-coverage/action.yml (3)

22-34: Well-defined inputs for ratcheting functionality.

The new inputs are properly defined with clear descriptions, appropriate types, and sensible defaults.


51-70: Comprehensive baseline management steps.

The restore and ensure baseline steps are well-implemented with proper conditional logic and file creation.


78-91: Proper ratcheting logic for both languages.

The ratcheting step correctly handles both Rust and Python coverage separately based on the detected language.

Comment thread scripts/generate_coverage/run_rust.py
Comment thread scripts/generate_coverage/run_python.py Outdated
Comment thread scripts/generate_coverage/run_python.py Outdated
@leynos leynos merged commit 770fe8a into main Jul 6, 2025
1 check passed
@leynos leynos deleted the codex/integrate-ratcheting-coverage-into-generate-coverage branch July 6, 2025 14:27
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