fix(review): baseline worktree review at the actual parent branch (DAN-14)#39
Merged
Merged
Conversation
…N-14) The worktree Review flow hard-coded the base as the main worktree's branch, so a worktree cut from portal30 was reviewed against master's fork point and the diff swallowed all of portal30's own work. New Repo::detect_base_branch resolves the real parent: the branch reflog's 'Created from <ref>' entry when git recorded one (it survives graph shapes the scan can't disambiguate, e.g. the parent merged back in), else the local branch with the nearest merge-base. Candidates that contain the target rank last — baselining at the target's own tip would review nothing. Worktrees.review() now uses it and toasts which base it picked.
Right-clicking a non-HEAD branch can now pin the review baseline at merge-base(HEAD, that branch) and jump to the Review view — an explicit base choice that sidesteps auto-detection entirely.
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.
Summary
portal30was baselined at master's (older) fork point and the review swallowed all of portal30's own work (709 files instead of 3).Repo::detect_base_branch(target)in strand-core resolves the real parent: the branch reflog'sbranch: Created from <ref>entry when git recorded one (survives the parent being merged back in), else the local branch with the nearest merge-base. Candidates that contain the target (children / already-merged integration branches) rank last, since baselining at the target's own tip would review nothing. Exposed asrepo_detect_base_branch;Worktrees.review()now uses it and toasts which base it picked.merge-base(HEAD, branch)and jump to the Review view — an explicit base choice when auto-detection isn't what you want.Test plan
cargo test -p strand-core— 98/98, including newdetect_base_branch_prefers_the_actual_parent_over_maincovering: fork from a non-main branch, parent-merged-back-in (reflog beats scan), fresh branch with no commits, and a branch whose only nearer neighbor is its own child.cargo check -p strand-tauri— clean.pnpm lint(tsc -b) andpnpm test(vitest, 200/200) inui/.🤖 Generated with Claude Code