Skip to content

Fix branch snapshot isolation#32

Merged
congwang-mk merged 1 commit into
mainfrom
fix-branch-snapshot-isolation
May 19, 2026
Merged

Fix branch snapshot isolation#32
congwang-mk merged 1 commit into
mainfrom
fix-branch-snapshot-isolation

Conversation

@congwang-mk
Copy link
Copy Markdown
Contributor

@congwang-mk congwang-mk commented May 19, 2026

Summary

  • Each branch now captures a frozen snapshot of its parent's visible tree (delta + inherited view) at fork time into a per-branch inherited/ directory, instead of walking the live ancestor chain on every lookup.
  • resolve_path and collect_dir_names now consult only the branch's own delta plus its frozen inherited snapshot; the live base is only used by main. This makes a branch's view immune to subsequent writes on its parent.
  • Path resolution is refactored into _locked helpers so the snapshot can be built atomically while holding the branches lock; failure during snapshotting cleans up the partially-created branch directory.

Test plan

  • cargo test
  • tests/test_branch_dirs.sh
  • tests/test_commit.sh
  • Manual: create a branch, mutate parent, confirm branch's view is unchanged

🤖 Generated with Claude Code

Signed-off-by: Cong Wang <cwang@multikernel.io>
@congwang-mk congwang-mk merged commit 9ae8cc7 into main May 19, 2026
4 checks passed
@congwang-mk congwang-mk deleted the fix-branch-snapshot-isolation branch May 19, 2026 16:40
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.

1 participant