Skip to content

ci: run the checks on the locked dependencies - #306

Merged
uniqueg merged 4 commits into
devfrom
ci/tests-on-lock
Nov 1, 2026
Merged

uniqueg merged 4 commits into
devfrom
ci/tests-on-lock

Conversation

@uniqueg

@uniqueg uniqueg commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Summary

The lint, test (both matrix entries), chart and docs jobs of ci.yml installed the app with pip install -e ".[dev]" / ".[docs]", which resolves the newest versions in range, so Dependabot's uv pull requests, which change only uv.lock, never tested the locked versions. They now install the lock:

  • uv from astral-sh/setup-uv pinned by commit (68559e9…, v10.3.3, as in foca-plugins), at the version locked in uv.lock (version-file: uv.lock; uv is a dev dependency);
  • uv sync --locked --extra dev (--extra docs in docs) into .venv, with the Python of setup-python, and .venv/bin on the PATH for the later steps. --locked also fails if the lock doesn't match pyproject.toml; the packages of the lock are checked against its hashes. setup-python's pip cache is gone (setup-uv caches instead).

Job names and the CI passed gate are unchanged; the new steps need no secrets (fork-safe). The jobs with publishing credentials (push, publish) are untouched and restore no caches.

Not on the lock, on purpose and documented: the editable app itself is built with build requirements from the index (as pip install -e did; these jobs hold no publishing credentials), pipx run cffconvert==2.0.0 in lint (own environment), and Read the Docs (pip, ranges of pyproject.toml; commented in .readthedocs.yaml).

New tests (tests/test_workflows.py): the four jobs set up uv from a pinned setup-uv and run uv sync --locked with their extra; no job without credentials runs a pip install, and other installers only as uv sync --locked, pipx run --spec <name>==<version> or python -m build; every setup-uv step reads the version from uv.lock, where uv is locked.

Docs: docs/development.md sets up the development environment with uv sync --locked --extra dev (pip mentioned as an alternative that can differ from CI) and builds the docs with --extra dev --extra docs; the Dependencies section describes CI's installs; docs/contributing.md (Packaging) too.

Closes #291

Verification

  • uv sync --locked --extra dev (uv 0.13.6, the locked version), then coverage run --source cloud_registry,scripts -m pytest: 1573 passed, 262 skipped (chart tests: no Helm locally), 100% coverage; tests/test_workflows.py after the review fixes: 51 passed. The new tests fail against dev's ci.yml (5 failures), and with --frozen instead of --locked in one job.
  • python -m build from the uv-created .venv (no pip in it): builds sdist and wheel.
  • uv sync --locked --extra docs, then mkdocs build --strict: passed.
  • pre-commit run --all-files (incl. actionlint, without ShellCheck locally) and gitleaks-all: passed.
  • zizmor: not installed locally.
  • CI: all checks passed (run 41290956188; Push image/Publish image skipped on pull requests, as intended). The logs show the locked versions installed (e.g., foca==0.18.0, uv==0.13.6, 96 packages) with setup-python's CPython 3.13.

Declined review findings

  • uv lock --check step in lint is redundant with uv sync --locked (quality, low): kept, and moved before the install (adversarial round 2), so a stale lock fails in a step that names the problem.
  • Four copies of the install steps instead of a composite action (quality, low): the repo repeats setup steps per job; test_jobs_on_lock guards drift.
  • Install the build-system group and build the editable app without build isolation (adversarial, low, alternative fix): no credentials in these jobs and no change from before; documented instead.

🤖 Generated with Claude Code

Summary by Sourcery

Make CI and documented local development use the dependency versions locked in uv.lock, with tests that guard the workflow against dependency drift.

Bug Fixes:

  • Run CI lint, test, chart, and documentation checks against the exact dependency versions recorded in uv.lock, ensuring lock-only updates are tested as intended.

Enhancements:

  • Pin the CI-installed uv version through the lock file and use locked uv environments for development and documentation workflows.
  • Add workflow safeguards that prevent unintended unlocked package installation and verify every relevant job uses locked dependencies.
  • Document the locked dependency workflow for contributors and clarify that Read the Docs continues to install from project version ranges.

CI:

  • Replace pip-based dependency setup in credential-free CI jobs with uv sync --locked and remove the setup-python pip cache in favor of setup-uv caching.

Documentation:

  • Update development and contribution guidance to use locked uv environments and explain dependency differences between CI, local pip installs, and Read the Docs.

Tests:

  • Add workflow tests covering pinned setup-uv usage, locked sync extras, virtual-environment PATH setup, and prohibited unlocked installers.

uniqueg and others added 3 commits November 1, 2026 08:02
The lint, test, chart and docs jobs installed the app with
pip install -e, which resolves the newest versions in range, so
Dependabot's uv pull requests, which change only uv.lock, never tested
the locked versions. They now run uv sync --locked (hash-checked, and
failing if the lock doesn't match pyproject.toml) into .venv, with the
Python of setup-python and uv from astral-sh/setup-uv pinned by commit
(v10.3.3, as in foca-plugins) at the version locked in uv.lock.

Tests check the install steps of the four jobs and that every setup-uv
step reads the version from the lock; docs/development.md sets up the
development environment the same way.

Closes #291

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Check every job without credentials for pip installs and uv sync
without --locked, test the properties of the install steps instead of
their exact text, and drop the count of setup-uv steps. Say that the
editable app is built with build requirements from the index, how the
setup-uv checksum check works, and that Read the Docs uses the ranges
(review findings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the lock check of lint before the install, which would otherwise
fail first on a stale lock. The tests now allow only locked syncs,
pinned pipx runs and the distribution build among the installers in
jobs without credentials, find uv sync with options before it, collect
all extras, and check that .venv/bin goes on the PATH. Comments and
docs name uv run and the uv pin's role for CI (review findings).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@uniqueg
uniqueg marked this pull request as ready for review November 1, 2026 09:06

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="tests/test_workflows.py" line_range="592" />
<code_context>
+                for command in _commands(step):
+                    where = (path.name, job_id, step.get("name"), command)
+                    assert not PIP.search(command), where
+                    if INSTALLERS.search(command) or UV_SYNC.search(command):
+                        assert _allowed_install(command), where
+
</code_context>
<issue_to_address>
**Conda installs evade the scan**

When a job adds a `conda install` command, `test_no_unlocked_installs` checks a command only when `INSTALLERS.search(command)` matches, but `INSTALLERS` does not recognize `conda install`. The test therefore passes when a job installs an unlocked package with conda.

Recognize conda and other supported package installers in the scan, and reject their installs unless explicitly allowed.
</issue_to_address>

Linked issues

#291 ci: run the tests on the locked dependencies · 3 of 3 met

# Requirement Status Notes
1 The test job (at least one matrix entry) runs on the versions of uv.lock. ✅ Met Both test matrix entries run uv sync --locked --extra dev using the Python set up for the job.
2 Dependabot uv PRs run the tests on the updated lock. ✅ Met The workflow runs on pull requests, and the test job installs from the PR's lock with uv sync --locked.
3 docs/development.md describes the same install. ✅ Met The development setup documents uv sync --locked --extra dev.

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: tests/test_workflows.py:592


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread tests/test_workflows.py Resolved
@uniqueg uniqueg added this to the v1.0.0-rc1 milestone Nov 1, 2026
@sourcery-ai

sourcery-ai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

CI’s lint, test, chart, and docs jobs now install dependencies with the pinned uv version and uv sync --locked, ensuring Dependabot lockfile updates are actually tested with exact hashed versions. Workflow regression tests prevent unlocked installs or drift, while documentation describes the locked setup and the remaining intentional index-based installs.

File-Level Changes

Change Details Files
CI dependency installation now uses the versions and hashes from uv.lock instead of resolving dependency ranges.
  • Pinned setup-uv is configured from the uv version recorded in uv.lock.
  • Lint, test, chart, and docs jobs run uv sync --locked with the appropriate extra and expose .venv/bin to subsequent steps.
  • Removed setup-python pip caching; publishing jobs and credentialed workflows remain unchanged.
.github/workflows/ci.yml
pyproject.toml
Workflow tests enforce that dependency-installing jobs remain locked and fork-safe.
  • Verify the four CI jobs use pinned setup-uv, the correct extra, --locked, and the virtual environment path.
  • Reject unlocked pip and other package installations in jobs without credentials while allowing explicitly documented exceptions.
  • Verify every setup-uv invocation reads its version from uv.lock and that uv is present in the lock.
tests/test_workflows.py
Developer and hosted documentation now explains the locked CI environment and its intentional exceptions.
  • Document uv-based local setup and locked dev/docs synchronization commands.
  • Explain that editable build requirements, pipx tooling, and Read the Docs remain index/range-based.
  • Clarify that CI checks all dependency extras against the lock while publishing and image behavior is distinct.
docs/development.md
docs/contributing.md
.readthedocs.yaml

Possibly linked issues


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

conda, mamba and micromamba are installers too (review by Sourcery).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@codecov

codecov Bot commented Nov 1, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (777a704) to head (6146cdd).

Additional details and impacted files
@@            Coverage Diff            @@
##               dev      #306   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           22        22           
  Lines         2356      2356           
=========================================
  Hits          2356      2356           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@uniqueg
uniqueg merged commit af3f21d into dev Nov 1, 2026
19 checks passed
@uniqueg
uniqueg deleted the ci/tests-on-lock branch November 1, 2026 09:27
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.

ci: run the tests on the locked dependencies

1 participant