fix: uv sync --locked validates against pyproject.toml (--frozen does not) #11

Merged
john merged 1 commit from fix/dockerfile-uv-locked into dev 2026-07-30 03:46:46 +00:00
Owner

Problem

uv sync --frozen does not validate uv.lock against pyproject.toml. It only means "don't re-lock" — it installs whatever the lockfile already says, even if pyproject.toml has moved on. The flag that asserts the lock is up to date is --locked.

Combined with 2>/dev/null, a stale lockfile produced a silently wrong image: old dependencies installed, no error surfaced, no way to tell from the build log which branch of the || ran.

Fix

-    uv sync --frozen --no-dev 2>/dev/null || \
+    uv sync --locked --no-dev || \
  • --locked fails the command when uv.lock disagrees with pyproject.toml.
  • 2>/dev/null removed, so when it fails the reason is in the build log.
  • The || uv sync --no-dev fallback is kept for the no-lockfile case.

Caveat on the fallback

The fallback means a stale lock is now visible but still not fatal — the build prints the error and then resolves dependencies fresh. That is a deliberate compromise to avoid breaking builds in repos without a committed lockfile. If we want stale locks to hard-fail, the fallback has to go, which is a separate decision.

Verification

uv lock --check run locally against this repo before the change.

Fleet-wide change: 7 Dockerfiles across 6 repos (smeos x2, haskos-engineering, haskos-sales, haskos-pm, haskos-legal, haskos-finance).

## Problem `uv sync --frozen` does **not** validate `uv.lock` against `pyproject.toml`. It only means "don't re-lock" — it installs whatever the lockfile already says, even if `pyproject.toml` has moved on. The flag that asserts the lock is up to date is `--locked`. Combined with `2>/dev/null`, a stale lockfile produced a silently wrong image: old dependencies installed, no error surfaced, no way to tell from the build log which branch of the `||` ran. ## Fix ```diff - uv sync --frozen --no-dev 2>/dev/null || \ + uv sync --locked --no-dev || \ ``` - `--locked` fails the command when `uv.lock` disagrees with `pyproject.toml`. - `2>/dev/null` removed, so when it fails the reason is in the build log. - The `|| uv sync --no-dev` fallback is kept for the no-lockfile case. ## Caveat on the fallback The fallback means a stale lock is now **visible but still not fatal** — the build prints the error and then resolves dependencies fresh. That is a deliberate compromise to avoid breaking builds in repos without a committed lockfile. If we want stale locks to hard-fail, the fallback has to go, which is a separate decision. ## Verification `uv lock --check` run locally against this repo before the change. Fleet-wide change: 7 Dockerfiles across 6 repos (smeos x2, haskos-engineering, haskos-sales, haskos-pm, haskos-legal, haskos-finance).
fix: uv sync --locked validates against pyproject.toml (--frozen does not)
Some checks failed
CI / Deploy (pull_request) Has been skipped
CI / Backend (pull_request) Has been cancelled
CI / Detect Changes (pull_request) Has been cancelled
CI / Docker Build (pull_request) Has been cancelled
d216bfcecd
john merged commit 698c52e428 into dev 2026-07-30 03:46:46 +00:00
john deleted branch fix/dockerfile-uv-locked 2026-07-30 03:46:47 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
haskytech/haskos-finance!11
No description provided.