Skip to content

Conversation

@davidfirst
Copy link
Member

@davidfirst davidfirst commented Jan 13, 2026

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:

"If we don't block this, it's unclear what the export will do. Will it export also the staged components from previous lane? Will these snaps be related to the current lane only or also to the previous lane? What if the previous lane belongs to other scope, the export won't export the lane object, but it will export the components, which leaves the objects in an unexpected state."

Why it's fine now

  1. 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.

  2. 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.

  3. 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:

    • Without this change: User is stuck - can't export, can't create new lane
    • With this change: User can move forward with new lane, and can deal with old lane later (reset or delete it)

Changes

  • Remove throwForStagedComponents check from createLane()
  • The check still applies when switching from main (in switch-lanes.ts)
  • Added e2e tests for the diverged lane scenario including old lane state verification

…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.
Copilot AI review requested due to automatic review settings January 13, 2026 21:04
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 throwForStagedComponents validation check from the createLane() 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.

@davidfirst davidfirst enabled auto-merge (squash) January 14, 2026 15:57
@davidfirst davidfirst merged commit 0245155 into master Jan 14, 2026
12 checks passed
@davidfirst davidfirst deleted the fix/allow-lane-create-with-staged-components branch January 14, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants