Skip to content

ci: restore --keep-lane in bit_pr - #10586

Open
zkochan wants to merge 1 commit into
teambit:masterfrom
zkochan:restore-keep-lane
Open

ci: restore --keep-lane in bit_pr#10586
zkochan wants to merge 1 commit into
teambit:masterfrom
zkochan:restore-keep-lane

Conversation

@zkochan

@zkochan zkochan commented Aug 8, 2026

Copy link
Copy Markdown
Member

Restores --keep-lane in the bit_pr CircleCI job, reverting the workaround introduced with the global-virtual-store PR (#10582).

What changes

- command: 'cd bit && bit ci pr --build --skip-cleanup'
+ command: 'cd bit && bit ci pr --build --keep-lane --skip-cleanup'

With --keep-lane, a PR keeps a single lane on Bit Cloud named after the branch, and each push re-snaps only the components that actually changed instead of rebuilding everything from a throwaway lane.

Why it was dropped, and what that means now

The reusing flow (snapAndExportReusingLane) serves components unchanged since an earlier export from the lane, with artifacts built from older commits of the branch. Capsules can then mix generations of @teambit packages, and cross-copy instanceof checks break in capsule spec runs — on a PR that snaps core components, bit_pr fails deterministically from the second push onward.

That underlying bug is still open (#10583); this PR restores the flag rather than fixing it. The inline comment now documents the hazard and the escape hatches (rename the branch for a fresh lane, or drop the flag on the affected PR) instead of documenting the workaround.

🤖 Generated with Claude Code

The GVS PR dropped --keep-lane to dodge the lane-reuse artifact mixing
tracked in teambit#10583. Restore lane reuse so a PR keeps one lane on Bit Cloud
and each push re-snaps only what changed; the comment now records the
hazard and how to recognize it instead of the workaround.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

CI: restore --keep-lane for bit_pr job

⚙️ Configuration changes 🕐 10-20 Minutes

Grey Divider

AI Description

• Re-enable --keep-lane in the bit_pr CircleCI job to reuse a branch lane across pushes.
• Document the known lane-reuse hazard (artifact mixing) and practical escape hatches.
• Improve PR build efficiency by re-snapping only changed components instead of rebuilding all.
Diagram

graph TD
  A["PR push"] --> B["CircleCI: bit_pr"] --> C["bit ci pr --keep-lane"] --> D[("Bit Cloud lane")] --> E["Re-snap changed comps"] --> F["Capsule tests"]
  D --> G["Reuse unchanged artifacts"] --> H["Mixed @teambit generations"] --> F
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Keep temp-lane PR builds (no --keep-lane)
2. Fix lane-reuse correctness in the reusing flow (#10583)
  • ➕ Retains speed benefits of lane reuse without the mixed-generation hazard.
  • ➕ Eliminates the need for branch-renaming or ad-hoc flag toggling.
  • ➖ Likely larger, riskier change spanning Bit build/export/capsule behavior.
  • ➖ Longer time-to-value than restoring the flag + documenting mitigations.
3. Conditional lane reuse in CI (heuristics/opt-out)
  • ➕ Keeps fast path for most PRs while reducing failures on core-snapping PRs.
  • ➕ Could be controlled via commit token / env var without editing YAML per PR.
  • ➖ Adds complexity and potential false positives/negatives in detection.
  • ➖ Still leaves the underlying reuse bug unresolved.

Recommendation: Restoring --keep-lane is reasonable as a performance-oriented revert, given the added inline documentation and mitigations (rename branch for a fresh lane or drop the flag for a problematic PR). If failures become frequent—especially on PRs that snap core components—prioritize addressing #10583 or introduce a CI-level opt-out mechanism to preserve throughput without recurring breakage.

Files changed (1) +8 / -7

Other (1) +8 / -7
config.ymlRestore lane reuse for bit_pr and document known hazard +8/-7

Restore lane reuse for bit_pr and document known hazard

• Re-adds '--keep-lane' to the 'bit ci pr' invocation in the 'bit_pr' CircleCI job to reuse a branch lane across pushes. Updates the surrounding comment to explain the known artifact-mixing failure mode while #10583 remains open and provides escape hatches.

.circleci/config.yml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Stale artifacts via keep-lane 🐞 Bug ☼ Reliability
Description
The bit_pr CircleCI job now forces bit ci pr into --keep-lane mode, reusing the same remote
lane across subsequent pushes instead of the temp-lane flow. Because reuse mode can install/use
previously-exported artifacts for unmodified components, PR checks can become non-reproducible
across pushes and fail due to mixed dependency generations.
Code

.circleci/config.yml[R865-866]

+          # branch (fresh lane) or drop --keep-lane on that PR.
+          command: 'cd bit && bit ci pr --build --keep-lane --skip-cleanup'
Evidence
The CircleCI config change enables --keep-lane for the bit_pr job. In the implementation,
keepLane switches execution from the temp-lane flow to snapAndExportReusingLane(), which reuses
an existing remote lane across commits. The isolator code documents behaviors that can rely on prior
run state for unmodified dependencies and notes failure modes when reusing a lane later; separately,
the codebase explicitly warns that instanceof breaks when the same package is loaded from
different sources—consistent with the mixed-generation capsule hazard described in the CI job
comment.

.circleci/config.yml[853-869]
scopes/git/ci/ci.main.runtime.ts[883-909]
scopes/component/isolator/isolator.main.runtime.ts[480-493]
scopes/component/isolator/isolator.main.runtime.ts[1748-1753]
components/component-issues/issues-list.ts[105-109]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The `bit_pr` CI job now always runs `bit ci pr` with `--keep-lane`, which switches into the remote-lane reuse flow. This can produce non-reproducible CI outcomes across pushes (stale/mixed artifacts), blocking PRs that hit the known hazard.

### Issue Context
`--keep-lane` is implemented as an opt-in behavior switch in `bit ci pr`. The repository already has logic and commentary indicating that reuse across runs can rely on earlier build/publish state for unmodified dependencies, and that mixed package sources can break `instanceof` checks.

### Fix Focus Areas
- .circleci/config.yml[859-866]

### Suggested change
Adjust the CircleCI command so `--keep-lane` is **opt-in** (e.g., controlled by an env var or pipeline parameter), while keeping the default path on the safer temp-lane flow.

Example approach (one option):
- Use a small shell conditional:
 - If `$BIT_CI_PR_KEEP_LANE == "1"`, add `--keep-lane`
 - Otherwise omit it
- Keep `--skip-cleanup` unchanged.

This preserves the speed benefit when explicitly enabled while preventing default PR validation from depending on persisted remote-lane state.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


To customize comments, go to the Qodo configuration screen, or learn more in the docs.

Qodo Logo

Comment thread .circleci/config.yml
Comment on lines +865 to +866
# branch (fresh lane) or drop --keep-lane on that PR.
command: 'cd bit && bit ci pr --build --keep-lane --skip-cleanup'

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Stale artifacts via keep-lane 🐞 Bug ☼ Reliability

The bit_pr CircleCI job now forces bit ci pr into --keep-lane mode, reusing the same remote
lane across subsequent pushes instead of the temp-lane flow. Because reuse mode can install/use
previously-exported artifacts for unmodified components, PR checks can become non-reproducible
across pushes and fail due to mixed dependency generations.
Agent Prompt
### Issue description
The `bit_pr` CI job now always runs `bit ci pr` with `--keep-lane`, which switches into the remote-lane reuse flow. This can produce non-reproducible CI outcomes across pushes (stale/mixed artifacts), blocking PRs that hit the known hazard.

### Issue Context
`--keep-lane` is implemented as an opt-in behavior switch in `bit ci pr`. The repository already has logic and commentary indicating that reuse across runs can rely on earlier build/publish state for unmodified dependencies, and that mixed package sources can break `instanceof` checks.

### Fix Focus Areas
- .circleci/config.yml[859-866]

### Suggested change
Adjust the CircleCI command so `--keep-lane` is **opt-in** (e.g., controlled by an env var or pipeline parameter), while keeping the default path on the safer temp-lane flow.

Example approach (one option):
- Use a small shell conditional:
  - If `$BIT_CI_PR_KEEP_LANE == "1"`, add `--keep-lane`
  - Otherwise omit it
- Keep `--skip-cleanup` unchanged.

This preserves the speed benefit when explicitly enabled while preventing default PR validation from depending on persisted remote-lane state.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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.

1 participant