Skip to content

Add upload-codescene-coverage action#1

Merged
leynos merged 7 commits intomainfrom
codex/create-action-for-uploading-coverage-to-codescene
Jun 18, 2025
Merged

Add upload-codescene-coverage action#1
leynos merged 7 commits intomainfrom
codex/create-action-for-uploading-coverage-to-codescene

Conversation

@leynos
Copy link
Copy Markdown
Owner

@leynos leynos commented Jun 17, 2025

Summary

  • add action to upload coverage to CodeScene
  • document usage and release history
  • make coverage path autodetect based on format

Testing

  • git status --short

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

Summary by Sourcery

Add a new composite GitHub Action (upload-codescene-coverage) to streamline uploading coverage reports to CodeScene, featuring path autodetection, CLI caching, installer checksum validation, and input validation.

New Features:

  • Introduce upload-codescene-coverage composite GitHub Action to upload coverage reports to CodeScene
  • Support automatic detection of coverage file path based on specified format

Enhancements:

  • Cache the CodeScene CLI by extracting its version from the installer script for faster subsequent runs
  • Validate installer checksum via CODESCENE_CLI_SHA256 and reuse the downloaded script for version detection
  • Fail early on unsupported format input values

Documentation:

  • Update main README to list the new action and add dedicated README and CHANGELOG for the action

Summary by CodeRabbit

  • New Features
    • Introduced a new GitHub Action for uploading coverage reports to CodeScene, supporting automatic detection of coverage files, caching, and secure installation of the CLI tool.
  • Documentation
    • Added a README and changelog for the new action, including usage instructions and release history.
    • Updated the main README to list the new action among available repository actions.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 17, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

A new GitHub Action named "Upload CodeScene Coverage" has been introduced, along with supporting documentation and changelog files. The action uploads coverage reports to CodeScene, supports automatic path inference, and manages CLI installation and caching. The repository README was updated to list this and other available actions.

Changes

File(s) Change Summary
.github/actions/upload-codescene-coverage/action.yml Added new GitHub Action to upload coverage reports to CodeScene, with support for path inference and caching.
.github/actions/upload-codescene-coverage/README.md, .github/actions/upload-codescene-coverage/CHANGELOG.md Added documentation and changelog for the new action, describing usage, inputs, and release history.
README.md Updated to include a table listing available GitHub Actions in the repository.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow
    participant Action
    participant Artifact
    participant Cache
    participant CodeSceneCLI

    Workflow->>Action: Invoke upload-codescene-coverage
    Action->>Action: Determine coverage file path (auto or manual)
    Action->>Artifact: Upload coverage file as artifact
    Action->>Cache: Restore CodeScene CLI from cache
    alt Cache miss
        Action->>CodeSceneCLI: Download and install CLI (if access token present)
    end
    Action->>Action: Add CLI to PATH
    Action->>CodeSceneCLI: Upload coverage data to CodeScene
Loading

Possibly related PRs

Poem

A hop and a skip, a coverage file found,
With CodeScene in mind, reports now abound.
The bunny uploads, with paths guessed just right,
Caches a CLI, so builds are light.
In the garden of code, where green metrics grow,
This action ensures your coverage will show! 🐇

✨ Finishing Touches
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch codex/create-action-for-uploading-coverage-to-codescene

🪧 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.

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jun 17, 2025

Reviewer's Guide

This PR adds a new composite GitHub Action for uploading coverage reports to CodeScene—with auto-detection of coverage files, secure downloading and caching of the CodeScene CLI, and upload logic—alongside documentation and a main README entry.

Sequence diagram for coverage upload process in the new action

sequenceDiagram
    actor GitHubRunner
    participant Action as UploadCodeSceneCoverageAction
    participant CodeSceneCLI
    participant CodeSceneServer

    GitHubRunner->>Action: Start Action
    Action->>Action: Validate inputs (format, path)
    Action->>Action: Determine coverage file path
    Action->>Action: Download installer script
    Action->>Action: Validate installer checksum (if provided)
    Action->>Action: Extract CLI version
    Action->>Action: Cache CLI by version
    Action->>Action: Install CLI (if not cached)
    Action->>Action: Add cs-coverage to PATH
    Action->>CodeSceneCLI: Run cs-coverage upload
    CodeSceneCLI->>CodeSceneServer: Upload coverage report
    CodeSceneServer-->>CodeSceneCLI: Acknowledge upload
    CodeSceneCLI-->>Action: Return result
    Action-->>GitHubRunner: Action complete
Loading

Class diagram for the new Upload CodeScene Coverage GitHub Action

classDiagram
    class UploadCodeSceneCoverageAction {
        +input path: string = "__auto__"
        +input format: string = "cobertura"
        +env CS_ACCESS_TOKEN
        +env CODESCENE_CLI_SHA256
        +step Validate inputs
        +step Determine coverage file
        +step Download installer
        +step Upload coverage artifact
        +step Cache CodeScene Coverage CLI
        +step Install CodeScene Coverage CLI
        +step Add cs-coverage to PATH
        +step Upload coverage to CodeScene
    }
Loading

File-Level Changes

Change Details Files
Introduce composite GitHub Action to upload coverage to CodeScene
  • Validate action inputs and auto-detect coverage file based on format
  • Download and checksum-validate installer script, extract CLI version
  • Cache CodeScene CLI by version and conditionally install it
  • Add CLI to PATH and run cs-coverage upload with specified format
.github/actions/upload-codescene-coverage/action.yml
Add documentation for the new action
  • Create action README with inputs, usage example, and notes
  • Add CHANGELOG with version history
.github/actions/upload-codescene-coverage/README.md
.github/actions/upload-codescene-coverage/CHANGELOG.md
Update main README to list the new action
  • Insert 'Upload CodeScene Coverage' entry into available actions table
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

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:

  • Add validation for the format input to error out on unsupported values instead of silently defaulting.
  • Include the CLI version or checksum in the cache key so updates to the CodeScene CLI invalidate the cache and pull in new versions.
  • Consider failing early if CS_ACCESS_TOKEN is unset to provide clearer feedback instead of silently skipping the upload step.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Add validation for the `format` input to error out on unsupported values instead of silently defaulting.
- Include the CLI version or checksum in the cache key so updates to the CodeScene CLI invalidate the cache and pull in new versions.
- Consider failing early if `CS_ACCESS_TOKEN` is unset to provide clearer feedback instead of silently skipping the upload step.

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

🔭 Outside diff range comments (2)
.github/actions/upload-codescene-coverage/CHANGELOG.md (1)

1-8: CHANGELOG entries look accurate for the initial and updated versions. Consider adding a trailing newline at the end of the file to comply with POSIX text file conventions.

.github/actions/upload-codescene-coverage/action.yml (1)

70-73: Fix env placement for composite actions. The env block at the root level won’t inject variables into the steps. Move it under runs: so each step has access to CS_ACCESS_TOKEN and CODESCENE_CLI_SHA256.
Suggested structure:

runs:
  using: composite
  steps:
    # ...
  env:
    CS_ACCESS_TOKEN: ${{ secrets.CS_ACCESS_TOKEN }}
    CODESCENE_CLI_SHA256: ${{ vars.CODESCENE_CLI_SHA256 }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1410603 and 58b1f0f.

📒 Files selected for processing (4)
  • .github/actions/upload-codescene-coverage/CHANGELOG.md (1 hunks)
  • .github/actions/upload-codescene-coverage/README.md (1 hunks)
  • .github/actions/upload-codescene-coverage/action.yml (1 hunks)
  • README.md (1 hunks)
🔇 Additional comments (1)
README.md (1)

6-12: Verify paths in the "Available actions" table. The Generate coverage action is listed under .github/generate-coverage while others reside in .github/actions/.... Please confirm that the directory structure and paths are correct.

Comment thread .github/actions/upload-codescene-coverage/README.md
Comment thread .github/actions/upload-codescene-coverage/README.md
Comment thread .github/actions/upload-codescene-coverage/action.yml Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 17, 2025

@coderabbitai review

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 17, 2025

@sourcery-ai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 17, 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

@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!

Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments

### Comment 1
<location> `.github/actions/upload-codescene-coverage/README.md:28` </location>
<code_context>
+- uses: ./.github/actions/upload-codescene-coverage@v1
+```
+
+See [CHANGELOG](CHANGELOG.md) for release history.
--- /dev/null
+++ b/.github/actions/upload-codescene-coverage/CHANGELOG.md
</code_context>

<issue_to_address>
The phrase 'See [CHANGELOG](CHANGELOG.md) for release history.' uses an implied 2nd person imperative ('See'), which should be avoided per the instructions.

Consider rephrasing to avoid the imperative mood, such as: 'Refer to [CHANGELOG](CHANGELOG.md) for release history.'
</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: ./.github/actions/upload-codescene-coverage@v1
```

See [CHANGELOG](CHANGELOG.md) for release history.
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.

suggestion (review_instructions): The phrase 'See CHANGELOG for release history.' uses an implied 2nd person imperative ('See'), which should be avoided per the instructions.

Consider rephrasing to avoid the imperative mood, such as: 'Refer to CHANGELOG for release history.'

Review instructions:

Path patterns: **/*.md

Instructions:
Avoid 2nd person or 1st person pronouns ("I", "you", "we")

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:

  • Consider adding set -euo pipefail (or bash -e) at the top of your shell steps to ensure any failures abort the action immediately.
  • The actions/upload-artifact step to upload the coverage file seems unrelated to the CodeScene upload—consider removing or making it optional if not needed.
  • Include ${{ runner.arch }} (or similar) in your cache key to prevent cache collisions across different architectures when caching the CLI binary.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Consider adding `set -euo pipefail` (or `bash -e`) at the top of your shell steps to ensure any failures abort the action immediately.
- The `actions/upload-artifact` step to upload the coverage file seems unrelated to the CodeScene upload—consider removing or making it optional if not needed.
- Include `${{ runner.arch }}` (or similar) in your cache key to prevent cache collisions across different architectures when caching the CLI binary.

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

♻️ Duplicate comments (2)
.github/actions/upload-codescene-coverage/README.md (2)

3-4: Duplicate: Clarify caching behaviour.
The README mentions caching the CLI but doesn’t explain where the cache is stored or its keying strategy. Consider adding a brief Caching section or linking to the action.yml.


24-26: Duplicate: Expand the usage example.
Provide a snippet with with: fields to show how to configure path and format:

- uses: ./.github/actions/upload-codescene-coverage@v1
  with:
    path: coverage.xml
    format: cobertura
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58b1f0f and 0db2aa6.

📒 Files selected for processing (3)
  • .github/actions/upload-codescene-coverage/CHANGELOG.md (1 hunks)
  • .github/actions/upload-codescene-coverage/README.md (1 hunks)
  • .github/actions/upload-codescene-coverage/action.yml (1 hunks)
🧰 Additional context used
🪛 LanguageTool
.github/actions/upload-codescene-coverage/CHANGELOG.md

[grammar] ~10-~10: The word ‘install’ is not a noun.
Context: ...LI using the version extracted from the install script. ## v1.3.0 - Validate installer...

(A_INSTALL)

🔇 Additional comments (6)
.github/actions/upload-codescene-coverage/action.yml (6)

1-15: Initial setup and inputs look good.
The action’s metadata, input definitions, and defaults are clear and correctly declared.


16-28: Coverage file detection logic is correct.
Auto-path substitution handles both lcov and cobertura formats as intended.


40-45: Artifact upload step is correctly configured.
The coverage file is stored as an Action artifact under the expected name.


46-52: CLI caching configuration is solid.
Keying the cache on OS and CLI version ensures reliable restores and speeds up subsequent runs.


64-67: Adding CLI to PATH is correct.
Appending $HOME/.local/bin to GITHUB_PATH makes cs-coverage available in later steps.


82-84: Environment variable configuration looks correct.
Using secrets.CS_ACCESS_TOKEN and vars.CODESCENE_CLI_SHA256 follows best practices.

Comment thread .github/actions/upload-codescene-coverage/action.yml
Comment thread .github/actions/upload-codescene-coverage/action.yml
Comment thread .github/actions/upload-codescene-coverage/CHANGELOG.md Outdated
@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 18, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 18, 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 Jun 18, 2025

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 18, 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

🔭 Outside diff range comments (1)
.github/actions/upload-codescene-coverage/action.yml (1)

98-101: Invalid top-level env in composite action
Composite actions don’t support a root-level env block. Move CS_ACCESS_TOKEN and CODESCENE_CLI_SHA256 into runs.env or into each relevant step’s environment.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0db2aa6 and b6e15fa.

📒 Files selected for processing (3)
  • .github/actions/upload-codescene-coverage/CHANGELOG.md (1 hunks)
  • .github/actions/upload-codescene-coverage/README.md (1 hunks)
  • .github/actions/upload-codescene-coverage/action.yml (1 hunks)
🔇 Additional comments (12)
.github/actions/upload-codescene-coverage/CHANGELOG.md (1)

1-17: Changelog is comprehensive and consistent
The release notes accurately document each version’s enhancements, and terminology is uniform throughout.

.github/actions/upload-codescene-coverage/README.md (5)

1-4: Introduction is clear and concise
The header and summary succinctly describe the action’s purpose and benefits.


7-11: Inputs table aligns with implementation
Both path and format inputs are documented with correct defaults and descriptions.


12-17: Behaviour description is precise
Auto-path inference, CLI caching, and installer validation steps are clearly explained.


25-30: Usage example is complete
The snippet includes all necessary with: fields, making it straightforward for users to adopt.


32-33: Changelog reference phrasing is appropriate
“Refer to [CHANGELOG]” avoids direct imperatives and maintains a neutral tone.

.github/actions/upload-codescene-coverage/action.yml (6)

1-12: Inputs declared correctly
The sentinel __auto__ for path and the default cobertura format are well documented.


16-24: Robust format validation
Using a case statement ensures unsupported formats are caught early with a clear error.


27-38: Auto-detection logic is accurate
The step correctly resolves file names based on the chosen format and outputs the result.


41-53: Secure installer handling
Utilising mktemp, trap, pre-download checksum validation, and semantic version extraction follows best practices.


55-60: Artifact upload step is straightforward
Leveraging actions/upload-artifact with dynamic path output aligns with GitHub Actions conventions.


83-96: Upload step error handling is solid
Validating both the presence of cs-coverage and the coverage file ensures the action fails fast on misconfiguration.

Comment on lines +68 to +77
- name: Install CodeScene Coverage CLI
if: env.CS_ACCESS_TOKEN != '' && steps.cs-cache.outputs.cache-hit != 'true'
run: |
script="${{ steps.installer.outputs.script }}"
if [ -n "${CODESCENE_CLI_SHA256:-}" ]; then
echo "${CODESCENE_CLI_SHA256} $script" | sha256sum -c -
fi
bash "$script" -y
rm "$script"
shell: bash
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)

Duplicate checksum validation
The installer checksum is re-verified before execution. If this redundancy isn’t intentional for extra security, you might remove the second check to streamline the step.

🤖 Prompt for AI Agents
In .github/actions/upload-codescene-coverage/action.yml between lines 68 and 77,
there is a duplicate checksum validation for the installer script. To fix this,
remove the redundant checksum verification step before executing the script,
keeping only one checksum validation to streamline the process unless the
redundancy is intentionally for extra security.

Comment on lines +61 to +67
- name: Cache CodeScene Coverage CLI
id: cs-cache
uses: actions/cache@v4
with:
path: ~/.local/bin/cs-coverage
key: ${{ runner.os }}-cs-coverage-${{ steps.installer.outputs.version }}

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)

Effective caching strategy
Keying the cache by OS and CLI version reduces redundant installations. Consider adding restore-keys for minor version fallbacks.

🤖 Prompt for AI Agents
In .github/actions/upload-codescene-coverage/action.yml around lines 61 to 67,
the cache key currently uses the OS and exact CLI version, which may miss
opportunities to restore cache for minor version updates. Add a restore-keys
section with a fallback key pattern that matches the OS and major version only,
allowing the cache to restore from previous minor versions if the exact version
is not found. This improves cache hit rates and reduces redundant installations.

@leynos
Copy link
Copy Markdown
Owner Author

leynos commented Jun 18, 2025

@sourcery-ai review

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:

  • The trap 'rm -f "$script"' EXIT in the "Download installer" step will remove the installer script at the end of that step, so it won’t be available for the "Install CodeScene Coverage CLI" step—consider deferring cleanup until after installation.
  • The “Upload coverage artifact” step uploads the coverage file as a GitHub artifact but doesn’t impact the CodeScene upload; remove or rename it if artifact retention isn’t required to avoid confusion.
  • The cache step uses ~/.local/bin/cs-coverage as the path but the installer drops the cs-coverage binary directly into ~/.local/bin/; ensure the cache path matches the actual binary location so caching works correctly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `trap 'rm -f "$script"' EXIT` in the "Download installer" step will remove the installer script at the end of that step, so it won’t be available for the "Install CodeScene Coverage CLI" step—consider deferring cleanup until after installation.
- The “Upload coverage artifact” step uploads the coverage file as a GitHub artifact but doesn’t impact the CodeScene upload; remove or rename it if artifact retention isn’t required to avoid confusion.
- The cache step uses `~/.local/bin/cs-coverage` as the path but the installer drops the `cs-coverage` binary directly into `~/.local/bin/`; ensure the cache path matches the actual binary location so caching works correctly.

## Individual Comments

### Comment 1
<location> `.github/actions/upload-codescene-coverage/action.yml:88` </location>
<code_context>
+      run: |
+        command -v cs-coverage >/dev/null 2>&1 || { echo "cs-coverage CLI not found" >&2; exit 1; }
+        file="${{ steps.cov-file.outputs.path }}"
+        if [ ! -f "$file" ]; then
+          echo "$file not found!"
+          exit 1
+        fi
+        cs-coverage upload \
</code_context>

<issue_to_address>
The error message for missing coverage file could include more context.

Consider adding details such as the expected file format or current working directory to the error message to aid debugging.
</issue_to_address>

<suggested_fix>
<<<<<<< SEARCH
        if [ ! -f "$file" ]; then
          echo "$file not found!"
          exit 1
        fi
=======
        if [ ! -f "$file" ]; then
          echo "Coverage file not found!"
          echo "  Expected file: $file"
          echo "  Current working directory: $(pwd)"
          echo "  Expected format: ${{ inputs.format }}"
          exit 1
        fi
>>>>>>> REPLACE

</suggested_fix>

### Comment 2
<location> `.github/actions/upload-codescene-coverage/README.md:32` </location>
<code_context>
+    format: cobertura
+```
+
+Refer to [CHANGELOG](CHANGELOG.md) for release history.
+
--- /dev/null
</code_context>

<issue_to_address>
The instruction 'Refer to [CHANGELOG](CHANGELOG.md) for release history.' uses an implied 2nd person imperative, which should be avoided per the guidelines.

Consider rephrasing to avoid the implied 2nd person imperative. For example: 'See [CHANGELOG](CHANGELOG.md) for release history.'
</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.

Comment on lines +88 to +91
if [ ! -f "$file" ]; then
echo "$file not found!"
exit 1
fi
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.

suggestion: The error message for missing coverage file could include more context.

Consider adding details such as the expected file format or current working directory to the error message to aid debugging.

Suggested change
if [ ! -f "$file" ]; then
echo "$file not found!"
exit 1
fi
if [ ! -f "$file" ]; then
echo "Coverage file not found!"
echo " Expected file: $file"
echo " Current working directory: $(pwd)"
echo " Expected format: ${{ inputs.format }}"
exit 1
fi

format: cobertura
```

Refer to [CHANGELOG](CHANGELOG.md) for release history.
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.

suggestion (review_instructions): The instruction 'Refer to CHANGELOG for release history.' uses an implied 2nd person imperative, which should be avoided per the guidelines.

Consider rephrasing to avoid the implied 2nd person imperative. For example: 'See CHANGELOG for release history.'

Review instructions:

Path patterns: **/*.md

Instructions:
Avoid 2nd person or 1st person pronouns ("I", "you", "we")

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 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.

@leynos leynos merged commit 8121c9e into main Jun 18, 2025
1 check passed
@leynos leynos deleted the codex/create-action-for-uploading-coverage-to-codescene branch June 18, 2025 10:06
leynos added a commit that referenced this pull request Dec 26, 2025
Eliminate all nested if statements by using three sequential top-level
conditionals:
1. Valid non-empty string case - returns immediately
2. Invalid non-empty string case - raises error (only executes if #1 didn't return)
3. General type mismatch - unchanged

Extract `is_nonempty_str` variable to keep line length within 88 chars.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
leynos added a commit that referenced this pull request Dec 29, 2025
* Add release workflow actions migrated from netsuke

Migrate four reusable GitHub Actions from leynos/netsuke:

- export-cargo-metadata: Extract Cargo.toml metadata as outputs/env vars
- determine-release-modes: Normalize event payloads into release flags
- upload-release-assets: Upload staged artefacts to GitHub releases
- stage-release-artefacts: Stage artefacts using TOML configuration

Also adds shared cargo_utils.py for Cargo.toml parsing, now used by both
export-cargo-metadata and ensure-cargo-version actions.

All actions include comprehensive tests (147 new tests total) and follow
the established patterns: PEP 723 headers, cyclopts CLI, and plumbum for
subprocess execution.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Reduce code complexity and duplication in release actions

Address CodeScene feedback on code health:

- Refactor cargo_utils.py resolve_version function by extracting helpers:
  _require_package_table, _is_workspace_inherited, _resolve_inherited_version,
  and _require_version_string. Reduces cyclomatic complexity from 12 to ~3.

- Refactor determine_release_modes.py by extracting _determine_dry_run and
  _determine_should_publish helpers. Reduces complexity from 9 to ~4.

- Refactor read_manifest.py main function by extracting _resolve_manifest_path,
  _validate_export_flag, _load_manifest, _export_field, and _process_fields.
  Reduces complexity from 15 to ~4.

- Fix Bumpy Road in resolution.py _resolve_glob_pattern by extracting
  _parts_to_pattern, _resolve_absolute_glob, and _resolve_windows_glob.

- Fix Bumpy Road in output.py write_github_output by extracting
  _format_list_output and _format_scalar_output helpers.

- Reduce test duplication in test_cargo_utils.py TestGetWorkspaceVersion
  using pytest.mark.parametrize.

- Reduce test duplication in test_read_manifest.py by consolidating 7
  similar _extract_field tests into a single parametrized test with
  _load_and_extract helper.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address review feedback on release actions migration

- Fix EM102 lint errors in cargo_utils.py by assigning f-strings to
  variables before raising exceptions

- Fix staged_files output format in output.py to return list[str]
  instead of newline-joined string, ensuring proper heredoc output
  that matches the README promise of newline-separated list

- Add type validation in config.py for artefact 'required' (must be
  bool) and 'alternatives' (must be list[str]) fields, preventing
  silent iteration over string characters if TOML is malformed

- Add unknown field validation in read_manifest.py with warning when
  unsupported fields are requested, making typos visible in workflow
  logs instead of silently returning no value

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Further reduce complexity and test duplication in release actions

- Extract validation helpers from _make_artefacts in config.py to fix
  Bumpy Road: _validate_source, _validate_required, _validate_alternatives,
  _parse_artefact_entry
- Extract _extract_first_bin_name from get_bin_name in cargo_utils.py
  to reduce module complexity below threshold
- Add _setup_github_env helper in test_read_manifest.py to reduce
  duplication across test_main_* functions

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add generic _validate_field_type helper to reduce validator duplication

- Add _validate_field_type[T] generic function using Python 3.12+ type
  parameter syntax to consolidate type-checking logic
- Simplify _validate_source to 4 lines using the helper with
  allow_empty_str=False for required non-empty strings
- Simplify _validate_required to 4 lines using the helper for bool types
- Preserves all existing error messages exactly (including "boolean"
  instead of "bool" for bool type mismatches)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Apply ruff formatting to release actions scripts

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Flatten nested conditional in _validate_field_type

Eliminate all nested if statements by using three sequential top-level
conditionals:
1. Valid non-empty string case - returns immediately
2. Invalid non-empty string case - raises error (only executes if #1 didn't return)
3. General type mismatch - unchanged

Extract `is_nonempty_str` variable to keep line length within 88 chars.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Extract _validate_string_field to simplify _validate_field_type

Add dedicated helper for string validation with simple single-condition
checks:
- Type check: isinstance(value, str) raises "must be a string" error
- Empty check: not allow_empty and not value raises "Missing required"

Simplify _validate_field_type to delegate string validation entirely,
eliminating the complex 3-way AND conditional.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix RUF043 lint errors in test_cargo_utils.py

Use raw strings for pytest.raises match= patterns containing regex
metacharacters (dots). Escape dots as \. to make regex intent explicit.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Introduce ValidationContext dataclass to bundle validation parameters

Add frozen ValidationContext(index, config_path) dataclass to reduce
function arguments in validation helpers:
- _validate_string_field: 5 → 4 parameters
- _validate_field_type: 6 → 5 parameters

Create context in _validate_source and _validate_required, then pass
to downstream validators. Preserves all existing error messages and
behaviour.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Apply formatting

* Consolidate boolean coercion and migrate to syspath-hack

Introduce bool_utils.py with two shared functions:
- coerce_bool(value, *, default): Returns default for None/empty
- coerce_bool_strict(value, *, parameter): Raises on invalid input

Replace all raw sys.path.insert calls with syspath-hack helpers:
- prepend_to_syspath() for script directories
- prepend_project_root() for repository root imports

Remove duplicate _coerce_bool implementations from 5 scripts:
- determine_release_modes.py
- upload_release_assets.py
- stage.py
- ensure_cargo_version.py
- read_manifest.py

Remove redundant TestCoerceBool test classes from action-specific
test files (now covered by tests/test_bool_utils.py).

Net reduction: 316 lines removed, 50 lines added.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address PR review comments

Code quality fixes:
- Remove redundant exception handling in ensure_cargo_version.py
- Add manifest_path parameter to get_package_field and get_bin_name
- Add path.parent.mkdir in output helpers for resilience
- Inline ValidationContext and validation helpers in config.py
- Remove _StagingEnvironment wrapper in pipeline.py
- Inline _validate_export_flag and _export_field in read_manifest.py

Testing improvements:
- Remove incomplete test_raises_for_name_collision test
- Add upload_assets failure path tests (CommandNotFound, ProcessExecutionError)
- Add write_github_output list/heredoc tests
- Add staging tests for template errors and destination escaping

Documentation updates:
- Expand acronyms: TOML, JSON, CLI, RPM, SHA-256
- Fix spelling: artifacts -> artefacts (en-GB) in prose text

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address remaining PR review comments

Testing additions:
- Add test_uses_alternative_when_primary_missing for alternatives resolution
- Add test_extract_field[description_whitespace_trimmed] for whitespace trimming
- Add test_main_warns_for_unknown_field for unknown field warnings

Documentation:
- Expand TOML acronym in export-cargo-metadata CHANGELOG

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address automated code review feedback

Apply suggestions from coderabbitai and codescene-delta-analysis:

Code quality improvements:
- Simplify env var validation with _require_env helper in determine_release_modes.py
- Change return type of _load_event from Mapping to dict
- Use match/case for field dispatch in read_manifest.py _extract_field
- Use frozenset for immutable RESERVED_OUTPUT_KEYS constant
- Separate GitHub annotation from logger warning in pipeline.py
- Remove redundant Path conversion in resolution.py _newest_file
- Fix dry-run message to reflect clobber parameter value
- Add syspath-hack to PEP 723 dependencies in upload_release_assets.py
- Remove unnecessary raw string prefix from cargo_utils.py docstring
- Remove unused noqa directives (I001 in stage.py)
- Restore TC003 noqa for runtime Path usage in cargo_utils.py

Documentation fixes:
- Fix macOS spelling in stage-release-artefacts README

Test improvements:
- Add noqa: ARG001 for unused path params in mock functions
- Remove unused monkeypatch parameter from test_stages_artefact
- Strengthen mock assertion to verify gh CLI arguments
- Add encoding parameter to write_text in test_cargo_utils.py

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address CodeScene complexity and duplication issues

Reduce _parse_artefact_entry complexity (r2648844868):
- Extract _require_string helper for required string validation
- Extract _optional_bool helper for optional boolean validation
- Extract _optional_string_list helper for string list validation
- Reduce cyclomatic complexity from 12 to 1 (threshold 9)

Reduce _stage_single_artefact arguments (r2648844869):
- Replace StagingConfig parameter with workspace: Path
- Replace ArtefactConfig parameter with artefact_destination: str | None
- Reduces argument count from 5 to within threshold of 4

Fix TestMain code duplication (r2648844870):
- Add _setup_github_env helper for common test setup
- Consolidate env var requirement tests with pytest.mark.parametrize
- Reduces repeated monkeypatch.setenv/delenv calls

Also fixes:
- Remove unused noqa directives, use del for unused params instead
- Make boolean default keyword-only (FBT001/FBT003)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Further address CodeScene complexity and duplication issues

Reduce _stage_single_artefact arguments to 4 (from 5):
- Introduce StagingDirs parameter object bundling workspace and staging_dir
- Pass StagingDirs instead of two separate Path arguments

Reduce TestMain code duplication in test_upload_release_assets.py:
- Add _setup_main_env helper for common GITHUB_OUTPUT setup
- Add _run_main helper for standard main() invocation
- Reduces repeated setup code across 5 test methods

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address additional review comments

- test_stage.py: Remove redundant TYPE_CHECKING/PathType, use Path directly
- tests/test_cargo_utils.py: Add encoding="utf-8" to all write_text calls
- cargo_utils.py: Move Path import into TYPE_CHECKING block (TC003)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address further review comments

pipeline.py:
- Add staging_dir safety validation before rmtree to prevent catastrophic
  deletion of system paths
- Make 'No artefacts staged' error message more informative with count
- Hoist StagingDirs creation out of the loop (create once, reuse)
- Log when overwriting an existing file during staging
- Improve path escape error message with resolved paths
- Document checksum file format (BSD-style compatible with sha256sum -c)

test_upload_release_assets.py:
- Add output file verification to test_no_artifacts for consistency

tests/test_cargo_utils.py:
- Add test for description field whitespace trimming

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address final review comments

pipeline.py:
- Use logger.info for overwrite messages to match staging-success log level

test_upload_release_assets.py:
- Add _verify_output helper to centralize output file verification
- Refactor TestMain tests to use the new helper, reducing duplication

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address code review round 4 comments

Bug fixes:
- Fix syspath-hack order in stage.py: add prepend_project_root() before
  importing bool_utils
- Fix checksum map collision risk: key by relative path instead of
  filename to avoid collisions when files in subdirectories share names
- Fix description extraction type safety: add isinstance check before
  accessing package.get("description")

Documentation:
- Standardize licence/license spelling to American "license" in
  stage-release-artefacts README and action.yml
- Update checksum-map description from "file names" to "relative paths"
- Expand OIDC acronym to "OpenID Connect (OIDC)" on first use

Tests:
- Add test_creates_parent_directories to TestWriteGithubOutput

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Use British English spelling in prose descriptions

- Change "license file" to "licence file" in README.md description
- Change "license artefact" to "licence artefact" in action.yml description
- Replace three periods with typographical ellipsis in documentation

Technical identifiers (license-path, license_path) remain unchanged.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Consolidate path resolution logic in resolution.py

Reduce helper function count from 7 to 4 by introducing a unified
_split_root_and_parts function that handles all three path interpretation
cases (absolute POSIX, Windows absolute, relative).

Removed functions:
- _windows_root (consolidated into _split_root_and_parts)
- _parts_to_pattern (inlined)
- _resolve_absolute_glob (consolidated)
- _resolve_windows_glob (consolidated)

Simplified _resolve_glob_pattern and _resolve_direct_path now share the
common path splitting logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add behavioral tests for composite actions using act

Add pytest-based behavioral tests that exercise composite actions via
the `act` GitHub Actions runner. Tests verify end-to-end behavior for:

- determine-release-modes: workflow_call, push tag, and pull_request events
- export-cargo-metadata: exports name and version from Cargo.toml
- stage-release-artefacts: stages files and creates checksum sidecars
- upload-release-assets: dry-run validates assets without uploading

Tests require Docker/Podman and act, and are opt-in via ACT_WORKFLOW_TESTS=1.
Run with: ACT_WORKFLOW_TESTS=1 sudo -E make test

Includes shared test harness using plumbum for subprocess execution and
skip markers that detect runtime availability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor behavioral tests to extract common test scaffolding

Add _run_act_and_get_logs helper function that consolidates the common
pattern of running act and asserting success. All 6 test methods now
use this helper, reducing duplication and improving maintainability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Introduce ActConfig parameter object for run_act function

Replace four keyword-only parameters (artifact_dir, event_path, env,
timeout) with a single ActConfig dataclass. This reduces the function
signature from 7 arguments to 4, grouping related execution configuration
into a cohesive parameter object.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add regression test for GITHUB_OUTPUT parent directory creation

Verify that ensure-cargo-version creates parent directories for
GITHUB_OUTPUT when they don't exist. This tests the existing
path.parent.mkdir(parents=True, exist_ok=True) call.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address PR review comments for behavioural test infrastructure

- Expand resolution.py module docstring with usage examples and key
  behaviours documentation
- Add permissions blocks and pin actions/checkout to SHA in all test
  workflows (test-determine-release-modes, test-export-cargo-metadata,
  test-stage-release-artefacts, test-upload-release-assets)
- Fix output name references to use kebab-case matching action.yml
  declarations (dry-run, should-publish, uploaded-count, etc.)
- Remove unreachable ProcessExecutionError handler from conftest.py
- Use pathlib.Path instead of plumbum local.path for FIXTURES_DIR
- Fix en-GB spelling (Behavioural instead of Behavioral) in docstrings
- Parametrise duplicate dry-run tests in TestDetermineReleaseModes
- Strengthen test assertions using regex patterns with clearer failure
  messages
- Add explicit parent directory creation assertion in ensure-cargo-version
  test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Use bool_utils.coerce_bool for consistency in conftest.py

Replace inline boolean coercion logic with the shared coerce_bool
helper from bool_utils for consistency with the rest of the codebase.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Extract _assert_log_patterns helper for regex assertions

Add helper function to consolidate repeated regex assertion pattern
in behavioural tests. Refactor TestDetermineReleaseModes,
TestExportCargoMetadata, and TestStageReleaseArtefacts to use it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address round 2 PR review comments

- Update actions/checkout version comment from v4 to v4.3.1 across all
  test workflow files (verified via GitHub API)
- Fix _container_runtime_available() to capture and validate exit code
  instead of discarding the return value from plumbum's run()

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Fix uv script dependencies and cyclopts type hints

- Add syspath-hack dependency to export-cargo-metadata and
  stage-release-artefacts PEP 723 script metadata
- Change bool|str union types to str in CLI function signatures to fix
  cyclopts env var parsing (bool and str consume different token counts)

The coerce_bool utility already handles string-to-bool conversion.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Address round 3 PR review comments

- Consolidate TestDetermineReleaseModes tests into parametrized test
- Add comment explaining field name kebab-case normalisation
- Use match/case in _is_candidate for artefact detection
- Wire workflow_call inputs through to determine-release-modes action

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add event-specific value assertions to release modes test

Add conditional verification steps that assert expected output values
for each trigger type:
- pull_request: dry-run=true, should-publish=false
- push tag: dry-run=false, should-publish=true
- workflow_call: outputs match provided inputs

This strengthens test coverage to catch regressions in the action's
event-normalisation logic.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Simplify _is_candidate and remove redundant assertion

- Revert match/case to simpler if/else chain in _is_candidate as the
  pattern match offered no structural benefits
- Remove redundant uploaded_match.group(1) assertion since the regex
  (\d+) guarantees a non-empty digit group

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Refactor test_dry_run_validates_assets to use _assert_log_patterns

Replace direct re.search calls with the shared _assert_log_patterns
helper for consistency. Remove unnecessary capturing group from the
uploaded-count pattern (\d+ instead of (\d+)).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
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