Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughA 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
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
Possibly related PRs
Poem
✨ Finishing Touches🧪 Generate Unit Tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Reviewer's GuideThis 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 actionsequenceDiagram
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
Class diagram for the new Upload CodeScene Coverage GitHub ActionclassDiagram
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
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Add validation for the
formatinput 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_TOKENis 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 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: Fixenvplacement for composite actions. Theenvblock at the root level won’t inject variables into the steps. Move it underruns:so each step has access toCS_ACCESS_TOKENandCODESCENE_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
📒 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. TheGenerate coverageaction is listed under.github/generate-coveragewhile others reside in.github/actions/.... Please confirm that the directory structure and paths are correct.
|
@coderabbitai review |
|
@sourcery-ai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
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>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. |
There was a problem hiding this comment.
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")
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- Consider adding
set -euo pipefail(orbash -e) at the top of your shell steps to ensure any failures abort the action immediately. - The
actions/upload-artifactstep 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 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 theaction.yml.
24-26: Duplicate: Expand the usage example.
Provide a snippet withwith:fields to show how to configurepathandformat:- uses: ./.github/actions/upload-codescene-coverage@v1 with: path: coverage.xml format: cobertura
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 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 bothlcovandcoberturaformats 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/bintoGITHUB_PATHmakescs-coverageavailable in later steps.
82-84: Environment variable configuration looks correct.
Usingsecrets.CS_ACCESS_TOKENandvars.CODESCENE_CLI_SHA256follows best practices.
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
.github/actions/upload-codescene-coverage/action.yml (1)
98-101: Invalid top-levelenvin composite action
Composite actions don’t support a root-levelenvblock. MoveCS_ACCESS_TOKENandCODESCENE_CLI_SHA256intoruns.envor into each relevant step’s environment.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
📒 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
Bothpathandformatinputs 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 necessarywith: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__forpathand the defaultcoberturaformat are well documented.
16-24: Robust format validation
Using acasestatement 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
Utilisingmktemp,trap, pre-download checksum validation, and semantic version extraction follows best practices.
55-60: Artifact upload step is straightforward
Leveragingactions/upload-artifactwith dynamic path output aligns with GitHub Actions conventions.
83-96: Upload step error handling is solid
Validating both the presence ofcs-coverageand the coverage file ensures the action fails fast on misconfiguration.
| - 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 |
There was a problem hiding this comment.
🧹 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.
| - 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 }} | ||
|
|
There was a problem hiding this comment.
🧹 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.
|
@sourcery-ai review |
There was a problem hiding this comment.
Hey @leynos - I've reviewed your changes - here's some feedback:
- The
trap 'rm -f "$script"' EXITin 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-coverageas the path but the installer drops thecs-coveragebinary 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>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| if [ ! -f "$file" ]; then | ||
| echo "$file not found!" | ||
| exit 1 | ||
| fi |
There was a problem hiding this comment.
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.
| 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. |
There was a problem hiding this comment.
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")
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>
* 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>
Summary
Testing
git status --shorthttps://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:
upload-codescene-coveragecomposite GitHub Action to upload coverage reports to CodeSceneEnhancements:
CODESCENE_CLI_SHA256and reuse the downloaded script for version detectionformatinput valuesDocumentation:
Summary by CodeRabbit