Skip to content

fix(reuse): use Docker image for SPDX generation (#124) - #125

Merged
williaby merged 3 commits into
mainfrom
claude/fix-python-reuse-spdx-124
May 17, 2026
Merged

williaby merged 3 commits into
mainfrom
claude/fix-python-reuse-spdx-124

Conversation

@williaby

Copy link
Copy Markdown
Collaborator

Summary

Fixes #124. The reuse-compliance reusable workflow exited 1 even when reuse lint reported full compliance. Root cause was NOT the conditional in the Summary step (as the issue suggested), but rather the Generate SPDX SBOM step failing on uv pip install --no-build 'reuse==5.0.2'.

Diagnosis

Reproduced in audio-processor run 25982739523. The actual log sequence:

  1. fsfe/reuse-action (lint) emits Congratulations! Your project is compliant... and exits 0.
  2. Generate SPDX SBOM step runs uv pip install --no-build 'reuse==5.0.2' and fails with:
    × No solution found when resolving dependencies:
    ╰─▶ Because reuse==5.0.2 has no usable wheels and you require reuse==5.0.2,
        we can conclude that your requirements are unsatisfiable.
    
        hint: Wheels are required for `reuse` because building from source is
        disabled for all packages (i.e., with `--no-build`)
    
  3. The Summary step (if: always()) then runs with if [ "success" == "success" ] and correctly takes the Compliant branch, but the job is already marked failed.

PyPI publishes only one wheel per reuse release (5.0.2 = cp313-only, 6.2.0 = cp310-only). The runner's uv venv uses system CPython 3.12, so no wheel matches, and --no-build (S8541/S8544 mitigation from #110) forbids the sdist fallback. Pinning a Python version is fragile because reuse moves the wheel target each release.

The "##[group]Run echo "Some files are missing..."" output the issue quoted is GitHub Actions rendering the full script body of the next step in the group header before execution, not the branch that actually ran.

Fix

Replace the uv-based install with a second invocation of fsfe/reuse-action, passing args: spdx -o reuse-spdx.spdx. Docker container actions accept with.args: to override the Dockerfile CMD; the action's wrapper does reuse "$@" inside $GITHUB_WORKSPACE, so output lands where upload-artifact can find it. The Docker image has reuse installed for the matching Python ABI, sidestepping the wheel mismatch entirely without weakening the --no-build posture on the runner.

Hardening included

  • Gate Upload SPDX artifact on steps.spdx.outcome == 'success' so missing-file uploads do not mask failures.
  • Move the steps.reuse.outcome template into an env var in the Summary step, eliminating a ${{ }}-in-shell injection antipattern (caught by the security hook during edit).
  • Report SPDX status separately in the job summary so a future SPDX failure is distinguishable from a REUSE non-compliance.

Test plan

  • Re-run audio-processor PR fix(ci): use relative path for upload-artifact glob #28 against the updated reusable workflow ref and confirm the job exits 0 with the SPDX artifact uploaded.
  • Verify the job summary shows **Status:** Compliant and SPDX SBOM generated and uploaded as artifact.
  • Negative path: introduce a non-compliant file in a scratch repo and confirm the job fails at the lint step with a **Status:** Non-compliant summary.

Follow-ups (not in this PR)

  • After merge, advance the workflow-templates/python-reuse.yml caller pin (currently @ea8e190) so new consumers pull the fixed reusable.
  • Consider extending fail-on-missing: false semantics to also suppress SPDX-step failures.

Generated with Claude Code

The reuse-compliance reusable workflow was exiting 1 even when `reuse lint`
reported full compliance. The actual failure was in the Generate SPDX SBOM
step, which ran `uv pip install --no-build 'reuse==5.0.2'`. PyPI publishes
only one wheel per reuse release (5.0.2 is cp313-only, 6.2.0 is cp310-only),
the runner's uv venv defaults to system CPython 3.12, no wheel matches, and
`--no-build` (S8541/S8544 mitigation from PR #110) forbids the sdist fallback.

Replace the uv-based install with a second invocation of fsfe/reuse-action,
passing `args: spdx -o reuse-spdx.spdx`. The Docker image already has reuse
installed for the correct Python ABI, so the wheel mismatch goes away, and
the security posture is preserved (no host-side pip install).

While here:
- Gate the Upload SPDX artifact step on the SPDX step outcome so an
  upload-of-missing-file does not mask the real failure.
- Move the `steps.reuse.outcome` shell interpolation in the Summary step
  into an env var, eliminating the workflow-injection antipattern.
- Add SPDX step outcome to the Summary so a future SPDX failure is reported
  separately from REUSE compliance status.

Refs: ByronWilliamsCPA/audio-processor PR #28, run 25982739523

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 17, 2026 22:39
@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@williaby has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 41 minutes and 13 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d6e1fa8b-dd8b-4def-abe9-ced3e2a92f1b

📥 Commits

Reviewing files that changed from the base of the PR and between eb52960 and 4b82835.

📒 Files selected for processing (2)
  • .github/workflows/python-reuse.yml
  • CHANGELOG.md
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/fix-python-reuse-spdx-124

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the reusable REUSE compliance workflow to generate SPDX output via the pinned fsfe/reuse-action Docker action instead of installing reuse with uv, addressing the wheel mismatch described in issue #124.

Changes:

  • Removes the uv setup and host-side reuse install for SPDX generation.
  • Adds a second fsfe/reuse-action invocation for reuse spdx.
  • Updates SPDX upload gating and summary reporting.

Comment thread .github/workflows/python-reuse.yml Resolved
echo "" >> $GITHUB_STEP_SUMMARY
echo "SPDX SBOM generated and uploaded as artifact." >> $GITHUB_STEP_SUMMARY
if [ "$SPDX_OUTCOME" = "success" ]; then
echo "SPDX SBOM generated and uploaded as artifact." >> $GITHUB_STEP_SUMMARY
@williaby

Copy link
Copy Markdown
Collaborator Author

PR Review

Status: 0 Critical, 3 Important, 2 Suggested. All 24 CI checks green. SonarCloud Quality Gate passed (0 new issues). SHA pin fsfe/reuse-action@676e2d56... verified as v6.0.0. Copilot already submitted 2 review comments (both real). CodeRabbit rate-limited this pass.

Important (should fix)

  1. CLAUDE.md compliance: CHANGELOG.md not updated. This is a fix(reuse): commit; global standards require feat/fix/perf/! commits to add a [Unreleased] / ### Fixed entry. Precedent: PR fix(workflows): replace unsafe pip installs with uv pip install --no-build #110's entries at lines 127-128. CHANGELOG diff between main and PR HEAD is empty.

  2. SPDX upload status not gated by upload outcome. .github/workflows/python-reuse.yml#L147-L149 — the summary claims "SPDX SBOM generated and uploaded as artifact" gated only on SPDX_OUTCOME = success. If actions/upload-artifact fails after SPDX generation succeeds, the always() summary still claims the artifact was uploaded. Fix: add id: upload-spdx, thread UPLOAD_OUTCOME env var, require both outcomes = success. (Original Copilot finding.)

  3. skipped SPDX outcome misreported as failure. .github/workflows/python-reuse.yml#L150-L151 — when fail-on-missing: true and lint fails, SPDX step's outcome is skipped, not failure. The current branch emits "SPDX SBOM generation failed (outcome: skipped)", sending operators to debug a step that never ran. Fix: split skipped (don't mention SPDX as failed) vs failure (report it). (Original Copilot finding.)

Suggested

  1. #VERIFY comment outstanding. .github/workflows/python-reuse.yml#L91-L92 — the PR body says verification was completed via audio-processor PR fix(ci): use relative path for upload-artifact glob #28 / run 25982739523. Either mark verified (with reference) or remove.

  2. Document SPDX behavior when fail-on-missing: false. .github/workflows/python-reuse.yml#L94-L98 — currently SPDX still runs against a non-compliant tree when continue-on-error swallows the lint failure. One comment line stating intent (best-effort SBOM vs strict-compliance-only) closes the ambiguity.

What this PR does well

Root-cause analysis in the PR body (traces the actual log sequence and refutes the misleading symptom in #124); security posture preserved (--no-build mitigation kept by sidestepping host install); workflow injection antipattern fixed in passing (${{ }} -> env var); == -> = POSIX normalization; SHA pinning maintained.

Generated with Claude Code

williaby and others added 2 commits May 17, 2026 15:53
The Summary step previously gated the success message on
`SPDX_OUTCOME == success` alone, so an artifact upload failure was
silently presented as a successful upload, and a skipped SPDX step
(triggered when REUSE lint fails with `fail-on-missing: true` and the
job aborts before SPDX runs) was reported as "SPDX SBOM generation
failed (outcome: skipped)", sending operators to debug a step that
never ran.

Address both Copilot findings on PR #125:

- Add `id: upload-spdx` to the Upload SPDX artifact step and thread
  `UPLOAD_OUTCOME` into the Summary step's env block.
- Split the SPDX status line into four explicit branches:
  success+uploaded (happy path), success+upload-failed (artifact is
  missing), skipped (no SPDX failure to investigate), and any other
  outcome (genuine generation failure).

Also document the intentional `fail-on-missing: false` behavior with
an `#ASSUME` comment: SPDX still runs against a possibly non-compliant
tree because the SBOM is for transparency, not for gating, and a
partial inventory beats none.

Refs: ByronWilliamsCPA/.github PR #125 (review comments)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…#124)

Per global CLAUDE.md, `fix:` commits must add a CHANGELOG entry. The
parent commit on this branch (ed595aa, "fix(reuse): use Docker image
for SPDX generation") shipped without one. Backfill the bullet here
under [Unreleased] -> ### Fixed, alongside the related #110 entry,
covering: the Docker-image SPDX generation switch, the wheel-ABI
root cause it solved, the gated upload step, the workflow-injection
mitigation (env-var pass-through), the four-way SPDX status split
landed in c9f1127, and the documented `fail-on-missing: false`
behavior.

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

Copy link
Copy Markdown

@williaby

Copy link
Copy Markdown
Collaborator Author

PR Fix Summary

Pushed ed595aa..4b82835 addressing the 3 Important and 1 Suggested findings from the review above. The remaining Suggested item (the #VERIFY comment) was intentionally retained as a stable invariant note per discussion.

Commits

  • c9f1127: fix(reuse): distinguish SPDX skipped, upload-failed, and failed outcomes
  • 4b82835: docs(changelog): add Unreleased Fixed entry for python-reuse SPDX fix (#124)

Findings addressed

# Source Status Where
1 Agent (CLAUDE.md) Fixed 4b82835 — CHANGELOG entry added under [Unreleased] > ### Fixed
2 Copilot (review comment 3255605761) + Agent Fixed c9f1127 — id: upload-spdx added; UPLOAD_OUTCOME threaded into Summary env; new explicit branch reports "generated but artifact upload did not succeed (upload outcome: $UPLOAD_OUTCOME)" when SPDX succeeds but upload fails
3 Copilot (review comment 3255605769) + Agent Fixed c9f1127 — skipped SPDX outcome now gets its own branch: "SPDX SBOM generation was skipped (an earlier step did not succeed). No SPDX failure to investigate."
4 Agent (#VERIFY comment) Declined (kept as stable invariant) Intentional: serves as a check-me-on-upgrade reminder for future fsfe/reuse-action bumps
5 Agent (fail-on-missing=false behavior) Fixed c9f1127 — #ASSUME block added documenting that SPDX runs against a possibly-non-compliant tree as best-effort SBOM when callers set fail-on-missing: false

Local verification

  • pre-commit (yamllint, markdownlint, detect-secrets, TruffleHog, no-em-dash, commitizen): all passing
  • shellcheck on the Summary run-body: only pre-existing info-level SC2086 findings on $GITHUB_STEP_SUMMARY (repo convention; not introduced by this diff)
  • actionlint: deferred to CI (not on local PATH)

CI re-run triggered by push.

Generated with Claude Code

@williaby
williaby merged commit f8d6093 into main May 17, 2026
23 checks passed
@williaby
williaby deleted the claude/fix-python-reuse-spdx-124 branch May 17, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python-reuse.yml exits 1 even when reuse lint reports 197/197 compliant

2 participants