Skip to content

Run ruff from the locked virtualenv in make targets - #167

Merged
leynos merged 6 commits into
mainfrom
fix-ci-lint-ruff-version-skew
Jun 12, 2026
Merged

Run ruff from the locked virtualenv in make targets#167
leynos merged 6 commits into
mainfrom
fix-ci-lint-ruff-version-skew

Conversation

@leynos

@leynos leynos commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes the systemic lint-test failure that was breaking every open PR (and main itself), and pins the second tool with the same exposure.

ruff. The CI lint job installed ruff with uv tool install ruff, which floats to the latest release (0.15.17 at the time of writing), while the project lockfile pins ruff 0.14.7. Because pyproject.toml sets preview = true, any new preview rule shipped upstream starts failing the gate without any change in this repository — RUF076 (autouse=True fixtures) fired on conftest.py and tests/behaviour/test_stream_backend_pipeline.py, both untouched by the open PRs.

  • Makefile: the fmt, check-fmt, and lint targets invoke ruff through uv run, so CI and local runs both resolve the locked version; the ruff probe moves from the PATH tool list (TOOLS) to the virtualenv tool list (VENV_TOOLS).
  • .github/workflows/ci.yml: drop the floating uv tool install ruff (the lint job already runs make build, which syncs the locked environment).

pylint. The pylint-pypy-shim git ref was already pinned, but pylint itself was a floating dependency of it — the same skew class: pylint 4.0.5 started flagging bound str.format references (consider-using-f-string) overnight, with no repository change. The PYLINT invocation now passes --with 'pylint==$(PYLINT_VERSION)' (4.0.5), so bumping pylint becomes an explicit, reviewable change to PYLINT_VERSION.

Adopting ruff 0.15.x (and addressing RUF076) is left as a separate, deliberate upgrade.

Testing

  • make check-fmt, make lint, make typecheck, make test all pass locally with the locked ruff 0.14.7 (via uv run) and pinned pylint 4.0.5
  • CodeRabbit reviews: 0 findings (both commits)

🤖 Generated with Claude Code

Summary by Sourcery

Pin Python linters to locked versions and run ruff from the project virtualenv to keep CI and local lint behaviour consistent.

Enhancements:

  • Run ruff via the locked virtualenv using uv run in Make targets so linting uses the project-pinned version.
  • Pin pylint to a specific version through the pylint-pypy shim to prevent unexpected lint behaviour changes.

CI:

  • Stop installing a floating ruff tool in the CI workflow, relying instead on the locked environment created by make build.

CI installed ruff with `uv tool install ruff`, which floats to the
latest release, while the project lockfile pins ruff 0.14.7. With
`preview = true` in pyproject, every new preview rule shipped upstream
(most recently RUF076 in 0.15.x) broke the lint gate on every open PR
without any change in the repository.

Invoke ruff through `uv run` in the fmt, check-fmt, and lint targets so
both CI and local runs resolve the locked version, move the ruff probe
from the PATH tool list to the virtualenv tool list, and drop the
floating ruff install from the CI workflow.
@coderabbitai

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@lodyai[bot], we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 39 minutes and 23 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: c7216561-a27b-44da-8eab-4413cad265a1

📥 Commits

Reviewing files that changed from the base of the PR and between ebe96f3 and 9ba8f1c.

📒 Files selected for processing (1)
  • docs/developers-guide.md

Walkthrough

Consolidate linter/tool handling: move ruff into virtualenv tooling, add a RUFF uv-run helper and PYLINT_VERSION, update Makefile fmt/check-fmt/lint to run ruff through uv run, remove ruff from the CI job CLI tool installs, and pin mbake/ty in CI.

Changes

Tool management and uv invocation consolidation

Layer / File(s) Summary
Tool prerequisites reorganisation
Makefile
TOOLS no longer includes ruff; add ruff to VENV_TOOLS, moving ruff into the virtualenv tier.
uv helpers and pylint pinning
Makefile
Add RUFF helper ($(UV_RUN_ENV) uv run ruff), introduce PYLINT_VERSION, and update PYLINT to constrain pylint==$(PYLINT_VERSION) for the pylint-pypy-shim.
Makefile fmt/check/lint target updates
Makefile
Update fmt, check-fmt, and lint to invoke ruff via $(RUFF) (i.e., uv run) rather than calling ruff through the local tool env.
CI lint-test tool installation changes
.github/workflows/ci.yml
Add MBAKE_VERSION and TY_VERSION env vars and replace the prior install loop with explicit pinned uv tool install commands for mbake and ty, removing ruff from the CI CLI tool installs.
Developer guide updates
docs/developers-guide.md
Clarify benchmark ratchet description and document that make lint runs ruff via $(UV_RUN_ENV) uv run ruff, add VENV_TOOLS to the Makefile variables table and document RUFF, LOCAL_TOOL_ENV, UV_ENV, and UV_RUN_ENV, plus note PYLINT pinning.

Possibly related PRs

  • leynos/dev-env-rocky#26: Aligns Makefile lint workflow changes around running ruff via uv and pinned pylint invocation.
  • leynos/beatcue#10: Refactors Makefile to run ruff via uv and adjusts pylint shim wiring.
  • leynos/prosidy-darn#10: Modifies Makefile pylint/pypy-shim invocation and related lint orchestration, overlapping pylint pinning and uv-run patterns.

Poem

Tools march into the venv, tidy and spry,
Ruff finds its home where virtual envs lie,
Pylint pinned steady at the chosen release,
Targets wrapped in uv run, invocation at peace,
CI trims its installs, small changes that fly.

🚥 Pre-merge checks | ✅ 19 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Developer Documentation ⚠️ Warning docs/developers-guide.md’s make lint sequence uses uv run interrogate without $(UV_RUN_ENV), but Makefile uses $(UV_RUN_ENV) uv run interrogate (lines 505 vs 93). Update docs/developers-guide.md to match the Makefile lint gate by changing the interrogate command to $(UV_RUN_ENV) uv run interrogate --fail-under 100 cuprum.
✅ Passed checks (19 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: running ruff from the locked virtualenv in Makefile targets to fix version skew.
Description check ✅ Passed The description comprehensively explains the ruff and pylint version pinning changes, the rationale for the fixes, and testing performed.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Testing (Overall) ✅ Passed PASS: PR only changes CI/Makefile lint tooling (no runtime behaviour); lint-test runs make check-fmt/make lint with locked ruff (Makefile RUFF=uv run ruff; uv.lock ruff 0.14.7; CI no longer install...
User-Facing Documentation ✅ Passed PASS: PR #167 only changes CI workflow and Makefile lint-tool pinning; docs/users-guide.md is not modified and no end-user functionality changes.
Module-Level Documentation ✅ Passed PR changes only .github/workflows/ci.yml and Makefile (no Python module files), so the module-level docstring requirement is not applicable.
Testing (Unit And Behavioural) ✅ Passed PASS: PR only updates CI workflow and Makefile lint-tool pinning (no test files or runtime behaviour changed), so unit/behavioural test additions are not applicable.
Testing (Property / Proof) ✅ Passed PR only pins lint/format tooling in CI/Makefile and updates docs; it introduces no new runtime invariants or state transitions needing property-test recommendations.
Testing (Compile-Time / Ui) ✅ Passed PASS: PR only changes .github/workflows/ci.yml and Makefile to pin ruff/pylint; no trybuild or snapshot tests are added/modified.
Unit Architecture ✅ Passed Verified PR-related changes are limited to CI workflow, Makefile tool orchestration, and developer docs; no production query/command code paths were altered, so unit architecture separation is pres...
Domain Architecture ✅ Passed PASS: PR only changes CI workflow, Makefile, and developers-guide docs; scanning cuprum/*.py found no new tooling/domain-boundary changes (no MBAKE/TY/PYLINT/RUFF markers).
Observability ✅ Passed PR only adjusts CI and Makefile tool wiring/version pinning; it adds no new production behaviour or logging/metrics/tracing surfaces needing observability.
Security And Privacy ✅ Passed Checked .github/workflows/ci.yml, Makefile, and docs: changes only pin tool versions and run ruff/pylint via locked uv env; no new secret values/credentials or wider permissions found.
Performance And Resource Use ✅ Passed CI now installs only mbake/ty (no floating uv tool install ruff), and Makefile runs Ruff via $(RUFF)=…uv run ruff; no new loops, caches, or unbounded allocations were introduced.
Concurrency And State ✅ Passed PR 167 only updates CI/Makefile/docs to pin ruff/pylint; reviewed .github/workflows/ci.yml, Makefile, and developers-guide show no async/shared-state/lock/order changes.
Architectural Complexity And Maintainability ✅ Passed PASS: PR only tweaks CI/Makefile to pin ruff/pylint via simple variables (e.g., RUFF, PYLINT_VERSION) and remove floating tool install; it adds no new architectural layers or complexity.
Rust Compiler Lint Integrity ✅ Passed GitHub PR #167 “Files changed” shows only .github/workflows/ci.yml and Makefile modified; no Rust (.rs) files touched, so no Rust lint suppressions/clones could be introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-ci-lint-ruff-version-skew

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

@sourcery-ai

sourcery-ai Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Routes ruff invocations through the locked virtualenv and pins pylint’s version to avoid CI lint instability, while simplifying CI tool installation accordingly.

File-Level Changes

Change Details Files
Run ruff via the project’s locked virtualenv instead of a floating uv tool install.
  • Remove ruff from the generic CLI TOOLS list and add it to the VENV_TOOLS list so it is checked in the virtualenv rather than on PATH.
  • Update fmt, check-fmt, and lint targets to invoke ruff through uv run using the locked environment instead of the local PATH-based tool wrapper.
  • Keep Rust and markdown formatting steps unchanged while ensuring Python formatting and linting now use the lockfile-pinned ruff version.
Makefile
Pin pylint’s version explicitly when using the pylint-pypy-shim.
  • Introduce a PYLINT_VERSION make variable defaulting to 4.0.5.
  • Extend the PYLINT command to pass a --with 'pylint==$(PYLINT_VERSION)' constraint so pylint is no longer a floating dependency of the shim.
  • Document via comments that this avoids unreviewed behaviour changes from upstream pylint releases.
Makefile
Stop installing ruff as a floating uv tool in CI and rely on the project build to provide it.
  • Update the CI workflow’s CLI tool installation step to remove ruff from the loop of tools installed with uv tool install.
  • Leave mbake, ty, and markdownlint-cli2 installation unchanged, relying on make build to sync the locked Python environment for ruff.
.github/workflows/ci.yml

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

codescene-delta-analysis[bot]

This comment was marked as outdated.

The pylint-pypy-shim git ref is pinned, but pylint itself was a
floating dependency of it, so new pylint releases changed lint
behaviour without any repository change — the same skew class as the
ruff issue this branch fixes (pylint 4.0.5 started flagging bound
str.format references as consider-using-f-string overnight). Pass
`--with 'pylint==$(PYLINT_VERSION)'` to `uv tool run` so the lint gate
resolves a known pylint; bumping PYLINT_VERSION is now an explicit,
reviewable change.
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos
leynos marked this pull request as ready for review June 12, 2026 00:37

@sourcery-ai sourcery-ai Bot left a comment

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.

Hey - I've left some high level feedback:

  • Now that ruff is always invoked via $(UV_RUN_ENV) uv run ruff, consider extracting this into a RUFF make variable to avoid repeating the same command in fmt, check-fmt, and lint and make future changes easier.
  • You’ve addressed version skew for ruff and pylint; if mbake and ty are equally sensitive, you may want to pin their versions in the CI uv tool install loop so their behavior doesn’t change under you without a corresponding repo change.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Now that ruff is always invoked via `$(UV_RUN_ENV) uv run ruff`, consider extracting this into a `RUFF` make variable to avoid repeating the same command in `fmt`, `check-fmt`, and `lint` and make future changes easier.
- You’ve addressed version skew for ruff and pylint; if mbake and ty are equally sensitive, you may want to pin their versions in the CI `uv tool install` loop so their behavior doesn’t change under you without a corresponding repo change.

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 commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Extract the locked `ruff` invocation into a Makefile variable so the
`fmt`, `check-fmt`, and `lint` targets share one command definition.
Pin CI tool installs for `mbake` and `ty` to avoid unreviewed drift.
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Record that Ruff runs through `$(RUFF)` and `VENV_TOOLS` so
maintainers keep lint and formatting on the locked `uv run` path.
codescene-delta-analysis[bot]

This comment was marked as outdated.

@leynos

leynos commented Jun 12, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai resume

@coderabbitai

coderabbitai Bot commented Jun 12, 2026

Copy link
Copy Markdown
✅ Action performed

Reviews resumed.

Add `PYLINT_VERSION` to the developer guide lint variable table and
describe how `$(PYLINT)` pins Pylint with the `uv tool run --with` option.
codescene-delta-analysis[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/developers-guide.md`:
- Around line 502-507: The docs snippet for the make lint sequence omits the
environment wrapper used in the real Makefile; update the second step to show
the mirrored, locked environment by changing "uv run interrogate --fail-under
100 cuprum" to include the UV wrapper so it reads "$(UV_RUN_ENV) uv run
interrogate --fail-under 100 cuprum", keeping the surrounding steps (e.g.,
"$(RUFF) check" and "$(PYLINT) $(PYLINT_TARGETS)") unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 04a5b661-0c8d-47eb-a3cf-4c24bd43878b

📥 Commits

Reviewing files that changed from the base of the PR and between e0194c7 and ebe96f3.

📒 Files selected for processing (1)
  • docs/developers-guide.md

Comment thread docs/developers-guide.md
Mirror the Makefile command by showing `$(UV_RUN_ENV) uv run interrogate` in the developer guide lint sequence.
@leynos
leynos merged commit a50a631 into main Jun 12, 2026
15 checks passed
@leynos
leynos deleted the fix-ci-lint-ruff-version-skew branch June 12, 2026 11:52
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.

1 participant