PLAT-2003/ci: add uv-lock pre-commit hook - #47
Conversation
Nothing currently checks that uv.lock agrees with pyproject.toml. The Dockerfile runs `uv sync --frozen`, which installs from the lock without verifying it matches pyproject, so a dependabot PR that edits pyproject alone stays green while the lock goes stale. The mismatch then lands all at once whenever someone next regenerates the lock, far from the PR that caused it - see PLAT-2000, where that pattern left ratatosk staging silently undeployable for a week. The uv-lock hook regenerates uv.lock and fails if the file changes, so drift goes red on the PR that introduces it, via the pre-commit check this repo already runs. rev 0.10.0 matches the org's current standard.
☂️ Code Coverage
Overall Coverage
New FilesNo new covered files... Modified FilesNo covered modified files...
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e4640f503
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| - repo: https://github.com/astral-sh/uv-pre-commit | ||
| rev: 0.10.0 | ||
| hooks: | ||
| - id: uv-lock |
There was a problem hiding this comment.
Execute the lock hook in the PR workflow
When Dependabot opens the dependency-update PRs this change is intended to guard, no client-side pre-commit hook runs. The only workflow inspected, .github/workflows/deploy.yaml, runs uv sync --all-groups and pytest at lines 26–28 but never invokes pre-commit, so this new hook is not executed and a PR with an uncommitted lockfile update can still pass. Add a CI step that runs this hook (or an equivalent lock consistency check).
Useful? React with 👍 / 👎.
Puvendhan
left a comment
There was a problem hiding this comment.
Mechanical uv-lock pre-commit hook addition (PLAT-2003). Approving.
Context
Nothing currently checks that
uv.lockagrees withpyproject.tomlin this repo.The Dockerfile runs
uv sync --frozen, which installs from the lock without verifying it matches pyproject. So a dependabot pip PR that editspyproject.tomlalone stays green — it tests the versions the lock already pins, never the ones it proposes — and the lock quietly goes stale. The mismatch then lands all at once whenever someone next regenerates the lock, far from the PR that caused it.Worked example: PLAT-2000
That is not hypothetical. In ratatosk:
pydanticto>=2.13.4in pyproject only. Lock untouched,uv sync --frozeninstalled 2.12.5, deploy succeeded.uv.lock, pulling in pydantic 2.13.4, which breakspydantic-xml'scomputed_elementon model inheritance. The module died at import.An org-wide audit found 25 of 40 repos with a
uv.lockare missing this guard.Changes
astral-sh/uv-pre-commituv-lockhook at rev0.10.0, matching the org's current standard (5 repos on 0.10.0, 4 on 0.9.7).The hook regenerates
uv.lockand fails if the file changes, so drift goes red on the PR that introduces it, on the day — via thepre-commitcheck this repo already runs.Scope / Non-goals
uv sync --frozenis deliberately left alone. All 24 repos withuv syncin a Dockerfile use--frozen; switching to--lockedwould work too but would make this repo the only one doing it, and catches the problem later (image build) than the hook does (commit).pre-commitgoes red here, it has found real pre-existing drift and the regenerated lock needs reviewing on its merits — that regeneration is exactly what detonated ratatosk, so it should not be rubber-stamped.Validation
two-inc/git-hooksentry.Ticket
🤖 Generated with Claude Code
https://claude.ai/code/session_017VDJqb1XWoNNxZEfGQ8meH