Skip to content

fix(namespace): allow create_branch bootstrap on managed tables#7415

Open
geruh wants to merge 2 commits into
lance-format:mainfrom
geruh:branching
Open

fix(namespace): allow create_branch bootstrap on managed tables#7415
geruh wants to merge 2 commits into
lance-format:mainfrom
geruh:branching

Conversation

@geruh

@geruh geruh commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

This PR picks up on the work in #7403 by @dantasse.

create_branch on managed tables calls create_table_version before _refs/branches/<branch>.json exists, and resolve_branch_location requires that ref. Bootstrap commit fails.

create_table_version now goes through resolve_branch_for_commit instead check the ref first, and if it's missing only allow the commit when the branch chain has no versions yet. Versions without a ref still get rejected (zombie).

create_branch("exp") used to fail on the first commit because create_table_version looked for _refs/branches/exp.json before phase 2 wrote it.

# branching isn't atomic so:
phase 1: manifest → create_table_version (ref doesn't exist yet ← was failing here)
phase 2: write _refs/branches/exp.json

Testing

  • Added test_create_branch_on_managed_dataset_succeeds.
  • Zombie case is already in test_branch_ops_reject_zombie_branch.

create_table_version resolves a branch via resolve_branch_for_commit: a
branch chain accepts a commit when the BranchContents ref already exists or
when the chain has no committed versions yet (the create_branch bootstrap,
whose first commit precedes its ref). A chain with versions but no ref is a
zombie and stays rejected.

Adds test_create_branch_on_managed_dataset_succeeds; managed zombie
rejection through create_table_version is already covered by
test_branch_ops_reject_zombie_branch.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added A-namespace Namespace impls bug Something isn't working labels Jun 23, 2026
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.69231% with 9 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
rust/lance-namespace-impls/src/dir.rs 82.69% 5 Missing and 4 partials ⚠️

📢 Thoughts on this report? Let us know!

@dantasse dantasse left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, looks like a good solution to me!

@jackye1995 jackye1995 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-namespace Namespace impls bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants