fix: derive branch live from git, skip stale PRs - #8
Merged
Conversation
Branch was set once at creation and never updated, causing stale values after `git branch -m`. All callsites now query git.CurrentBranch() live. Old state files with "branch" are silently ignored by Go's JSON decoder (no migration needed).
gh pr view matches by branch name, so reusing a branch name after a squash merge would show the old merged PR. Now we fetch headRefOid and verify the PR's head commit is an ancestor of the local branch tip before returning it.
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.
What
Two fixes for stale data in workspace status displays:
Branchfrom stored workspace state — derive it live from gitWhy
Stale branch names:
Branchwas set once at workspace creation and never updated. Renaming a branch withgit branch -mleft the TUI,ws list,ws status, and MCP tools showing the wrong name.Stale PR badges:
gh pr view <branch>matches by name, not commit history. Reusing a branch name after a squash merge would incorrectly show the old merged PR.How
Branch removal
Branch stringfromstate.Workspacestructgit.CurrentBranch(ws.Path)to get the live branchBranchfield to TUI'sworkspaceItemfor derived (non-stored) data"branch"in their contract, populated from gitarchive, branch is captured before worktree removal"branch"load finePR ancestry check
PRStatusnow fetchesheadRefOidfrom the PRgit merge-base --is-ancestor <head-sha> HEADto verify the PR's head commit is in the branch's historyTest plan
bin/cipasses (build, vet, test, lint, tidy)fr8 dashboardshows correct branch; rename a branch, refresh, confirm it updates