test(tui): stop sidebar tests from reading the checkout's git branch - #4231
Open
aheritier wants to merge 1 commit into
Open
test(tui): stop sidebar tests from reading the checkout's git branch#4231aheritier wants to merge 1 commit into
aheritier wants to merge 1 commit into
Conversation
aheritier
enabled auto-merge
September 10, 2026 16:56
sidebar.New reads os.Getwd() and that directory's git branch. In CI that is the repository checkout, and in the merge queue the branch is the 60-char gh-readonly-queue/main/pr-<n>-<sha>, which wraps the collapsed sidebar and shifts every row two layout tests assume (they passed on PRs and main only because the branch there was short). SetWorkingDirectoryForTesting swaps the three process reads for fixed values and disables the branch watcher; TestMain in the three packages that build a sidebar pins /work/app with no branch. A regression test documents the pin.
aheritier
force-pushed
the
test/sidebar-git-seam
branch
from
September 10, 2026 17:02
6e085d1 to
caee81a
Compare
trungutt
approved these changes
Sep 11, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to Branch Protection failures
Sep 11, 2026
You're not authorized to push to this branch. Visit "About protected branches" for more information.
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.
Why
The first merge-queue run (34500467587) failed
TestSidebar_HandleClickType_Usage_Collapsed_SharedLineandTestRoutedTimerExpiryDrivesSidebarOnOwnerPageon Linux and Windows.sidebar.Newreadsos.Getwd()and the git branch of that directory; in CI that is the repository checkout. On PR runs HEAD is detached (short commit), onmainthe branch ismain, and in the merge queue it is the 60-charactergh-readonly-queue/main/pr-4218-<sha>, which wraps the collapsed sidebar over a dozen lines and shifts every row the two tests assume. They had been passing by luck of a short branch name.What
sidebar.SetWorkingDirectoryForTesting(dir, branch)swaps the three process reads (os.Getwd,gitbranch.Current,gitbranch.Watch) for fixed values and disables the branch watcher; it returns a restore function.TestMaininpkg/tui/components/sidebar,pkg/tui/page/chatandpkg/tui(the three packages that construct a sidebar) pins/work/appwith no branch.TestNewIgnoresProcessGitStatedocuments the pin.Verified locally: injecting the merge-queue branch name through the seam reproduces the sidebar click failure; with the pin,
go test ./pkg/tui/...passes,task lintis clean.Not in this PR: a long branch name still wraps the collapsed sidebar for real users. Truncating it to the available width is a product change worth its own issue.