fix(web): scope PR state to the thread branch#4460
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| @@ -593,7 +593,6 @@ export function BranchToolbarBranchSelector({ | |||
| const branchPr = resolveThreadPr({ | |||
| threadBranch: resolvedActiveBranch, | |||
There was a problem hiding this comment.
🟡 Medium components/BranchToolbarBranchSelector.tsx:594
resolveThreadPr is called with resolvedActiveBranch, which falls back to currentGitBranch via resolveBranchToolbarValue. When the thread has no stored branch, resolvedActiveBranch equals gitStatus.refName, so the PR pill displays even though no thread-branch association exists — exactly the behavior the hasDedicatedWorktree removal was meant to eliminate. Pass activeThreadBranch instead so the PR only shows when the thread has an explicit stored branch.
🚀 Reply "fix it for me" or copy this AI Prompt for your agent:
In file @apps/web/src/components/BranchToolbarBranchSelector.tsx around line 594:
`resolveThreadPr` is called with `resolvedActiveBranch`, which falls back to `currentGitBranch` via `resolveBranchToolbarValue`. When the thread has no stored branch, `resolvedActiveBranch` equals `gitStatus.refName`, so the PR pill displays even though no thread-branch association exists — exactly the behavior the `hasDedicatedWorktree` removal was meant to eliminate. Pass `activeThreadBranch` instead so the PR only shows when the thread has an explicit stored branch.
What changed
Why
A dedicated worktree could temporarily switch to a stacked PR's head branch while the thread retained its original base branch. The UI bypassed its branch consistency check for dedicated worktrees, combining the persisted base-branch label with the live checkout's PR badge.
This could also feed the unrelated PR's merged or closed state into automatic thread settlement.
Impact
Threads no longer display or settle from a PR belonging to a different live checkout. PR indicators remain visible when the live checkout matches the thread branch.
Validation
vp test run apps/web/src/components/ThreadStatusIndicators.test.tsvp lint --report-unused-disable-directivesfor the six changed filesvp run --filter @t3tools/web typecheckgit diff --checkAn isolated T3 web environment launched and authenticated successfully. Browser-level inspection could not complete because collaborative preview snapshots timed out and the documented fallback reported no available browser backend.
Note
Fix
resolveThreadPrto scope PR state to the thread branchPreviously,
resolveThreadPrcould return a PR when a dedicated worktree existed, regardless of which branch was checked out. It now returns a PR only whengitStatus.refNamematches the storedthreadBranch, and returns null ifthreadBranchis null or mismatched.hasDedicatedWorktreeparameter is removed fromresolveThreadPrin ThreadStatusIndicators.tsx and all call sites.📊 Macroscope summarized 463d7de. 4 files reviewed, 0 issues evaluated, 0 issues filtered, 0 comments posted
🗂️ Filtered Issues
No issues evaluated.