Skip to content

fix(lanes): bit status crash after change-scope on a forked lane#10401

Closed
davidfirst wants to merge 1 commit into
masterfrom
fix-status-crash-forked-lane-change-scope
Closed

fix(lanes): bit status crash after change-scope on a forked lane#10401
davidfirst wants to merge 1 commit into
masterfrom
fix-status-crash-forked-lane-change-scope

Conversation

@davidfirst
Copy link
Copy Markdown
Member

Running bit status after bit lane importbit lane createbit lane change-scope crashed with:

error: a remote of "<comp>" points to <hash>, which is missing from the VersionHistory object for some reason.
running "bit import" should fix the issue.

Cause: when a forked lane is rescoped to a scope different from the original lane, calculateRemote() (in model-component.ts) handled only the same-scope fork explicitly and let the cross-scope case fall through to comparing against the component's main-head. For components that live on a different scope than the lane, that main-head object isn't fetched by bit lane import (it's on a branch not reachable from the lane), so it's absent from the VersionHistory object and the divergence computation threw TargetHeadNotFound.

Fix: cross-scope forks now return null (no remote baseline → all snaps treated as local/staged, to be re-exported to the new scope). This matches the documented intent of the original forkedFrom.scope === lane.scope guard and avoids the fragile missing-object comparison. Same-scope forks and non-forked lanes are unchanged.

Added an e2e regression test that reproduces the exact error without the fix and passes with it.

When a forked lane is rescoped (bit lane change-scope) to a scope different
from the original lane, calculateRemote() fell through to comparing against
the component's main-head. For components living on a different scope than the
lane, that main-head object isn't fetched by "bit lane import", so status threw
TargetHeadNotFound. Now cross-scope forks return null (all snaps treated as
local/staged), matching the documented intent and avoiding the missing-object
comparison.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 29, 2026 14:45
Copy link
Copy Markdown
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 lane status crash when a newly forked lane is changed to a different target scope. It updates remote-baseline calculation so cross-scope forked lanes are treated as having no remote baseline, allowing all lane snaps to be staged for re-export instead of comparing against a potentially missing main head.

Changes:

  • Adds a cross-scope fork guard in calculateRemote() to return null.
  • Adds an e2e regression covering lane import → fork → change-scopestatus.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
scopes/scope/objects/models/model-component.ts Adjusts lane remote-head calculation for cross-scope forked lanes.
e2e/harmony/lanes/lane-management.e2e.ts Adds regression coverage for the prior bit status crash and staged status behavior.

@davidfirst
Copy link
Copy Markdown
Member Author

It's gonna be part of this PR: #10390. Closing this.

@davidfirst davidfirst closed this May 29, 2026
@davidfirst davidfirst deleted the fix-status-crash-forked-lane-change-scope branch May 29, 2026 19:17
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.

2 participants