Repository navigation
Cover project-checkout's branch-switch refusals against real git states - #6948
Merged
ymichael merged 1 commit intoNov 3, 2026
Conversation
The host attach path refused detached HEAD, in-progress operations and conflicts, but only the dirty refusal had a test against a real repository. The server-side refusals were tested with mocked inspection results, so nothing exercised the shared checkout inspection from #6937 through the plugin for these states. Add host tests that build a detached HEAD, a merge in progress, a merge with conflicts and a conflicted rebase in real repositories, check what inspectCheckout reports, and assert the exact refusal and that HEAD did not move. A real rebase detaches HEAD, so it is refused by the detached check; the test records that. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ymichael
deleted the
bb/verify-project-checkout-branch-switch-refusals-a-thr_cnnhj7pme4
branch
November 3, 2026 21:51
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.
Human comments
What was wrong
#6937 replaced the checkout inspection in
environment-project-checkout(current ref, uncommitted changes, in-progress operation, conflicts) with the shared implementation inbb-environment-provider-host/workspace-git. Before the plugin runsgit switchin a user's real checkout, the host'sassertSwitchableuses that inspection to refuse a switch on a detached HEAD, during a merge or rebase, with conflicts, or with uncommitted changes. Only the uncommitted-changes refusal had a host test against a real repository. The server-sidevalidaterefusals are tested with mockedinspectCheckoutresults, so no plugin test ran the shared inspection on real detached, merge, conflict or rebase states.What changed
Test-only.
plugins/environment-project-checkout/host.test.tsgains four host tests. Each builds a real repository state, checks whatinspectCheckoutreports, attaches with an existing-branch switch, asserts the exact refusal message, and checks that HEAD did not move:checkout: detached; refused as detachedmerge --no-commitin progress →merge, no conflicts; refused as merge in progressmerge, with conflicts; refused for unresolved conflictsrebase, with conflicts,checkout: detached. git detaches HEAD during a rebase, so the detached check refuses it first. That was also true before Delete composer and git move leftovers from core #6937; the test records it.No production, protocol, SDK or CLI change.
How you verified
host/checkout.tsin turn:pnpm exec turbo run test typecheck lint --filter=bb-plugin-environment-project-checkoutpasses.pnpm start:worktreeinstance (new data dir) with scratch repos, usingbb thread spawn --environment-provider project-checkout --environment-inputs '{"branch":{"kind":"existing","name":"release"}}':validatereturned HTTP 409 with:Checkout blocked while HEAD is detached(detached),…by uncommitted changes(dirty),…by an in-progress merge(merge),…by unresolved conflicts(conflicted merge),…while HEAD is detached(rebase).attach: threads were spawned deferred while the repos were clean, each repo was then broken, and the threads were dispatched. Provisioning failed with:Cannot checkout branch while the workspace is on a detached HEAD(detached and rebase),…has uncommitted changes,…merge is in progress,…merge has unresolved conflicts.git status.release. Provisioning logged "Switched to branch release" and the environment wasreadywithbranchName: release.🤖 Generated with Claude Code