Repository navigation
fix: resolve GitHub Actions workflow compatibility issues - #3
Conversation
- python-slsa.yml: Convert from reusable workflow to template since
GitHub Actions doesn't support nested reusable workflow calls. The
SLSA generator must be called directly from consuming workflows.
- python-ci.yml: Fix string vs number comparison in if expressions
by using fromJSON() to properly convert step outputs before comparison.
- python-codecov.yml: Use github.token instead of secrets.GITHUB_TOKEN
for better compatibility in reusable workflow context.
- python-release.yml: Standardize all if expressions to use ${{ }}
syntax for consistency and to avoid potential parsing issues.
- python-mutation.yml: Restore missing emoji characters in PR comment
template for proper visual feedback.
The workflow-level output was incorrectly referencing jobs.test-matrix.result directly, which is not allowed. Job results are only available in the needs context of dependent jobs. Fixed by: - Adding a 'result' output to the compatibility-summary job - Using a step to capture needs.test-matrix.result as a step output - Referencing the job output in the workflow-level output
WalkthroughGitHub Actions workflows updated across multiple pipelines: conditional expressions wrapped with Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Areas requiring extra attention:
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🔇 Additional comments (10)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Fixes multiple reusable workflow issues causing failures in downstream projects: 1. **FIPS Compatibility (python-fips-compatibility.yml)** - Update astral-sh/setup-uv from invalid SHA to stable v5.1.1 - Resolves "action could not be found" startup failure 2. **Python Compatibility Matrix (python-compatibility.yml)** - Add -c flag to jq for compact single-line JSON output - Fixes "Invalid format" error in $GITHUB_OUTPUT processing 3. **ClusterFuzzLite Fuzzing (python-fuzzing.yml)** - Update google/clusterfuzzlite actions from invalid SHA to @v1 - Fixes startup failures for build_fuzzers, run_fuzzers, and prune actions 4. **SonarCloud Integration (python-ci.yml)** - Add SONAR_TOKEN check to job condition - Prevents execution failure when token not configured - Gracefully skips analysis if token missing **Impact**: Resolves all 4 workflow startup failures identified in rag-processor PR #3. Workflows will now execute successfully or skip gracefully when optional secrets are missing. **Testing**: Validated against rag-processor/pull/3 failure scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fixes multiple reusable workflow issues causing failures in downstream projects: 1. **FIPS Compatibility (python-fips-compatibility.yml)** - Update astral-sh/setup-uv from invalid SHA to stable v5.1.1 - Resolves "action could not be found" startup failure 2. **Python Compatibility Matrix (python-compatibility.yml)** - Add -c flag to jq for compact single-line JSON output - Fixes "Invalid format" error in $GITHUB_OUTPUT processing 3. **ClusterFuzzLite Fuzzing (python-fuzzing.yml)** - Update google/clusterfuzzlite actions from invalid SHA to @v1 - Fixes startup failures for build_fuzzers, run_fuzzers, and prune actions 4. **SonarCloud Integration (python-ci.yml)** - Add SONAR_TOKEN check to job condition - Prevents execution failure when token not configured - Gracefully skips analysis if token missing **Impact**: Resolves all 4 workflow startup failures identified in rag-processor PR #3. Workflows will now execute successfully or skip gracefully when optional secrets are missing. **Testing**: Validated against rag-processor/pull/3 failure scenarios 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
…n-main, revert Pattern A churn Revert commit 46e462b. Per docs/sonarcloud-nosonar-patterns.md (nuanced in PR #174, merged 2026-05-25), inline-trailing NOSONAR inside `run: |` block scalars is NOT honored by SonarCloud's githubactions rule set, and the preceding-line Pattern B form IS reliable when three conditions hold: literal --frozen on every uv line, single-rule S8541 only, no dynamic $FROZEN_FLAG. The collapse-to-single-line approach in 46e462b violated condition #3 (inline-trailing) and triggered 21 new MAJOR vulnerabilities on the SonarCloud gate, up from 11. This revert restores Pattern B at all original locations. Restructure the `Install dependencies on main` step (still incorrect even at the fda25ca state) to satisfy SonarCloud: - Replace the `run: |` block + `[ -f uv.lock ]` shell check (which used comma-separated NOSONAR(S8541,S8544) for the uv-no-lock branch, violating Pattern B condition #2) with two single-line `run:` steps. - Gate each step with `hashFiles('uv.lock')` instead of the stale `steps.detect.outputs.state`. hashFiles() re-evaluates per step against the current worktree, so after `Checkout Main Branch` it correctly reflects main's tree (the original Copilot finding). - Each single-line step uses Pattern A (inline NOSONAR), which IS the most reliable form per the docs and accepts comma-separated rule lists (the uv-no-lock branch carries NOSONAR(S8541,S8544)). This combines the correctness fix for the Copilot install-on-main finding with the SonarCloud-compatible suppression shape, replacing the previous flawed attempt.
…coding uv sync --frozen (#173) * fix(python-performance-regression): detect repo state instead of hardcoding uv sync/run --frozen Apply established NOSONAR detect-state pattern (see python-mutation.yml:159-169) to the largest reusable workflow in the org (642 lines, 17 unguarded uv invocations across 8 install/run steps). Changes: - Add `Detect repo state` step that branches on pyproject.toml + lockfile presence: skip when no pyproject, fail fast on poetry repos with actionable error, install with --frozen on uv-locked repos, install without --frozen on uv-no-lock repos (uv sync creates the lockfile on that path). - Add `Resolve extra dependency flags` helper step (Option 3 from PR #166) that builds a flat "--extra dev --extra ml" string output, so the per-state install steps can be single-line Pattern A NOSONAR placement. - Split the two install steps (PR-branch and main-branch) into uv-locked / uv-no-lock variants each, four total. Pattern A inline NOSONAR(S8541) on uv-locked (literal --frozen visible); NOSONAR(S8541,S8544) on uv-no-lock where --frozen is structurally absent by design. - Apply Pattern B (preceding-line NOSONAR(S8541) inside `run: |`) to the three multi-line shell blocks (Run PR Benchmarks, Run Baseline Benchmarks, Compare Performance). Every uv invocation in these blocks carries literal --frozen, so only S8541 needs suppression. Per docs/sonarcloud-nosonar- patterns.md strengthened 2026-05-26, Pattern B is acceptable when literal --frozen is structurally present and only S8541 fires. The blocks are genuinely multi-line (capability detection branching with three argv variants, Python heredoc) so collapsing to single-line is not feasible without significant readability loss. - Add `Skip notice` step for the no-pyproject path so downstream callers see a clear summary entry instead of a silent green. - Guard all downstream benchmark / summary / PR-comment / fail steps with `if: steps.detect.outputs.state == 'uv-locked' || == 'uv-no-lock'` so the workflow exits cleanly when no pyproject is present. S8541 suppression rationale: `$NO_BUILD_FLAG` (from inputs.no-build, default 'true' -> '--no-build') is dynamic by design so consumers with PEP 517 build backends like hatchling can pass `no-build: false`. SonarCloud cannot resolve the env var. The lockfile-based `uv sync --frozen` (uv-locked path) constrains installable versions to the consumer's audited uv.lock, bounding residual setup-script risk. Wave 2C of CI Repair Sprint Phase 2. Largest single-file change in the sprint. * fix(python-performance-regression): address Copilot review findings on PR #173 Resolves four issues raised in Copilot's review and one related design smell surfaced by the /pr-review pass. Critical: - Install-on-main now re-detects uv.lock presence inline via [ -f uv.lock ] rather than trusting steps.detect.outputs.state. The original gating used the PR-branch detection after `git checkout origin/main`, which misclassifies main when the PR adds or removes uv.lock. Collapses the two install-on-main steps into one with a shell-level branch. - Validate Benchmark Script now carries the same detect-state guard as adjacent steps, so the skip path (no pyproject.toml) actually skips instead of failing on a missing benchmark script. Important: - Compare Performance no longer calls sys.exit(1) on regression. The dedicated `Fail on Regression` step at the end of the job is now the single source of failure-on-regression behavior. Post PR Comment and Performance Summary now run on regression, which is the case where they matter most. Removes the unused `import sys` and the redundant FAIL_ON_REGRESSION env var on the Compare step. - Resolve extra dependency flags validates each extra against the PEP 508 allowlist (^[A-Za-z0-9._-]+\$) before emitting it; caller-controlled bytes can no longer reach the downstream `uv sync \$EXTRA_FLAGS` expansion. Whitespace separators (space, tab, or newlines from YAML block scalars) are normalized via `tr -s`. Verification: - actionlint -shellcheck= passes - yamllint passes (existing line-length warnings unchanged) - pre-commit run --files passes (no-em-dash hook included) * fix(python-performance-regression): use same-line NOSONAR (Pattern A) for SonarCloud SonarCloud quality gate failed on the previous push with 11 new S8541 (and one S8544) issues because the workflow's prior Pattern B (preceding- line `# NOSONAR(...)` inside `run: |`) is not recognized by SonarCloud's standard NOSONAR mechanism, which is documented as same-line only. Conversion: - Single-line invocations get NOSONAR appended at end of line (Generate Synthetic Test Data, Install dependencies on main x2, Compare Performance heredoc opener). - Multi-line capability checks (`uv run ... --help | grep ...`) get NOSONAR appended at end of the existing single line. - Multi-line benchmark execution branches in Run PR Benchmarks and Run Baseline Benchmarks have their `uv run` argv collapsed onto one line (no more `\`-continuations) so a same-line NOSONAR can sit on the same line as the `uv run --frozen $NO_BUILD_FLAG` invocation. The `|| { ... }` fallback brace groups stay multi-line for readability. Stale comments about "Pattern B (preceding-line NOSONAR inside run: |) is acceptable here because..." removed; replaced with brief notes explaining the same-line NOSONAR rationale. Verification: - actionlint -shellcheck= passes - yamllint passes (8 new line-length warnings from collapsed `uv run` lines; warnings only, not errors) - pre-commit run --files passes * fix(python-performance-regression): use hashFiles() to gate install-on-main, revert Pattern A churn Revert commit 46e462b. Per docs/sonarcloud-nosonar-patterns.md (nuanced in PR #174, merged 2026-05-25), inline-trailing NOSONAR inside `run: |` block scalars is NOT honored by SonarCloud's githubactions rule set, and the preceding-line Pattern B form IS reliable when three conditions hold: literal --frozen on every uv line, single-rule S8541 only, no dynamic $FROZEN_FLAG. The collapse-to-single-line approach in 46e462b violated condition #3 (inline-trailing) and triggered 21 new MAJOR vulnerabilities on the SonarCloud gate, up from 11. This revert restores Pattern B at all original locations. Restructure the `Install dependencies on main` step (still incorrect even at the fda25ca state) to satisfy SonarCloud: - Replace the `run: |` block + `[ -f uv.lock ]` shell check (which used comma-separated NOSONAR(S8541,S8544) for the uv-no-lock branch, violating Pattern B condition #2) with two single-line `run:` steps. - Gate each step with `hashFiles('uv.lock')` instead of the stale `steps.detect.outputs.state`. hashFiles() re-evaluates per step against the current worktree, so after `Checkout Main Branch` it correctly reflects main's tree (the original Copilot finding). - Each single-line step uses Pattern A (inline NOSONAR), which IS the most reliable form per the docs and accepts comma-separated rule lists (the uv-no-lock branch carries NOSONAR(S8541,S8544)). This combines the correctness fix for the Copilot install-on-main finding with the SonarCloud-compatible suppression shape, replacing the previous flawed attempt.
Summary
This PR fixes critical GitHub Actions workflow compatibility issues that were preventing reusable workflows from executing correctly.
Changes
1. python-compatibility.yml - Fixed workflow output reference
outputssection tocompatibility-summaryjobneeds.test-matrix.resultas a step outputjobs.compatibility-summary.outputs.resultWhy this matters: GitHub Actions doesn't allow workflow outputs to directly reference job results (
jobs.test-matrix.result). They must be captured as job outputs first.2. python-ci.yml - Fixed string vs number comparison
fromJSON()to convert step outputs before numeric comparison3. python-release.yml - Standardized if expressions
${{ }}syntax consistently4. python-codecov.yml - Improved token compatibility
secrets.GITHUB_TOKENtogithub.token5. python-mutation.yml - Restored visual feedback
6. python-slsa.yml - Converted to template format
Validation
✅ YAML Syntax: All workflow files validated with Python yaml parser
✅ ShellCheck: All shell scripts pass linting
✅ Compatibility: Follows GitHub Actions best practices
Testing
These fixes resolve workflow execution errors related to:
Additional Changes
sync_org_files.sh(SC2016, SC1112)Test Plan
🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.