ci: install from the committed lock instead of regenerating it - #224
Merged
Merged
Conversation
The lint and test jobs ran `poetry lock && poetry install`. That regenerates poetry.lock in place, so CI never saw a stale lock -- it silently fixed one and carried on. A pyproject.toml dependency change without a matching lock update therefore passed every PR and failed only at release time, which is what broke the v1.7.0 release (#196). It also meant CI resolved fresh dependencies on every run, so the dependency set under test was never the one that ships. Both jobs now verify the lock with `poetry check --lock` and install from it. The separate check step is there for the error message: it names the lockfile in the Actions UI instead of failing inside "Install dependencies". release.yml gains the same read-only check for symmetry. It already installed strictly and still does; `poetry lock` is deliberately not added there, because release is the one place drift currently gets caught. This also makes the dependency cache honest. The key hashes the committed lock, but the venv was built from the regenerated one, so a cache hit could serve a venv matching no lockfile at all. Contributor docs and the PR template now say to run `poetry lock` and commit the result when dependencies change, because this turns that omission into a red build. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
6 tasks
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CI ran
poetry lock && poetry installin both thelintandtestjobs.poetry lockregeneratespoetry.lockin place, so CI never saw a stale lock — it silently fixed one and carried on.Two consequences:
pyproject.tomldependency change with a stale lock went green on its own PR. This broke the v1.7.0 release: fix: use start_webhook instead of run_webhook for async context #196 added thewebhooksextra without regenerating the lock, passed CI twice, and then failed the release workflow, which installs strictly.poetry.locksays.Changes
ci.yml: both jobs now runpoetry check --lock, thenpoetry install --no-interaction. Nopoetry lock.release.yml: gains the same read-onlypoetry check --lock. It already installed strictly and still does.poetry lockis deliberately not added here — release is the one place drift currently gets caught.CONTRIBUTING.mdand the PR template: say to runpoetry lockand commit the result when dependencies change.CHANGELOG.md: entry under[Unreleased].The separate check step exists for the error message.
poetry installalone reports the same problem, but the check makes the failing step in the Actions UI read "Verify lockfile is up to date" rather than "Install dependencies".This also fixes a latent cache bug: the key hashes the committed lock while the venv was built from the regenerated one, so a cache hit could serve a venv matching no lockfile at all.
On the
poetry checkdeprecation warningPoetry 2.1.3 warns that
[tool.poetry.extras]is deprecated. It is aWarning:, not anError:, and does not affect the exit code —poetry check --lockexits 0 on cleanmain. So nopyproject.tomlchange and no scoping workaround was needed. Fixing the deprecation properly would mean moving dependencies out ofdynamic = ["dependencies"]into[project.dependencies], which rewrites the whole dependency block for no functional gain.Testing
poetry check --lockonmain: passes (exit 0).rich = "^13.0.0"topyproject.tomlin a scratch worktree without runningpoetry lock. Result was exit 1 withError: pyproject.toml changed significantly since poetry.lock was last generated. Run 'poetry lock' to fix the lock file.Reverted.poetry install --no-interactionfrom the committed lock: succeeds.make test: 559 passed.black,isort,flake8: clean.mypynot run — it has pre-existing failures and is not in CI.Expected effect on contributors
Any PR changing
pyproject.tomldependencies without regeneratingpoetry.lockwill now go red. That is the point, but it is a change in contributor experience, hence the docs update.Checked the currently open PRs: #167 is the only one touching these files, and its lock is self-consistent today (
poetry check --lockon its head exits 0), so this adds no new failure to it as it stands. It is being sent back for a rebase anyway; note posted there about resolving thepoetry.lockconflict withpoetry lockrather than by hand.Dependabot is unaffected — both
pipentries updatepyproject.tomlandpoetry.locktogether.🤖 Generated with Claude Code