Skip to content

Omit timestamp from lock file when exclude-newer uses a relative span - #3

Merged
naveenOnarayanan merged 2 commits into
mainfrom
nn/zanie-exclude-newer-omit-timestamp
Apr 9, 2026
Merged

Omit timestamp from lock file when exclude-newer uses a relative span#3
naveenOnarayanan merged 2 commits into
mainfrom
nn/zanie-exclude-newer-omit-timestamp

Conversation

@naveenOnarayanan

@naveenOnarayanan naveenOnarayanan commented Apr 9, 2026

Copy link
Copy Markdown

Summary

Cherry-pick of zaniebot/uv@81ac664 (upstream fix for astral-sh/uv#18708), adapted to our fork.

Problem: When exclude-newer is configured with a relative span (e.g. "3 weeks"), every uv lock run writes a different absolute timestamp to uv.lock. This causes merge conflicts on every PR that touches the lockfile.

Changes

  • crates/uv-distribution-types/src/exclude_newer.rs — Add ExcludeNewerValue::from_span() to recompute timestamp from span at read time
  • crates/uv-resolver/src/lock/mod.rs — Serialize only the span (not timestamp) for span-based exclude-newer; deserialize span-only entries via from_span()
  • crates/uv/tests/it/lock_exclude_newer_relative.rs — Update snapshot expectations to reflect timestamp omission

Test plan

  • cargo check passes
  • All 8 lock_exclude_newer_relative tests pass

🤖 Generated with Claude Code

claude and others added 2 commits April 9, 2026 12:13
When `exclude-newer` is configured with a relative duration (e.g., "3 weeks"),
only write the span (e.g., `exclude-newer-span = "P3W"`) to uv.lock, omitting
the computed absolute timestamp. This avoids merge conflicts in team
environments where different developers lock at different times.

Fixes astral-sh#18708

https://claude.ai/code/session_01US894hr1Khms1N1UUUhrx4
Validates that when a lock file only contains `exclude-newer-span`
(no absolute timestamp), adding a new dependency still correctly
respects the exclude-newer cutoff. The test verifies:

1. Initial lock with span-only produces correct version constraints
2. Adding a dependency re-resolves with the span-computed cutoff
3. Re-locking at a later time with --upgrade picks up newer versions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@naveenOnarayanan
naveenOnarayanan merged commit e1a21ed into main Apr 9, 2026
11 checks passed
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.

3 participants