Conversation
Branch writes and current-snapshot moves rebuilt refs without carrying their retention fields, clearing policies that create_branch had set. Preserve the existing ref's max ref age, max snapshot age, and min snapshots to keep on those move paths. Refs without retention stay unset. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
No unresolved issues were identified.
Review effort: Lite
Findings: None
What changed in this PR
Preserves ref retention policies when snapshots move through writes, current-snapshot changes, and rollbacks.
Changes:
- Carries retention fields through ref updates.
- Adds unit and integration regression coverage.
| File | Description |
|---|---|
tests/table/test_manage_snapshots.py |
Adds unit coverage for retention behavior. |
tests/integration/test_writes/test_writes.py |
Adds catalog integration coverage. |
pyiceberg/table/update/snapshot.py |
Preserves retention metadata during snapshot moves. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This branch has not been deployed
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.
Rationale for this change
Refs can be created with retention settings, but two move paths rebuild the ref without carrying those settings forward: branch writes and current-snapshot moves. This revives the stale-closed #3770. The next metadata update then clears max ref age, max snapshot age, and min snapshots to keep.
Fast-forward already preserves the policy. This makes branch writes, set-current-snapshot, and rollback do the same. Refs created without a policy still stay unset. This is separate from #3760, which covers expiring stale refs.
Are these changes tested?
Targeted unit regression tests fail on current main and pass with this branch. Branch write also passes against the REST catalog.
Raw logs
Are there any user-facing changes?
A ref keeps the retention policy it was created with when its snapshot moves. There is no API change.
AI Disclosure
AI disclosure: GitHub Copilot CLI (GPT-6 Astra) helped rebase the stale PR, resolve the current main conflict, refresh the PR description, and rerun the tests.