fix(lanes): allow creating a new lane when current lane has staged/diverged components#10155
Merged
Merged
Conversation
…verged components Previously, `bit lane create` was blocked when the current lane had unexported snaps, even in valid scenarios like when the remote had diverged and you wanted to fork your work to a new lane. This aligns with Git's behavior where you can always create a new branch regardless of uncommitted or unpushed work.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a workflow limitation by allowing users to create a new lane when their current lane has unexported snaps or has diverged from the remote. Previously, users were blocked with an error message requiring them to export or reset components first.
Changes:
- Removed the
throwForStagedComponentsvalidation check from thecreateLane()function, enabling lane creation with uncommitted changes - Updated the existing test case to reflect the new behavior where creating a lane with staged components now succeeds
- Added comprehensive e2e tests for the diverged lane scenario, simulating parallel development across two workspaces
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| scopes/lanes/modules/create-lane/create-lane.ts | Removed the throwForStagedComponents validation check, allowing lane creation with staged/diverged components |
| e2e/harmony/lanes/lane-from-lane.e2e.ts | Updated test expectations to allow lane creation with staged components and added new test suite for diverged lane scenario |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
GiladShoham
approved these changes
Jan 14, 2026
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.
When a lane has unexported snaps or has diverged from the remote (e.g., another workspace pushed changes), users were blocked from creating a new lane with the error "please export or reset the following components first".
This is a valid use case - the user wants to fork their work to a new lane rather than merge with the diverged remote.
Background
This restriction was introduced in #6931 with the following concerns:
Why it's fine now
Export behavior: When creating a new lane, the bitmap heads (including local snaps) are copied to the new lane. Exporting the new lane exports those snaps as part of the new lane only. The old lane object is not exported, so it's not modified on the remote.
Scope mismatch: If the new lane has a different scope, the lane and components will be exported to their respective scopes correctly. This is standard behavior.
Old lane state: The old lane is left with staged components that show as "export-pending". This is the same confusing state that exists regardless of whether we allow lane creation - the divergence already happened. The difference is:
Changes
throwForStagedComponentscheck fromcreateLane()switch-lanes.ts)