Fix review screen showing worktree branch instead of stored branch#492
Fix review screen showing worktree branch instead of stored branch#492
Conversation
The review screen's fetchReview() always resolved the branch via git name-rev, which can return a worktree branch when the same SHA is reachable from multiple refs. The queue view already handled this correctly by preferring the stored job.Branch. Apply the same priority in fetchReview(): use job.Branch first, fall back to the git lookup only when the stored value is empty. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
Address CI review feedback: - Extract branch resolution from fetchReview into a standalone reviewBranchName function so the logic is directly testable. - Replace the ineffective regression test with table-driven tests that exercise reviewBranchName for nil job, stored branch, range reviews, and missing repo path cases. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
GetReviewByJobID and GetReviewByCommitSHA omitted j.branch from their SELECT/Scan, so review.Job.Branch was always empty in the fetchReview path. The TUI helper reviewBranchName prefers the stored branch, but it was never populated, leaving the git name-rev fallback in effect. Add j.branch to both queries and scan it into job.Branch. Add storage-level tests verifying the branch round-trips through both GetReviewByJobID and GetReviewByCommitSHA. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
The TUI backfill path persists "(none)" as the branch for jobs where branch can't be resolved (task, dirty, remote, detached HEAD). reviewBranchName returned this sentinel verbatim, which would render as "on (none)" in the review header. Treat it as empty so the branch is omitted instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
When job.Branch is "(none)", the function fell through to the git name-rev lookup instead of returning empty, reintroducing the original wrong-branch display for sentinel-backed jobs with a local repo path. Check for the sentinel first and return "" immediately. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
roborev: Combined Review (
|
Summary
git name-rev, which can return a worktree branch when the same SHA is reachable from multiple refs. The queue view already handled this correctly by preferring the storedjob.Branch.fetchReview()now checksreview.Job.Branchfirst and only falls back togit.GetBranchName()when the stored value is empty (for older jobs that predate the Branch column).🤖 Generated with Claude Code