Skip to content

feat(repo): cherry-pick and rebase on a partial clone (P37c-iv) - #185

Merged
tonibergholm-codento merged 3 commits into
mainfrom
p37c-iv
Oct 18, 2026
Merged

tonibergholm-codento merged 3 commits into
mainfrom
p37c-iv

Conversation

@tonibergholm

@tonibergholm tonibergholm commented Oct 18, 2026 •

Copy link
Copy Markdown
Member

Summary

sc cherry-pick and sc rebase (with --continue and --abort) now work on a partial clone, on the engine and conflict contract of ADR-0049 decisions 2 to 8. Design in decision 10, added here.

  • replay_commit calls the tree engine on a partial clone: base is the commit's parent, ours the onto tree, theirs the commit. Carried subtrees are never read; a differing region is filled by id when lazy and a gap error otherwise.
  • The rebase fold's accumulator may hold absent subtrees; the view is filled before the final write.
  • A stopped pick or rebase keeps its carried subtrees in the decided root, with the same three refusals as merge. Completion grafts the out-of-view part from it.
  • Abort checks the view before removing anything. Sidecar cleanup is one shared helper that never deletes a file a tree tracks; this also fixes rebase --continue and cherry-pick --abort.
  • Sessions (sc ws, sc work) stay refused.

Tests

  • partial_replay.rs: each result compared by root tree id with the same operation on a full repo. Carried subtree never fetched, differing region (lazy fills, non-lazy refuses), conflict in view completes like a full pick, abort and a view gap on abort, carried protected subtree keeps wraps, rebase carries the target's subtree through every step, rebase stop/abort/resolve/continue, in-view carried subtrees filled on pick and rebase.
  • CLI: cherry_pick_and_rebase_work_on_a_partial_clone; backfill_all_lifts_partial_clone_refusals now uses sparse disable as the refused op.
  • Demo section 11.
  • Mutation checks: dropping ensure_view from the pick path or the fold, and grafting from the tip instead of the decided root, each fail a test.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Cherry-pick and rebase now work on partial clones, including conflict resolution with continue and abort. Operations preserve content outside the sparse view without fetching it unnecessarily.
    • Partial-clone replay still refuses operations that require unavailable content outside the view, including rebases containing merge commits.
  • Bug Fixes
    • Improved conflict cleanup during abort and completion, retaining sidecar files when they’re still tracked.

replay_commit, the one place cherry-pick and the rebase fold reach the
file merge, now uses the pull-based tree engine on a partial clone. A
subtree the sides agree on is carried by id, a region both touched is
read (filled by id on a lazy clone, a gap error otherwise), and the
result keeps the complete wrap union when anything was carried.

A stopped pick or rebase keeps its carried subtrees in the decided root
and applies the same refusals as a stopped merge. Completion grafts the
out-of-view part from the decided root. The final write fills the view
first, and abort checks it before removing anything. Sidecar cleanup is
shared and never removes a file a tree tracks, which also fixes it for
rebase --continue.

ADR-0049 decision 10 records the design.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T14:05:26.256131Z 2b087ec New commits
🔒 Security Review ✅ Completed 2026-10-18T14:07:55.078399Z 2b087ec New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: dfdf362b-29cc-45e6-8b45-47d5fedd92b5
📥 Commits

Reviewing files that changed from the base of the PR and between a7d4898 and 2b087ec.

📒 Files selected for processing: 11
  • CLAUDE.md
  • ROADMAP.md
  • crates/cli/tests/partial_clone_safety.rs
  • crates/repo/src/lib.rs
  • crates/repo/src/partial_merge.rs
  • crates/repo/src/partial_replay.rs
  • crates/repo/src/replay.rs
  • crates/repo/src/repo.rs
  • demo/run_lazy_fetch_demo.sh
  • docs/adr/0049-merge-on-partial-clones.md
  • docs/adr/README.md
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Find bugs once. Once a human tester finds a bug, it should be the last time a human tester finds that bug. Automatic tests should check for it from then on. |
+--------------------------------------------------------------------------------------------------------------------------------------------------------------+
  \
   \     /)/)
        ( '')
        /  |
      o(___)
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

tonibergholm and others added 2 commits October 18, 2026 16:56
…ided root

The guard checked the merge head and the decided root but not the pick
head, so a stopped pick whose decided-root file was gone completed by
grafting from the tip and silently kept the old out-of-view content.
Refuse instead; --abort still clears the state. ADR-0049 records three
existing full-clone defects the review found (q18 to q20).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Pick, rebase and merge aborts now remove only sidecars the restored tree
does not track, and rebase --continue only those its completion parent
does not track. Wider sets kept a sidecar the next commit would sweep in.
Adds tests for a rebase abort that hits a view gap and a two-step rebase
over a carried protected subtree, and fixes a stale comment and ADR
reference.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@tonibergholm-codento
tonibergholm-codento merged commit 7133d51 into main Oct 18, 2026
7 of 8 checks passed
@tonibergholm
tonibergholm deleted the p37c-iv branch October 18, 2026 14:14
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.

2 participants