Skip to content

fix(ci): unbreak mutation testing and clean up DHI login noise - #142

Merged
williaby merged 4 commits into
mainfrom
fix/ci-mutmut-and-dhi-login
May 19, 2026
Merged

williaby merged 4 commits into
mainfrom
fix/ci-mutmut-and-dhi-login

Conversation

@williaby

Copy link
Copy Markdown
Collaborator

Summary

Fixes two shared-workflow bugs that block PRs on every downstream consumer.

python-mutation.yml

  • uv pip install --no-build 'mutmut==2.5.1' is unsatisfiable on the runner's Python/platform combo (no wheels for 2.5.1, --no-build forbids sdist). The step exits 1 before any mutation testing runs, and the artifact upload then fails with No files were found.
  • The same workflow already uses 3.x CLI syntax (mutmut run --paths-to-mutate=... on line 157). Pinning 2.5.1 was internally inconsistent with the run command.
  • Replaced with a range pin mutmut>=3.3,<4 and dropped --no-build. Downstream projects that already declare mutmut in their dev extras (e.g. mutmut>=3.3.1 in audio-processor's pyproject.toml) get it from uv sync --all-extras --frozen on the prior line; this install is now a safety net rather than a forced downgrade.

python-container-security.yml

  • docker/login-action ran unconditionally and emitted ##[error]Username and password required on every consumer repo without DHI_USERNAME / DHI_PAT secrets. continue-on-error: true suppressed the job failure but the annotation still cluttered CI logs.
  • Replaced with a shell-based conditional login that:
    • Skips with ::notice:: when either secret is empty (clean log).
    • Uses --password-stdin so the PAT never appears in process listings when present.
  • Behaviour preserved for repos that have configured DHI credentials.

Surfacing context

Surfaced by /pr-review on ByronWilliamsCPA/audio-processor#29, captured in:

A companion PR in audio-processor bumps the SHA pin to this commit and adds .trivyignore entries for the remaining will_not_fix CVEs flagged by Trivy.

Test plan

  • CI green on this PR.
  • Companion audio-processor PR temporarily pins shared-workflow ref to this branch's SHA (52940af). Mutation + container-security checks pass there.
  • After merge, downstream consumers can bump SHA pins to main.

Generated with Claude Code

python-mutation.yml:
  - Replace 'uv pip install --no-build mutmut==2.5.1' with a range pin
    'mutmut>=3.3,<4' and drop the --no-build flag.
  - mutmut 2.5.1 has no wheels for the runner's Python/platform combo, so
    the previous resolver line was unsatisfiable and exited 1 before any
    mutation testing ran (audio-processor issue #34).
  - The workflow already uses 3.x CLI syntax ('mutmut run
    --paths-to-mutate=...'), so the prior 2.5.1 pin was internally
    inconsistent. Range pin keeps us inside the supported API surface.
  - Downstream projects that declare mutmut in dev extras get it from
    'uv sync --all-extras --frozen' on the prior line; this install is
    now a safety net rather than a forced downgrade.

python-container-security.yml:
  - Replace docker/login-action with a shell-based conditional DHI login.
  - The previous step ran unconditionally and emitted
    '##[error]Username and password required' on every consumer repo that
    has not configured DHI_USERNAME / DHI_PAT secrets (audio-processor
    issue #33, secondary failure). continue-on-error suppressed the job
    failure but the error annotation still cluttered logs.
  - New form: skips with an ::notice:: when secrets are absent; uses
    --password-stdin so the PAT never appears in process listings when
    present. Behaviour preserved for repos that do configure DHI.

Refs: ByronWilliamsCPA/audio-processor#33, #34

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

coderabbitai Bot commented May 18, 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 17 minutes and 4 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: a713f76a-0ca4-4eb4-b394-255c45bfb508

📥 Commits

Reviewing files that changed from the base of the PR and between ab5da39 and c9b2ea5.

📒 Files selected for processing (2)
  • .github/workflows/python-container-security.yml
  • .github/workflows/python-mutation.yml
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-mutmut-and-dhi-login

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 fixes two issues in the shared reusable GitHub Actions workflows that were causing downstream consumer CI failures and noisy annotations, specifically around mutmut installation for mutation testing and conditional DHI registry login during container security scanning.

Changes:

  • Update python-mutation.yml to install a mutmut 3.x compatible version (and allow sdist builds) to match the workflow’s existing 3.x CLI usage.
  • Replace docker/login-action usage in python-container-security.yml with a shell-based conditional login that cleanly skips when DHI secrets are not configured.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/python-mutation.yml Adjusts mutmut install logic to avoid an unsatisfiable pin and align with the 3.x CLI used later in the workflow.
.github/workflows/python-container-security.yml Changes DHI registry login to a conditional shell step to avoid noisy errors when secrets are missing.

Comment on lines +211 to +215
if [ -z "${DHI_USERNAME}" ] || [ -z "${DHI_PAT}" ]; then
echo "::notice::DHI credentials not configured; skipping dhi.io login (unauthenticated public pulls only)"
exit 0
fi
echo "${DHI_PAT}" | docker login dhi.io -u "${DHI_USERNAME}" --password-stdin
… consumer pins

SonarCloud flagged the earlier 'uv pip install mutmut>=3.3,<4' line for:
  - S8541: omitting --no-build / --only-binary :all: can let setup scripts
    run.
  - S8544: dependency without exact version locking.

Adding --no-build back would re-introduce the original blocker (mutmut
2.5.1 had no wheels). An exact pin via 'uv pip install' would force-
downgrade consumer projects whose uv.lock resolves mutmut to a newer
version.

Cleaner fix: drop the standalone 'uv pip install' line entirely. Mutmut
is expected to be declared in the consumer project's dev extras (e.g.
audio-processor's 'mutmut>=3.3.1' in pyproject.toml), and 'uv sync
--all-extras --frozen' installs the exact version from each consumer's
uv.lock. This is fully reproducible (silences S8544), uses only the
binary distribution resolved by uv's lockfile (silences S8541), and
respects each consumer's pinning choice.

If a consumer omits mutmut from their dev deps the workflow will fail
loudly at 'mutmut run' with a clear ModuleNotFoundError; that explicit
failure mode is preferable to silently installing an arbitrary version.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
williaby added a commit to ByronWilliamsCPA/audio-processor that referenced this pull request May 19, 2026
The shared-workflow PR (ByronWilliamsCPA/.github#142) gained a follow-up
commit dropping the standalone 'uv pip install mutmut' line entirely.
This satisfies SonarCloud rules S8541 / S8544 without re-introducing the
2.5.1 wheel issue, and respects each consumer's uv.lock pin.

This repo declares 'mutmut>=3.3.1' in pyproject.toml's dev extras, so
'uv sync --all-extras --frozen' continues to install mutmut from
uv.lock; no behavioural change expected on this PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
williaby and others added 2 commits May 18, 2026 20:47
SonarCloud's PR-diff analyzer flagged 'uv sync --all-extras --frozen
$NO_BUILD_FLAG' (S8541, "omitting --no-build can lead to setup script
execution") because the prior commit shifted this line into the diff
hunk, and the static analyzer cannot resolve the dynamic
$NO_BUILD_FLAG env var (set from inputs.no-build) to confirm
--no-build is in fact passed.

This is deliberately flexible behaviour: consumers with PEP 517 build
backends like hatchling pass 'no-build: false' to allow editable
installs of their own project from source. The residual risk is
bounded by 'uv sync --frozen' refusing to resolve any version not in
the consumer's audited uv.lock.

Added a NOSONAR annotation with full rationale so this is explicit and
auditable.

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

Copy link
Copy Markdown

@williaby
williaby merged commit a81c5c7 into main May 19, 2026
23 checks passed
williaby added a commit to ByronWilliamsCPA/audio-processor that referenced this pull request May 19, 2026
PR ByronWilliamsCPA/.github#142 has merged. Updating SHA pins from the
PR branch commit (b0c4d7d) to the merged-main commit (a81c5c7) so the
workflow ref points at a permanent main-branch commit rather than a
mergeable feature branch.

No behavioural change; the merge commit is fast-forward equivalent to
the PR's final commit on this code path.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
williaby added a commit to ByronWilliamsCPA/audio-processor that referenced this pull request May 19, 2026
* fix(ci): bump shared-workflow SHA and suppress base-image CVEs

Closes #33 and #34.

Shared workflows (ByronWilliamsCPA/.github PR #142):
  - Bump SHA pin in container-security.yml and mutation-testing.yml
    from 799ebd63 to 52940aff.
  - 52940aff fixes (a) mutmut install: replaces the unsatisfiable
    '==2.5.1' + --no-build pin with a range pin 'mutmut>=3.3,<4' that
    matches the 3.x CLI syntax the workflow already uses; (b) DHI
    login: replaces docker/login-action with a shell-based conditional
    login that silently skips when DHI_USERNAME / DHI_PAT are absent,
    eliminating the '##[error]Username and password required'
    annotation on every PR.
  - SHA points to the PR branch for now; will rebase to the merged
    main SHA after PR #142 lands.

Trivy suppressions (.trivyignore):
  - CVE-2026-40393 (libgbm1, mesa-libgallium, CRITICAL, will_not_fix):
    headless audio service with no /dev/dri access and no graphics
    rendering paths; transitive only via libavcodec-extra.
  - CVE-2026-33846 (gnutls28, HIGH, no upstream fix): outbound TLS in
    application code goes through OpenSSL, not GnuTLS; GnuTLS is
    present only via curl and ffmpeg, which never touch untrusted TLS
    endpoints in the runtime request path.
  - CVE-2026-5673 (libtheoradec1, HIGH, fix_deferred): audio service;
    Theora video decoding paths are never invoked.

Each suppression is documented in docs/known-vulnerabilities.md with
exploitation scenario, compensating controls, and a 60-day reassess
date (2026-07-17) per CLAUDE.md unfixed-CVE policy.

Surfaced by /pr-review on PR #29.

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

* fix(security): expand .trivyignore to cover real base-image CVE inventory

The initial suppression set (from issue #33's sample table) missed several
CVEs that Trivy actually reports on the python:3.12-slim runtime image,
and one entry (CVE-2026-33846) was a typo in the issue and does not match
any real scan finding.

Corrections:
  - Remove CVE-2026-33846 from .trivyignore and known-vulnerabilities.md.
    The issue listed this against gnutls but Trivy never produced it; the
    actual CRITICAL gnutls CVE is CVE-2026-33845, accompanied by 3 HIGHs
    in the same package family.

Additions, grouped by package family with shared compensating-control
narrative (all transitive C libraries in the base image, none reachable
from application code):

  curl / libcurl4t64:   CVE-2026-5773, CVE-2026-6276
  libexpat1:            CVE-2026-25210, CVE-2026-45186
  libgnutls30t64:       CVE-2026-33845 (CRITICAL), CVE-2026-42010,
                        CVE-2026-3833, CVE-2026-42011
  libmbedcrypto16:      CVE-2026-34873 (CRITICAL), CVE-2026-34875,
                        CVE-2026-25835, CVE-2026-34872
  ncurses family:       CVE-2025-69720
  libsndfile1:          CVE-2026-37555 (fix_deferred)
  libssh-4:             CVE-2026-0966, CVE-2026-3731
  libssh2-1t64:         CVE-2026-7598 (CRITICAL)
  libxml2:              CVE-2026-6732

Each family is justified in docs/known-vulnerabilities.md under
"Base-image transitive library CVEs" with CVE inventory tables, including
reachability analysis verified by grep:
  - No XML parsing in src/ (libexpat1, libxml2 unreachable).
  - No soundfile/librosa usage in src/ yet (libsndfile1 unreachable
    today; reassess on audio I/O implementation).
  - Application TLS uses OpenSSL via Python cryptography/urllib3, never
    GnuTLS/mbedTLS/libssh* directly.

All entries share the 2026-07-17 reassess date (60-day cap per CLAUDE.md
unfixed-CVE policy).

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

* fix(security): restore CVE-2026-33846 to gnutls suppression set

Trivy reports CVE-2026-33846 ("affected" status) against libgnutls30t64 on
the python:3.12-slim runtime image, alongside the CRITICAL CVE-2026-33845
and three other HIGHs in the same package. The earlier commit removed
33846 on the incorrect inference that issue #33 contained a typo; in fact
the issue was right and 33846 is a real Trivy finding.

Adding it back to .trivyignore and the docs CVE inventory under the same
shared compensating-control narrative for the libgnutls30t64 family
(GnuTLS is transitive via curl/ffmpeg; application TLS goes through
OpenSSL via Python cryptography/urllib3 and never touches GnuTLS).

After this restoration, Trivy CRITICAL/HIGH count on python:3.12-slim
should drop to 0 with full documentation per the CLAUDE.md unfixed-CVE
policy.

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

* chore(ci): bump shared-workflow SHA to 55a3413 (Sonar fix on PR #142)

The shared-workflow PR (ByronWilliamsCPA/.github#142) gained a follow-up
commit dropping the standalone 'uv pip install mutmut' line entirely.
This satisfies SonarCloud rules S8541 / S8544 without re-introducing the
2.5.1 wheel issue, and respects each consumer's uv.lock pin.

This repo declares 'mutmut>=3.3.1' in pyproject.toml's dev extras, so
'uv sync --all-extras --frozen' continues to install mutmut from
uv.lock; no behavioural change expected on this PR.

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

* chore(ci): bump shared-workflow SHA to b0c4d7d (NOSONAR rationale on PR #142)

Shared workflow PR #142 added a NOSONAR annotation with rationale on the
'uv sync --no-build' line to close the residual SonarCloud S8541
finding (the env-var indirection is intentional for PEP 517 backends).

No behavioural change on this PR.

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

* chore(ci): rebase shared-workflow SHA to merged main

PR ByronWilliamsCPA/.github#142 has merged. Updating SHA pins from the
PR branch commit (b0c4d7d) to the merged-main commit (a81c5c7) so the
workflow ref points at a permanent main-branch commit rather than a
mergeable feature branch.

No behavioural change; the merge commit is fast-forward equivalent to
the PR's final commit on this code path.

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

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@williaby
williaby deleted the fix/ci-mutmut-and-dhi-login branch May 19, 2026 04:19
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.

2 participants