Repository navigation
ci: run the checks on the locked dependencies - #306
Conversation
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]>
There was a problem hiding this comment.
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
Reviewer's GuideCI’s lint, test, chart, and docs jobs now install dependencies with the pinned uv version and File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
conda, mamba and micromamba are installers too (review by Sourcery). Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Summary
The lint, test (both matrix entries), chart and docs jobs of
ci.ymlinstalled the app withpip install -e ".[dev]"/".[docs]", which resolves the newest versions in range, so Dependabot's uv pull requests, which change onlyuv.lock, never tested the locked versions. They now install the lock:astral-sh/setup-uvpinned by commit (68559e9…, v10.3.3, as in foca-plugins), at the version locked inuv.lock(version-file: uv.lock; uv is a dev dependency);uv sync --locked --extra dev(--extra docsindocs) into.venv, with the Python ofsetup-python, and.venv/binon thePATHfor the later steps.--lockedalso fails if the lock doesn't matchpyproject.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 passedgate 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 -edid; these jobs hold no publishing credentials),pipx run cffconvert==2.0.0inlint(own environment), and Read the Docs (pip, ranges ofpyproject.toml; commented in.readthedocs.yaml).New tests (
tests/test_workflows.py): the four jobs set up uv from a pinned setup-uv and runuv sync --lockedwith their extra; no job without credentials runs a pip install, and other installers only asuv sync --locked,pipx run --spec <name>==<version>orpython -m build; every setup-uv step reads the version fromuv.lock, where uv is locked.Docs:
docs/development.mdsets up the development environment withuv 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), thencoverage run --source cloud_registry,scripts -m pytest: 1573 passed, 262 skipped (chart tests: no Helm locally), 100% coverage;tests/test_workflows.pyafter the review fixes: 51 passed. The new tests fail againstdev'sci.yml(5 failures), and with--frozeninstead of--lockedin one job.python -m buildfrom the uv-created.venv(no pip in it): builds sdist and wheel.uv sync --locked --extra docs, thenmkdocs build --strict: passed.pre-commit run --all-files(incl. actionlint, without ShellCheck locally) andgitleaks-all: passed.Push image/Publish imageskipped 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 --checkstep inlintis redundant withuv 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.test_jobs_on_lockguards drift.build-systemgroup 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:
uv.lock, ensuring lock-only updates are tested as intended.Enhancements:
CI:
uv sync --lockedand remove the setup-python pip cache in favor of setup-uv caching.Documentation:
Tests: