@teambit/ci 1.0.494 → 1.0.497

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/ci.docs.mdx +39 -9
  2. package/dist/ci.docs.mdx +39 -9
  3. package/dist/ci.main.runtime.d.ts +6 -0
  4. package/dist/ci.main.runtime.js +24 -3
  5. package/dist/ci.main.runtime.js.map +1 -1
  6. package/dist/{preview-1786400681343.js → preview-1786718956243.js} +1 -1
  7. package/dist/sync/git-ops.d.ts +41 -0
  8. package/dist/sync/git-ops.js +71 -0
  9. package/dist/sync/git-ops.js.map +1 -1
  10. package/dist/sync/git-ops.spec.js +39 -0
  11. package/dist/sync/git-ops.spec.js.map +1 -1
  12. package/dist/sync/lane-sync-executor.d.ts +81 -15
  13. package/dist/sync/lane-sync-executor.js +315 -50
  14. package/dist/sync/lane-sync-executor.js.map +1 -1
  15. package/dist/sync/lane-sync-executor.spec.js +235 -13
  16. package/dist/sync/lane-sync-executor.spec.js.map +1 -1
  17. package/dist/sync/main-sync-executor.js +30 -6
  18. package/dist/sync/main-sync-executor.js.map +1 -1
  19. package/dist/sync/sync-planner.d.ts +10 -1
  20. package/dist/sync/sync-planner.js +37 -13
  21. package/dist/sync/sync-planner.js.map +1 -1
  22. package/dist/sync/sync-planner.spec.js +44 -2
  23. package/dist/sync/sync-planner.spec.js.map +1 -1
  24. package/dist/sync/sync-state.d.ts +33 -1
  25. package/dist/sync/sync-state.js +60 -3
  26. package/dist/sync/sync-state.js.map +1 -1
  27. package/dist/sync/sync-state.spec.js +28 -0
  28. package/dist/sync/sync-state.spec.js.map +1 -1
  29. package/package.json +20 -20
  30. package/sync/git-ops.spec.ts +60 -0
  31. package/sync/git-ops.ts +72 -0
  32. package/sync/lane-sync-executor.spec.ts +215 -9
  33. package/sync/lane-sync-executor.ts +354 -47
  34. package/sync/main-sync-executor.ts +37 -5
  35. package/sync/sync-planner.spec.ts +36 -1
  36. package/sync/sync-planner.ts +36 -16
  37. package/sync/sync-state.spec.ts +33 -0
  38. package/sync/sync-state.ts +62 -1
@@ -21,6 +21,29 @@ function _syncConfig() {
21
21
  };
22
22
  return data;
23
23
  }
24
+ /**
25
+ * One stub executor for every seam-based test: real executor code over stubbed deps, no repository.
26
+ * `warnings` collects `consoleWarning` lines for tests that assert on them.
27
+ */
28
+ function stubExecutor() {
29
+ const warnings = [];
30
+ const executor = new (_laneSyncExecutor().LaneSyncExecutor)({
31
+ lanes: {},
32
+ ci: {},
33
+ logger: {
34
+ console: () => {},
35
+ consoleWarning: msg => warnings.push(msg),
36
+ error: () => {}
37
+ },
38
+ gitHost: undefined,
39
+ cfg: (0, _syncConfig().resolveSyncConfig)({}),
40
+ defaultScope: 'acme.shop'
41
+ });
42
+ return {
43
+ executor,
44
+ warnings
45
+ };
46
+ }
24
47
  /** A stand-in for `LaneData`'s component entry; the helpers only read the id string, scope and head. */
25
48
  function comp(id, head) {
26
49
  return {
@@ -326,20 +349,11 @@ describe('close-pr re-verifies the tip before retiring a branch', () => {
326
349
  const EVIDENCE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';
327
350
  const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';
328
351
  function retirer(currentTip, pushError) {
329
- const warnings = [];
352
+ const {
353
+ executor,
354
+ warnings
355
+ } = stubExecutor();
330
356
  const pushes = [];
331
- const executor = new (_laneSyncExecutor().LaneSyncExecutor)({
332
- lanes: {},
333
- ci: {},
334
- logger: {
335
- console: () => {},
336
- consoleWarning: msg => warnings.push(msg),
337
- error: () => {}
338
- },
339
- gitHost: undefined,
340
- cfg: (0, _syncConfig().resolveSyncConfig)({}),
341
- defaultScope: 'acme.shop'
342
- });
343
357
  executor.currentBranchTip = async () => currentTip;
344
358
  executor.pushBranchDeletion = async (branch, sha) => {
345
359
  pushes.push([branch, sha]);
@@ -403,6 +417,214 @@ describe('close-pr re-verifies the tip before retiring a branch', () => {
403
417
  (0, _chai().expect)(await closePr()).to.equal('my-lane -> close-pr (no open PR, branch my-lane left in place)');
404
418
  });
405
419
  });
420
+ describe('differentLaneStillClaims uses .bitmap blob equality, not commit reachability', () => {
421
+ function executorWithInheritance(inherited) {
422
+ const executor = new (_laneSyncExecutor().LaneSyncExecutor)({
423
+ lanes: {},
424
+ ci: {},
425
+ logger: {
426
+ console: () => {},
427
+ consoleWarning: () => {},
428
+ error: () => {}
429
+ },
430
+ gitHost: undefined,
431
+ cfg: (0, _syncConfig().resolveSyncConfig)({}),
432
+ defaultScope: 'acme.shop'
433
+ });
434
+ executor.branchInheritsBitmapFromDefault = async () => inherited;
435
+ return (mirroredLane, laneIdStr) => executor.differentLaneStillClaims(mirroredLane, laneIdStr, 'my-branch', 'main');
436
+ }
437
+ it('does not claim when there is no mirrored lane pointer at all — never even checks the blob', async () => {
438
+ const differentLaneStillClaims = executorWithInheritance(true);
439
+ (0, _chai().expect)(await differentLaneStillClaims(undefined, 'acme.shop/my-lane')).to.equal(false);
440
+ });
441
+ it("does not claim for this lane's own pointer — never even checks the blob", async () => {
442
+ const differentLaneStillClaims = executorWithInheritance(true);
443
+ (0, _chai().expect)(await differentLaneStillClaims('acme.shop/my-lane', 'acme.shop/my-lane')).to.equal(false);
444
+ });
445
+ it("does not claim when the different-lane .bitmap is byte-identical to the default branch's — inherited", async () => {
446
+ const differentLaneStillClaims = executorWithInheritance(true);
447
+ (0, _chai().expect)(await differentLaneStillClaims('acme.shop/other-lane', 'acme.shop/my-lane')).to.equal(false);
448
+ });
449
+ it("STILL claims when the different-lane .bitmap has diverged from the default branch's — halt, not adopt", async () => {
450
+ const differentLaneStillClaims = executorWithInheritance(false);
451
+ (0, _chai().expect)(await differentLaneStillClaims('acme.shop/other-lane', 'acme.shop/my-lane')).to.equal(true);
452
+ });
453
+ });
454
+ describe('computeHasIndependentHistory gates the ancestry check to own-live claims with a state commit', () => {
455
+ function executorWithAncestryResult(result) {
456
+ const calls = [];
457
+ const executor = new (_laneSyncExecutor().LaneSyncExecutor)({
458
+ lanes: {},
459
+ ci: {},
460
+ logger: {
461
+ console: () => {},
462
+ consoleWarning: () => {},
463
+ error: () => {}
464
+ },
465
+ gitHost: undefined,
466
+ cfg: (0, _syncConfig().resolveSyncConfig)({}),
467
+ defaultScope: 'acme.shop'
468
+ });
469
+ executor.hasIndependentHistoryBelowStateCommit = async (stateCommit, defaultBranch) => {
470
+ calls.push([stateCommit, defaultBranch]);
471
+ return result;
472
+ };
473
+ const compute = (ownership, stateCommit, defaultBranch) => executor.computeHasIndependentHistory(ownership, stateCommit, defaultBranch);
474
+ return {
475
+ compute,
476
+ calls
477
+ };
478
+ }
479
+ it('skips the ancestry check entirely for a reachable claim (own-merged)', async () => {
480
+ const {
481
+ compute,
482
+ calls
483
+ } = executorWithAncestryResult(true);
484
+ (0, _chai().expect)(await compute('own-merged', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(false);
485
+ (0, _chai().expect)(calls).to.deep.equal([]);
486
+ });
487
+ it('skips the ancestry check entirely for own-superseded too', async () => {
488
+ const {
489
+ compute,
490
+ calls
491
+ } = executorWithAncestryResult(true);
492
+ (0, _chai().expect)(await compute('own-superseded', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(false);
493
+ (0, _chai().expect)(calls).to.deep.equal([]);
494
+ });
495
+ it('skips the check when there is no state commit to inspect, even for an own-live claim', async () => {
496
+ const {
497
+ compute,
498
+ calls
499
+ } = executorWithAncestryResult(true);
500
+ (0, _chai().expect)(await compute('own-live', undefined, 'main')).to.equal(false);
501
+ (0, _chai().expect)(calls).to.deep.equal([]);
502
+ });
503
+ it('defers to the ancestry check for an own-live claim with a state commit', async () => {
504
+ const {
505
+ compute,
506
+ calls
507
+ } = executorWithAncestryResult(true);
508
+ (0, _chai().expect)(await compute('own-live', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(true);
509
+ (0, _chai().expect)(calls).to.deep.equal([['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main']]);
510
+ });
511
+ });
512
+ describe('classifyPushRejection confirms a race before calling it one', () => {
513
+ const BASE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';
514
+ const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';
515
+ const REJECTION = new Error('! [rejected] HEAD -> feature (fetch first)\nerror: failed to push some refs');
516
+ function classifier(currentTip) {
517
+ const {
518
+ executor
519
+ } = stubExecutor();
520
+ executor.currentBranchTip = async () => currentTip;
521
+ return (baseSha, e) => executor.classifyPushRejection('my-branch', baseSha, e);
522
+ }
523
+ it('confirms the race when the branch actually moved off the base we pushed against', async () => {
524
+ const classify = classifier(MOVED_SHA);
525
+ (0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('confirmed-race');
526
+ });
527
+ it('confirms the race for a brand-new branch that now exists on the remote', async () => {
528
+ const classify = classifier(MOVED_SHA);
529
+ (0, _chai().expect)(await classify(undefined, REJECTION)).to.equal('confirmed-race');
530
+ });
531
+
532
+ // Message-text matching alone is not proof: a persistent, unrelated rejection could repeat the same
533
+ // wording forever. Without this re-fetch-and-compare, that would go permanently green.
534
+ it('answers not-a-race when the branch did NOT move — the wording matched but nothing raced', async () => {
535
+ const classify = classifier(BASE_SHA);
536
+ (0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');
537
+ });
538
+ it('answers not-a-race when a brand-new branch still does not exist on the remote', async () => {
539
+ const classify = classifier(undefined);
540
+ (0, _chai().expect)(await classify(undefined, REJECTION)).to.equal('not-a-race');
541
+ });
542
+
543
+ // The polarity bug this guards: `currentTip === undefined` here means the re-fetch FAILED (network
544
+ // blip, auth hiccup) — unknown, not evidence the branch moved. `undefined !== baseSha` reads as
545
+ // truthy if compared naively, which would misreport an unanswerable check as a confirmed race and
546
+ // paper over a real, persistent failure. Withhold like every other unknown-answer path in this file.
547
+ it('answers not-a-race when the re-fetch itself fails, even though a base sha is known', async () => {
548
+ const classify = classifier(undefined);
549
+ (0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');
550
+ });
551
+ it('answers not-a-race for a rejection whose wording is not a non-fast-forward race at all', async () => {
552
+ const classify = classifier(MOVED_SHA);
553
+ const unrelated = new Error('remote: GH006: Protected branch update failed');
554
+ (0, _chai().expect)(await classify(BASE_SHA, unrelated)).to.equal('not-a-race');
555
+ });
556
+ });
557
+
558
+ // The live incident's actual shape: the snap/export onto the lane already succeeded — the lane truly
559
+ // moved — and only the branch's OWN ledger-commit push (recordLaneHeadOnBranch) lost the race. Nothing
560
+ // exercised `racedLedgerPushSummary` before this; a wording regression there would have gone unnoticed.
561
+ describe('executeExportBranch reports the ledger-race wording when only the ledger push races', () => {
562
+ it('surfaces "lane updated; branch ledger commit lost the push race" without halting', async () => {
563
+ const {
564
+ executor
565
+ } = stubExecutor();
566
+ executor.lastNonSyncCommitMessage = async () => 'feat: some change';
567
+ executor.checkoutFromRemote = async () => {};
568
+ executor.restoreWorkspace = async () => {};
569
+ // The export half already succeeded; only the ledger commit that follows raced.
570
+ executor.snapAndExportOntoLane = async () => ({
571
+ status: 'exported'
572
+ });
573
+ executor.recordLaneHeadOnBranch = async () => ({
574
+ status: 'raced'
575
+ });
576
+ const summary = await executor.executeExportBranch({
577
+ target: {
578
+ hostScope: 'acme.shop',
579
+ name: 'my-lane'
580
+ },
581
+ laneIdStr: 'acme.shop/my-lane',
582
+ branch: 'my-lane',
583
+ defaultBranch: 'main'
584
+ });
585
+ (0, _chai().expect)(summary).to.equal('my-lane -> raced (lane updated; branch ledger commit lost the push race — next run re-plans)');
586
+ (0, _chai().expect)(summary).to.not.include('HALTED');
587
+ });
588
+ });
589
+
590
+ // Adoption never snaps or exports, so its raced line must NOT claim the lane was updated — the lane
591
+ // is untouched and only the branch's pointer commit lost the race.
592
+ describe('executeAdoptBranch reports a lane-untouched race when its ledger push races', () => {
593
+ it('surfaces "lane untouched; adoption ledger commit lost the push race" without halting', async () => {
594
+ const {
595
+ executor
596
+ } = stubExecutor();
597
+ executor.deps.ci = {
598
+ hasUnsyncedWorkChanges: async () => false
599
+ };
600
+ executor.checkoutFromRemote = async () => {};
601
+ executor.restoreWorkspace = async () => {};
602
+ executor.materializeLane = async () => undefined;
603
+ executor.recordLaneHeadOnBranch = async () => ({
604
+ status: 'raced'
605
+ });
606
+ const summary = await executor.executeAdoptBranch({
607
+ target: {
608
+ hostScope: 'acme.shop',
609
+ name: 'my-lane'
610
+ },
611
+ laneIdStr: 'acme.shop/my-lane',
612
+ branch: 'my-lane',
613
+ defaultBranch: 'main'
614
+ });
615
+ (0, _chai().expect)(summary).to.equal('my-lane -> raced (lane untouched; adoption ledger commit lost the push race — next run re-plans)');
616
+ (0, _chai().expect)(summary).to.not.include('lane updated');
617
+ (0, _chai().expect)(summary).to.not.include('HALTED');
618
+ });
619
+ });
620
+
621
+ // A destructive auto-resolution (onConflict git-wins/lane-wins) that already exported must not vanish
622
+ // from the summary just because the ledger push raced.
623
+ describe('racedLedgerPushSummary keeps the conflict-policy clause', () => {
624
+ it('carries the merge path’s policyClause through the raced ledger line', () => {
625
+ (0, _chai().expect)((0, _laneSyncExecutor().racedLedgerPushSummary)('my-lane', 'conflicts auto-resolved: git-wins on 3 file(s); ')).to.equal('my-lane -> raced (conflicts auto-resolved: git-wins on 3 file(s); lane updated; branch ledger commit ' + 'lost the push race — next run re-plans)');
626
+ });
627
+ });
406
628
  describe('isProtectedBranch', () => {
407
629
  it('refuses the default branch and the main sync branch', () => {
408
630
  (0, _chai().expect)((0, _laneSyncExecutor().isProtectedBranch)('develop', 'develop', 'bit-sync/main')).to.equal(true);
@@ -1 +1 @@
1
- {"version":3,"names":["_chai","data","require","_laneSyncExecutor","_syncConfig","comp","id","head","toStringWithoutVersion","scope","split","describe","a","b","it","fingerprint","laneHeadFingerprint","expect","to","match","equal","moved","not","DEFAULT_SCOPE","ours","theirs","foreignLaneComponents","deep","namespaced","description","crossScopeDescription","include","ids","Array","from","length","_","index","LANE_HEAD","body","componentCount","laneSyncPrBody","laneIdStr","laneUrl","branch","laneHead","components","repeat","rendered","be","below","FOREIGN","summary","crossScopeSkipSummary","refusal","crossScopeRefusal","reason","crossScopeMidFlightHaltReason","branchMirrorsOtherLaneReason","note","branchMirrorsOtherLaneNote","throwingExecutor","gitHostCalls","noopLogger","console","consoleWarning","error","debug","executor","LaneSyncExecutor","lanes","ci","getDefaultBranchName","Error","logger","gitHost","name","findPrByBranch","push","number","htmlUrl","labels","addLabel","comment","cfg","resolveSyncConfig","defaultScope","fetched","syncLane","hostScope","dryRun","LANE_NAME","haltCommentBody","laneId","line","dryRunSummaryLine","type","forEach","contain","deleteBranch","EVIDENCE_SHA","MOVED_SHA","retirer","currentTip","pushError","warnings","pushes","msg","undefined","currentBranchTip","pushBranchDeletion","sha","closePr","executeClosePr","laneName","defaultBranch","expectedTipSha","join","isProtectedBranch"],"sources":["lane-sync-executor.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport {\n branchMirrorsOtherLaneNote,\n branchMirrorsOtherLaneReason,\n crossScopeDescription,\n crossScopeMidFlightHaltReason,\n crossScopeRefusal,\n crossScopeSkipSummary,\n dryRunSummaryLine,\n foreignLaneComponents,\n haltCommentBody,\n isProtectedBranch,\n laneHeadFingerprint,\n LaneSyncExecutor,\n laneSyncPrBody,\n} from './lane-sync-executor';\nimport { resolveSyncConfig } from './sync-config';\n\ntype LaneComponents = Parameters<typeof laneHeadFingerprint>[0];\n\n/** A stand-in for `LaneData`'s component entry; the helpers only read the id string, scope and head. */\nfunction comp(id: string, head: string): LaneComponents[number] {\n return {\n id: { toStringWithoutVersion: () => id, scope: id.split('/', 1)[0] },\n head,\n } as unknown as LaneComponents[number];\n}\n\ndescribe('laneHeadFingerprint', () => {\n const a = comp('acme.shop/comp1', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1');\n const b = comp('acme.shop/comp2', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2');\n\n it('is a single 40-hex token, so it survives being written into a commit trailer as an annotation', () => {\n const fingerprint = laneHeadFingerprint([a, b]);\n expect(fingerprint).to.match(/^[0-9a-f]{40}$/);\n });\n\n it('is stable under reordering: the remote listing order must not look like the lane moved', () => {\n expect(laneHeadFingerprint([a, b])).to.equal(laneHeadFingerprint([b, a]));\n });\n\n it('changes when a component head changes', () => {\n const moved = comp('acme.shop/comp2', 'cccccccccccccccccccccccccccccccccccccc33');\n expect(laneHeadFingerprint([a, moved])).to.not.equal(laneHeadFingerprint([a, b]));\n });\n\n it('changes when a component is added or removed', () => {\n expect(laneHeadFingerprint([a])).to.not.equal(laneHeadFingerprint([a, b]));\n expect(laneHeadFingerprint([])).to.not.equal(laneHeadFingerprint([a]));\n });\n\n it('does not depend on the lane object, only on its content', () => {\n expect(laneHeadFingerprint([a, b])).to.equal(laneHeadFingerprint([comp('acme.shop/comp1', a.head), b]));\n });\n});\n\ndescribe('foreignLaneComponents', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n const ours = comp('acme.shop/comp1', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1');\n const theirs = comp('other.scope/comp2', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2');\n\n it('is empty for a lane whose components are all in the repository scope', () => {\n expect(foreignLaneComponents([ours], DEFAULT_SCOPE)).to.deep.equal([]);\n expect(foreignLaneComponents([], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n\n it('names every component outside the repository scope', () => {\n expect(foreignLaneComponents([ours, theirs], DEFAULT_SCOPE)).to.deep.equal(['other.scope/comp2']);\n });\n\n it('compares the scope, not the id prefix: a namespaced component of our scope is ours', () => {\n // `acme.shop/ui/button` must not read as scope `acme.shop/ui`.\n const namespaced = comp('acme.shop/ui/button', 'ccccccccccccccccccccccccccccccccccccc333');\n expect(foreignLaneComponents([namespaced], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n\n it('treats a lane hosted elsewhere but filled with our components as ours (hosting != content)', () => {\n expect(foreignLaneComponents([ours], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n});\n\ndescribe('crossScopeDescription', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n\n it('names the foreign scopes and this repository scope', () => {\n const description = crossScopeDescription(['other.scope/comp2', 'third.scope/comp3'], DEFAULT_SCOPE);\n expect(description).to.include('components from scope(s) other.scope, third.scope');\n expect(description).to.include(`(this repo maps scope ${DEFAULT_SCOPE})`);\n expect(description).to.include('foreign components: other.scope/comp2, third.scope/comp3');\n });\n\n it('lists at most five foreign components and summarizes the rest', () => {\n const ids = Array.from({ length: 8 }, (_, index) => `other.scope/comp${index}`);\n const description = crossScopeDescription(ids, DEFAULT_SCOPE);\n expect(description).to.include('other.scope/comp4');\n expect(description).to.not.include('other.scope/comp5');\n expect(description).to.include('…and 3 more');\n });\n\n it('does not append a count when everything is listed', () => {\n expect(crossScopeDescription(['other.scope/comp1'], DEFAULT_SCOPE)).to.not.include('more');\n });\n});\n\n// GitHub rejects a PR whose body exceeds 65,536 characters, whole-request; a lane has no size limit.\ndescribe('laneSyncPrBody', () => {\n const LANE_HEAD = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';\n\n function body(componentCount: number) {\n return laneSyncPrBody({\n laneIdStr: 'acme.shop/my-lane',\n laneUrl: 'https://bit.cloud/acme/shop/~lane/my-lane',\n branch: 'my-lane',\n laneHead: LANE_HEAD,\n components: Array.from({ length: componentCount }, (_, index) =>\n comp(`acme.shop/namespace/component-with-a-realistic-name-${index}`, `${'0'.repeat(39)}${index % 10}`)\n ),\n });\n }\n\n it('lists at most twenty components and summarizes the rest, keeping the exact total', () => {\n const rendered = body(100);\n expect(rendered).to.include('component-with-a-realistic-name-19');\n expect(rendered).to.not.include('component-with-a-realistic-name-20');\n expect(rendered).to.include('and 80 more');\n expect(rendered).to.include('Components on the lane (100):');\n expect(rendered).to.include(`lane head: \\`${LANE_HEAD}\\``);\n });\n\n it('stays far inside a git host body limit for a lane of any size', () => {\n expect(body(100).length).to.be.below(60000);\n expect(body(5000).length).to.be.below(60000);\n });\n\n it('lists a small lane in full, with no summary line', () => {\n const rendered = body(3);\n expect(rendered).to.include('component-with-a-realistic-name-2');\n expect(rendered).to.not.include('more');\n expect(rendered).to.include('Components on the lane (3):');\n });\n\n it('says so explicitly when the lane has no components', () => {\n expect(body(0)).to.include('_none_');\n });\n});\n\ndescribe('cross-scope outcome messages', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n const FOREIGN = ['other.scope/comp2'];\n\n it('an enumerated lane is SKIPPED, in the vocabulary of a healthy run', () => {\n const summary = crossScopeSkipSummary('my-lane', FOREIGN, DEFAULT_SCOPE);\n expect(summary).to.match(/^my-lane -> skipped \\(cross-scope lane: /);\n expect(summary).to.include('no branch created');\n // A HALTED/REFUSED marker in this line would flip the exit code of a healthy repository.\n expect(summary).to.not.include('HALTED');\n expect(summary).to.not.include('REFUSED');\n });\n\n it('an explicitly requested lane is REFUSED, with the reason and the \"nothing was written\" promise', () => {\n const refusal = crossScopeRefusal(FOREIGN, DEFAULT_SCOPE);\n expect(refusal).to.include('cross-scope lane: components from scope(s) other.scope');\n expect(refusal).to.include(\"not supported yet — see the docs' Cross-scope lanes section\");\n expect(refusal).to.include('No branch was created and nothing was written');\n });\n\n it('the refusal does not claim it created no branch when a branch already exists', () => {\n const refusal = crossScopeRefusal(FOREIGN, DEFAULT_SCOPE, 'my-lane');\n expect(refusal).to.include('Nothing was written; the existing branch my-lane was left untouched');\n expect(refusal).to.not.include('No branch was created');\n });\n\n it('a lane that became cross-scope mid-flight names the branch it can no longer converge with', () => {\n const reason = crossScopeMidFlightHaltReason('my-lane', FOREIGN, DEFAULT_SCOPE);\n expect(reason).to.include('lane became cross-scope after it was mirrored onto my-lane');\n expect(reason).to.include('can no longer be reconciled automatically');\n });\n});\n\ndescribe('branchMirrorsOtherLaneReason', () => {\n it('names the branch, the lane that owns it, and the lane that was refused', () => {\n const reason = branchMirrorsOtherLaneReason('release', 'other.scope/release', 'acme.shop/release');\n expect(reason).to.include('branch release mirrors lane other.scope/release');\n expect(reason).to.include('refusing to plan for acme.shop/release');\n expect(reason).to.include(\"overwrite the other lane's mirror\");\n });\n\n it('the PR comment tells the branch owner their lane is fine, and not to run the usual steps', () => {\n const note = branchMirrorsOtherLaneNote('other.scope/release', 'acme.shop/release');\n expect(note).to.include('belongs to lane `other.scope/release`');\n expect(note).to.include('nothing is wrong with it');\n expect(note).to.include('acme.shop/release');\n expect(note).to.match(/Do NOT run the usual \"bit lane import\" resolution steps/);\n expect(note).to.include('rename one of the two lanes');\n expect(note).to.include('`branches`');\n });\n});\n\n// The executor is real; `getDefaultBranchName` throwing is the seam — the first dependency\n// `reconcileLane` awaits after the fetch, so the throw reaches the outer catch with no git/network work.\ndescribe('syncLane outer catch under --dry-run', () => {\n function throwingExecutor(gitHostCalls: string[]): LaneSyncExecutor {\n const noopLogger = { console: () => {}, consoleWarning: () => {}, error: () => {}, debug: () => {} };\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {\n getDefaultBranchName: async () => {\n throw new Error('boom');\n },\n } as any,\n logger: noopLogger as any,\n gitHost: {\n name: 'stub',\n findPrByBranch: async () => {\n gitHostCalls.push('findPrByBranch');\n return { number: 7, htmlUrl: 'https://example.test/pr/7', labels: [] };\n },\n addLabel: async () => {\n gitHostCalls.push('addLabel');\n },\n comment: async () => {\n gitHostCalls.push('comment');\n },\n } as any,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n // Mark the fetch done so the spec never touches a repository or the network.\n (executor as any).fetched = true;\n return executor;\n }\n\n it('reports the halt without reading, labelling or commenting on the PR', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane(\n { hostScope: 'acme.shop', name: 'my-lane' },\n { dryRun: true }\n );\n expect(summary).to.equal('HALTED my-lane -> unexpected error: boom');\n expect(gitHostCalls).to.deep.equal([]);\n });\n\n it('is non-vacuous: without --dry-run the same failure does read, label and comment the PR', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane({ hostScope: 'acme.shop', name: 'my-lane' });\n expect(summary).to.equal('HALTED my-lane -> unexpected error: boom');\n expect(gitHostCalls).to.deep.equal(['findPrByBranch', 'addLabel', 'comment']);\n });\n\n // '-hostile' is a legal bit lane name (the charset allows a leading '-') that can never be a branch.\n it('a lane whose name cannot map to a branch halts report-only instead of throwing', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane({ hostScope: 'acme.shop', name: '-hostile' });\n expect(summary).to.match(/^HALTED -hostile -> unexpected error: .*not a valid git branch name/);\n expect(gitHostCalls).to.deep.equal([]);\n });\n});\n\n// bit's lane-name charset admits `$`, `-`, `_` and `!`, so an unquoted runbook shell-expands when pasted.\ndescribe('haltCommentBody', () => {\n const LANE_NAME = 'fix-$home-and-!bang';\n\n it('single-quotes every value it interpolates into a command', () => {\n const body = haltCommentBody({\n reason: 'merge conflicts in: acme.shop/comp1',\n branch: LANE_NAME,\n laneId: `acme.shop/${LANE_NAME}`,\n });\n expect(body).to.include(`git fetch origin && git checkout '${LANE_NAME}'`);\n expect(body).to.include(`bit lane import 'acme.shop/${LANE_NAME}'`);\n expect(body).to.include(`git push origin '${LANE_NAME}'`);\n // the reason is prose, not a command, and the runbook still reads as one\n expect(body).to.include('merge conflicts in: acme.shop/comp1');\n expect(body).to.include('Remove the `bit-sync-conflict` label to resume syncing.');\n });\n\n // A configured `branches` override only has to be a valid git ref, and git accepts a quote in one.\n it('escapes a value that itself contains a quote, rather than ending the quoting early', () => {\n const body = haltCommentBody({ reason: 'x', branch: \"it's-a-branch\", laneId: 'acme.shop/lane' });\n expect(body).to.include(`git checkout 'it'\\\\''s-a-branch'`);\n });\n\n it('leaves an overriding note alone: it carries no commands to quote', () => {\n const body = haltCommentBody({ reason: 'x', branch: LANE_NAME, laneId: 'acme.shop/lane', note: 'nothing to do' });\n expect(body).to.include('nothing to do');\n expect(body).to.not.include('git checkout');\n });\n});\n\n// `summarizeSync` decides the exit code by scanning for the prefix and nothing else, so a prefix-less\n// line makes a dry run report success on a plan the real run would have halted on.\ndescribe('dryRunSummaryLine', () => {\n it('carries the HALTED prefix and the reason for a planned halt, so the run exits non-zero', () => {\n const line = dryRunSummaryLine('my-lane', { type: 'halt', reason: 'cannot tell which side is newer' });\n expect(line).to.equal('HALTED my-lane -> cannot tell which side is newer');\n });\n\n it('leaves every other planned action unprefixed — those runs are healthy', () => {\n (['import-lane', 'export-branch', 'merge-diverged'] as const).forEach((type) => {\n const line = dryRunSummaryLine('my-lane', { type });\n expect(line, type).to.equal(`my-lane -> ${type}`);\n expect(line, type).to.not.contain('HALTED');\n expect(line, type).to.not.contain('REFUSED');\n });\n expect(dryRunSummaryLine('my-lane', { type: 'noop', reason: 'converged' })).to.equal('my-lane -> noop');\n expect(dryRunSummaryLine('my-lane', { type: 'close-pr', deleteBranch: true })).to.equal('my-lane -> close-pr');\n });\n});\n\n// The deletion decision is computed from refs fetched once per run; on an `--all` run the branch can\n// advance while earlier lanes are reconciled. Both seams are stubbed, so no repository is touched.\ndescribe('close-pr re-verifies the tip before retiring a branch', () => {\n const EVIDENCE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';\n const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';\n\n function retirer(currentTip: string | undefined, pushError?: Error) {\n const warnings: string[] = [];\n const pushes: string[][] = [];\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {} as any,\n logger: { console: () => {}, consoleWarning: (msg: string) => warnings.push(msg), error: () => {} } as any,\n gitHost: undefined,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n (executor as any).currentBranchTip = async () => currentTip;\n (executor as any).pushBranchDeletion = async (branch: string, sha: string) => {\n pushes.push([branch, sha]);\n if (pushError) throw pushError;\n };\n const closePr = () =>\n (executor as any).executeClosePr({\n laneName: 'my-lane',\n laneIdStr: 'acme.shop/my-lane',\n branch: 'my-lane',\n defaultBranch: 'main',\n deleteBranch: true,\n expectedTipSha: EVIDENCE_SHA,\n }) as Promise<string>;\n return { closePr, warnings, pushes };\n }\n\n it('deletes at the evidence sha while the branch is still there', async () => {\n const { closePr, pushes } = retirer(EVIDENCE_SHA);\n expect(await closePr()).to.equal('my-lane -> close-pr (no open PR, branch my-lane deleted)');\n expect(pushes).to.deep.equal([['my-lane', EVIDENCE_SHA]]);\n });\n\n it('KEEPS the branch when the tip moved during the run, pushing nothing at all', async () => {\n const { closePr, warnings, pushes } = retirer(MOVED_SHA);\n const summary = await closePr();\n expect(summary).to.contain('branch my-lane kept: its tip advanced after the ownership evidence was read');\n expect(pushes).to.deep.equal([]);\n expect(warnings.join('\\n')).to.contain(`its tip is now ${MOVED_SHA} rather than the ${EVIDENCE_SHA}`);\n });\n\n it('keeps the branch when the tip cannot be re-read at all, rather than trusting the stale answer', async () => {\n const { closePr, pushes } = retirer(undefined);\n expect(await closePr()).to.contain('branch my-lane kept: its tip advanced');\n expect(pushes).to.deep.equal([]);\n });\n\n // The re-read and the push are not atomic; the server gets the last word, and it is not a crash.\n it('reports a lease refusal as the same kept outcome', async () => {\n const { closePr, warnings } = retirer(\n EVIDENCE_SHA,\n new Error('! [rejected] (delete) -> my-lane (stale info)\\nerror: failed to push some refs')\n );\n expect(await closePr()).to.contain('branch my-lane kept: its tip advanced');\n expect(warnings.join('\\n')).to.contain('the remote refused the lease');\n });\n\n it('an unrelated push failure still reads as \"left in place\", not as a race', async () => {\n const { closePr } = retirer(EVIDENCE_SHA, new Error('remote: GH006: Protected branch update failed'));\n expect(await closePr()).to.equal('my-lane -> close-pr (no open PR, branch my-lane left in place)');\n });\n});\n\ndescribe('isProtectedBranch', () => {\n it('refuses the default branch and the main sync branch', () => {\n expect(isProtectedBranch('develop', 'develop', 'bit-sync/main')).to.equal(true);\n expect(isProtectedBranch('bit-sync/main', 'develop', 'bit-sync/main')).to.equal(true);\n });\n\n it('permits an ordinary lane branch', () => {\n expect(isProtectedBranch('my-lane', 'develop', 'bit-sync/main')).to.equal(false);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,kBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAeA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA;AACA,SAASI,IAAIA,CAACC,EAAU,EAAEC,IAAY,EAA0B;EAC9D,OAAO;IACLD,EAAE,EAAE;MAAEE,sBAAsB,EAAEA,CAAA,KAAMF,EAAE;MAAEG,KAAK,EAAEH,EAAE,CAACI,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC;IAAE,CAAC;IACpEH;EACF,CAAC;AACH;AAEAI,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpC,MAAMC,CAAC,GAAGP,IAAI,CAAC,iBAAiB,EAAE,0CAA0C,CAAC;EAC7E,MAAMQ,CAAC,GAAGR,IAAI,CAAC,iBAAiB,EAAE,0CAA0C,CAAC;EAE7ES,EAAE,CAAC,+FAA+F,EAAE,MAAM;IACxG,MAAMC,WAAW,GAAG,IAAAC,uCAAmB,EAAC,CAACJ,CAAC,EAAEC,CAAC,CAAC,CAAC;IAC/C,IAAAI,cAAM,EAACF,WAAW,CAAC,CAACG,EAAE,C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,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACpG,EAAE,CAACE,KAAK,CAAC,IAAI,CAAC;IAC/E,IAAAH,cAAM,EAAC,IAAAqG,qCAAiB,EAAC,eAAe,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACpG,EAAE,CAACE,KAAK,CAAC,IAAI,CAAC;EACvF,CAAC,CAAC;EAEFN,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1C,IAAAG,cAAM,EAAC,IAAAqG,qCAAiB,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACpG,EAAE,CAACE,KAAK,CAAC,KAAK,CAAC;EAClF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["_chai","data","require","_laneSyncExecutor","_syncConfig","stubExecutor","warnings","executor","LaneSyncExecutor","lanes","ci","logger","console","consoleWarning","msg","push","error","gitHost","undefined","cfg","resolveSyncConfig","defaultScope","comp","id","head","toStringWithoutVersion","scope","split","describe","a","b","it","fingerprint","laneHeadFingerprint","expect","to","match","equal","moved","not","DEFAULT_SCOPE","ours","theirs","foreignLaneComponents","deep","namespaced","description","crossScopeDescription","include","ids","Array","from","length","_","index","LANE_HEAD","body","componentCount","laneSyncPrBody","laneIdStr","laneUrl","branch","laneHead","components","repeat","rendered","be","below","FOREIGN","summary","crossScopeSkipSummary","refusal","crossScopeRefusal","reason","crossScopeMidFlightHaltReason","branchMirrorsOtherLaneReason","note","branchMirrorsOtherLaneNote","throwingExecutor","gitHostCalls","noopLogger","debug","getDefaultBranchName","Error","name","findPrByBranch","number","htmlUrl","labels","addLabel","comment","fetched","syncLane","hostScope","dryRun","LANE_NAME","haltCommentBody","laneId","line","dryRunSummaryLine","type","forEach","contain","deleteBranch","EVIDENCE_SHA","MOVED_SHA","retirer","currentTip","pushError","pushes","currentBranchTip","pushBranchDeletion","sha","closePr","executeClosePr","laneName","defaultBranch","expectedTipSha","join","executorWithInheritance","inherited","branchInheritsBitmapFromDefault","mirroredLane","differentLaneStillClaims","executorWithAncestryResult","result","calls","hasIndependentHistoryBelowStateCommit","stateCommit","compute","ownership","computeHasIndependentHistory","BASE_SHA","REJECTION","classifier","baseSha","e","classifyPushRejection","classify","unrelated","lastNonSyncCommitMessage","checkoutFromRemote","restoreWorkspace","snapAndExportOntoLane","status","recordLaneHeadOnBranch","executeExportBranch","target","deps","hasUnsyncedWorkChanges","materializeLane","executeAdoptBranch","racedLedgerPushSummary","isProtectedBranch"],"sources":["lane-sync-executor.spec.ts"],"sourcesContent":["import { expect } from 'chai';\nimport {\n branchMirrorsOtherLaneNote,\n branchMirrorsOtherLaneReason,\n crossScopeDescription,\n crossScopeMidFlightHaltReason,\n crossScopeRefusal,\n crossScopeSkipSummary,\n dryRunSummaryLine,\n foreignLaneComponents,\n haltCommentBody,\n isProtectedBranch,\n laneHeadFingerprint,\n LaneSyncExecutor,\n laneSyncPrBody,\n racedLedgerPushSummary,\n} from './lane-sync-executor';\nimport type { LaneOwnershipEvidence } from './sync-planner';\nimport { resolveSyncConfig } from './sync-config';\n\n/**\n * One stub executor for every seam-based test: real executor code over stubbed deps, no repository.\n * `warnings` collects `consoleWarning` lines for tests that assert on them.\n */\nfunction stubExecutor(): { executor: LaneSyncExecutor; warnings: string[] } {\n const warnings: string[] = [];\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {} as any,\n logger: { console: () => {}, consoleWarning: (msg: string) => warnings.push(msg), error: () => {} } as any,\n gitHost: undefined,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n return { executor, warnings };\n}\n\ntype LaneComponents = Parameters<typeof laneHeadFingerprint>[0];\n\n/** A stand-in for `LaneData`'s component entry; the helpers only read the id string, scope and head. */\nfunction comp(id: string, head: string): LaneComponents[number] {\n return {\n id: { toStringWithoutVersion: () => id, scope: id.split('/', 1)[0] },\n head,\n } as unknown as LaneComponents[number];\n}\n\ndescribe('laneHeadFingerprint', () => {\n const a = comp('acme.shop/comp1', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1');\n const b = comp('acme.shop/comp2', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2');\n\n it('is a single 40-hex token, so it survives being written into a commit trailer as an annotation', () => {\n const fingerprint = laneHeadFingerprint([a, b]);\n expect(fingerprint).to.match(/^[0-9a-f]{40}$/);\n });\n\n it('is stable under reordering: the remote listing order must not look like the lane moved', () => {\n expect(laneHeadFingerprint([a, b])).to.equal(laneHeadFingerprint([b, a]));\n });\n\n it('changes when a component head changes', () => {\n const moved = comp('acme.shop/comp2', 'cccccccccccccccccccccccccccccccccccccc33');\n expect(laneHeadFingerprint([a, moved])).to.not.equal(laneHeadFingerprint([a, b]));\n });\n\n it('changes when a component is added or removed', () => {\n expect(laneHeadFingerprint([a])).to.not.equal(laneHeadFingerprint([a, b]));\n expect(laneHeadFingerprint([])).to.not.equal(laneHeadFingerprint([a]));\n });\n\n it('does not depend on the lane object, only on its content', () => {\n expect(laneHeadFingerprint([a, b])).to.equal(laneHeadFingerprint([comp('acme.shop/comp1', a.head), b]));\n });\n});\n\ndescribe('foreignLaneComponents', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n const ours = comp('acme.shop/comp1', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1');\n const theirs = comp('other.scope/comp2', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2');\n\n it('is empty for a lane whose components are all in the repository scope', () => {\n expect(foreignLaneComponents([ours], DEFAULT_SCOPE)).to.deep.equal([]);\n expect(foreignLaneComponents([], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n\n it('names every component outside the repository scope', () => {\n expect(foreignLaneComponents([ours, theirs], DEFAULT_SCOPE)).to.deep.equal(['other.scope/comp2']);\n });\n\n it('compares the scope, not the id prefix: a namespaced component of our scope is ours', () => {\n // `acme.shop/ui/button` must not read as scope `acme.shop/ui`.\n const namespaced = comp('acme.shop/ui/button', 'ccccccccccccccccccccccccccccccccccccc333');\n expect(foreignLaneComponents([namespaced], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n\n it('treats a lane hosted elsewhere but filled with our components as ours (hosting != content)', () => {\n expect(foreignLaneComponents([ours], DEFAULT_SCOPE)).to.deep.equal([]);\n });\n});\n\ndescribe('crossScopeDescription', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n\n it('names the foreign scopes and this repository scope', () => {\n const description = crossScopeDescription(['other.scope/comp2', 'third.scope/comp3'], DEFAULT_SCOPE);\n expect(description).to.include('components from scope(s) other.scope, third.scope');\n expect(description).to.include(`(this repo maps scope ${DEFAULT_SCOPE})`);\n expect(description).to.include('foreign components: other.scope/comp2, third.scope/comp3');\n });\n\n it('lists at most five foreign components and summarizes the rest', () => {\n const ids = Array.from({ length: 8 }, (_, index) => `other.scope/comp${index}`);\n const description = crossScopeDescription(ids, DEFAULT_SCOPE);\n expect(description).to.include('other.scope/comp4');\n expect(description).to.not.include('other.scope/comp5');\n expect(description).to.include('…and 3 more');\n });\n\n it('does not append a count when everything is listed', () => {\n expect(crossScopeDescription(['other.scope/comp1'], DEFAULT_SCOPE)).to.not.include('more');\n });\n});\n\n// GitHub rejects a PR whose body exceeds 65,536 characters, whole-request; a lane has no size limit.\ndescribe('laneSyncPrBody', () => {\n const LANE_HEAD = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';\n\n function body(componentCount: number) {\n return laneSyncPrBody({\n laneIdStr: 'acme.shop/my-lane',\n laneUrl: 'https://bit.cloud/acme/shop/~lane/my-lane',\n branch: 'my-lane',\n laneHead: LANE_HEAD,\n components: Array.from({ length: componentCount }, (_, index) =>\n comp(`acme.shop/namespace/component-with-a-realistic-name-${index}`, `${'0'.repeat(39)}${index % 10}`)\n ),\n });\n }\n\n it('lists at most twenty components and summarizes the rest, keeping the exact total', () => {\n const rendered = body(100);\n expect(rendered).to.include('component-with-a-realistic-name-19');\n expect(rendered).to.not.include('component-with-a-realistic-name-20');\n expect(rendered).to.include('and 80 more');\n expect(rendered).to.include('Components on the lane (100):');\n expect(rendered).to.include(`lane head: \\`${LANE_HEAD}\\``);\n });\n\n it('stays far inside a git host body limit for a lane of any size', () => {\n expect(body(100).length).to.be.below(60000);\n expect(body(5000).length).to.be.below(60000);\n });\n\n it('lists a small lane in full, with no summary line', () => {\n const rendered = body(3);\n expect(rendered).to.include('component-with-a-realistic-name-2');\n expect(rendered).to.not.include('more');\n expect(rendered).to.include('Components on the lane (3):');\n });\n\n it('says so explicitly when the lane has no components', () => {\n expect(body(0)).to.include('_none_');\n });\n});\n\ndescribe('cross-scope outcome messages', () => {\n const DEFAULT_SCOPE = 'acme.shop';\n const FOREIGN = ['other.scope/comp2'];\n\n it('an enumerated lane is SKIPPED, in the vocabulary of a healthy run', () => {\n const summary = crossScopeSkipSummary('my-lane', FOREIGN, DEFAULT_SCOPE);\n expect(summary).to.match(/^my-lane -> skipped \\(cross-scope lane: /);\n expect(summary).to.include('no branch created');\n // A HALTED/REFUSED marker in this line would flip the exit code of a healthy repository.\n expect(summary).to.not.include('HALTED');\n expect(summary).to.not.include('REFUSED');\n });\n\n it('an explicitly requested lane is REFUSED, with the reason and the \"nothing was written\" promise', () => {\n const refusal = crossScopeRefusal(FOREIGN, DEFAULT_SCOPE);\n expect(refusal).to.include('cross-scope lane: components from scope(s) other.scope');\n expect(refusal).to.include(\"not supported yet — see the docs' Cross-scope lanes section\");\n expect(refusal).to.include('No branch was created and nothing was written');\n });\n\n it('the refusal does not claim it created no branch when a branch already exists', () => {\n const refusal = crossScopeRefusal(FOREIGN, DEFAULT_SCOPE, 'my-lane');\n expect(refusal).to.include('Nothing was written; the existing branch my-lane was left untouched');\n expect(refusal).to.not.include('No branch was created');\n });\n\n it('a lane that became cross-scope mid-flight names the branch it can no longer converge with', () => {\n const reason = crossScopeMidFlightHaltReason('my-lane', FOREIGN, DEFAULT_SCOPE);\n expect(reason).to.include('lane became cross-scope after it was mirrored onto my-lane');\n expect(reason).to.include('can no longer be reconciled automatically');\n });\n});\n\ndescribe('branchMirrorsOtherLaneReason', () => {\n it('names the branch, the lane that owns it, and the lane that was refused', () => {\n const reason = branchMirrorsOtherLaneReason('release', 'other.scope/release', 'acme.shop/release');\n expect(reason).to.include('branch release mirrors lane other.scope/release');\n expect(reason).to.include('refusing to plan for acme.shop/release');\n expect(reason).to.include(\"overwrite the other lane's mirror\");\n });\n\n it('the PR comment tells the branch owner their lane is fine, and not to run the usual steps', () => {\n const note = branchMirrorsOtherLaneNote('other.scope/release', 'acme.shop/release');\n expect(note).to.include('belongs to lane `other.scope/release`');\n expect(note).to.include('nothing is wrong with it');\n expect(note).to.include('acme.shop/release');\n expect(note).to.match(/Do NOT run the usual \"bit lane import\" resolution steps/);\n expect(note).to.include('rename one of the two lanes');\n expect(note).to.include('`branches`');\n });\n});\n\n// The executor is real; `getDefaultBranchName` throwing is the seam — the first dependency\n// `reconcileLane` awaits after the fetch, so the throw reaches the outer catch with no git/network work.\ndescribe('syncLane outer catch under --dry-run', () => {\n function throwingExecutor(gitHostCalls: string[]): LaneSyncExecutor {\n const noopLogger = { console: () => {}, consoleWarning: () => {}, error: () => {}, debug: () => {} };\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {\n getDefaultBranchName: async () => {\n throw new Error('boom');\n },\n } as any,\n logger: noopLogger as any,\n gitHost: {\n name: 'stub',\n findPrByBranch: async () => {\n gitHostCalls.push('findPrByBranch');\n return { number: 7, htmlUrl: 'https://example.test/pr/7', labels: [] };\n },\n addLabel: async () => {\n gitHostCalls.push('addLabel');\n },\n comment: async () => {\n gitHostCalls.push('comment');\n },\n } as any,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n // Mark the fetch done so the spec never touches a repository or the network.\n (executor as any).fetched = true;\n return executor;\n }\n\n it('reports the halt without reading, labelling or commenting on the PR', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane(\n { hostScope: 'acme.shop', name: 'my-lane' },\n { dryRun: true }\n );\n expect(summary).to.equal('HALTED my-lane -> unexpected error: boom');\n expect(gitHostCalls).to.deep.equal([]);\n });\n\n it('is non-vacuous: without --dry-run the same failure does read, label and comment the PR', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane({ hostScope: 'acme.shop', name: 'my-lane' });\n expect(summary).to.equal('HALTED my-lane -> unexpected error: boom');\n expect(gitHostCalls).to.deep.equal(['findPrByBranch', 'addLabel', 'comment']);\n });\n\n // '-hostile' is a legal bit lane name (the charset allows a leading '-') that can never be a branch.\n it('a lane whose name cannot map to a branch halts report-only instead of throwing', async () => {\n const gitHostCalls: string[] = [];\n const summary = await throwingExecutor(gitHostCalls).syncLane({ hostScope: 'acme.shop', name: '-hostile' });\n expect(summary).to.match(/^HALTED -hostile -> unexpected error: .*not a valid git branch name/);\n expect(gitHostCalls).to.deep.equal([]);\n });\n});\n\n// bit's lane-name charset admits `$`, `-`, `_` and `!`, so an unquoted runbook shell-expands when pasted.\ndescribe('haltCommentBody', () => {\n const LANE_NAME = 'fix-$home-and-!bang';\n\n it('single-quotes every value it interpolates into a command', () => {\n const body = haltCommentBody({\n reason: 'merge conflicts in: acme.shop/comp1',\n branch: LANE_NAME,\n laneId: `acme.shop/${LANE_NAME}`,\n });\n expect(body).to.include(`git fetch origin && git checkout '${LANE_NAME}'`);\n expect(body).to.include(`bit lane import 'acme.shop/${LANE_NAME}'`);\n expect(body).to.include(`git push origin '${LANE_NAME}'`);\n // the reason is prose, not a command, and the runbook still reads as one\n expect(body).to.include('merge conflicts in: acme.shop/comp1');\n expect(body).to.include('Remove the `bit-sync-conflict` label to resume syncing.');\n });\n\n // A configured `branches` override only has to be a valid git ref, and git accepts a quote in one.\n it('escapes a value that itself contains a quote, rather than ending the quoting early', () => {\n const body = haltCommentBody({ reason: 'x', branch: \"it's-a-branch\", laneId: 'acme.shop/lane' });\n expect(body).to.include(`git checkout 'it'\\\\''s-a-branch'`);\n });\n\n it('leaves an overriding note alone: it carries no commands to quote', () => {\n const body = haltCommentBody({ reason: 'x', branch: LANE_NAME, laneId: 'acme.shop/lane', note: 'nothing to do' });\n expect(body).to.include('nothing to do');\n expect(body).to.not.include('git checkout');\n });\n});\n\n// `summarizeSync` decides the exit code by scanning for the prefix and nothing else, so a prefix-less\n// line makes a dry run report success on a plan the real run would have halted on.\ndescribe('dryRunSummaryLine', () => {\n it('carries the HALTED prefix and the reason for a planned halt, so the run exits non-zero', () => {\n const line = dryRunSummaryLine('my-lane', { type: 'halt', reason: 'cannot tell which side is newer' });\n expect(line).to.equal('HALTED my-lane -> cannot tell which side is newer');\n });\n\n it('leaves every other planned action unprefixed — those runs are healthy', () => {\n (['import-lane', 'export-branch', 'merge-diverged'] as const).forEach((type) => {\n const line = dryRunSummaryLine('my-lane', { type });\n expect(line, type).to.equal(`my-lane -> ${type}`);\n expect(line, type).to.not.contain('HALTED');\n expect(line, type).to.not.contain('REFUSED');\n });\n expect(dryRunSummaryLine('my-lane', { type: 'noop', reason: 'converged' })).to.equal('my-lane -> noop');\n expect(dryRunSummaryLine('my-lane', { type: 'close-pr', deleteBranch: true })).to.equal('my-lane -> close-pr');\n });\n});\n\n// The deletion decision is computed from refs fetched once per run; on an `--all` run the branch can\n// advance while earlier lanes are reconciled. Both seams are stubbed, so no repository is touched.\ndescribe('close-pr re-verifies the tip before retiring a branch', () => {\n const EVIDENCE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';\n const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';\n\n function retirer(currentTip: string | undefined, pushError?: Error) {\n const { executor, warnings } = stubExecutor();\n const pushes: string[][] = [];\n (executor as any).currentBranchTip = async () => currentTip;\n (executor as any).pushBranchDeletion = async (branch: string, sha: string) => {\n pushes.push([branch, sha]);\n if (pushError) throw pushError;\n };\n const closePr = () =>\n (executor as any).executeClosePr({\n laneName: 'my-lane',\n laneIdStr: 'acme.shop/my-lane',\n branch: 'my-lane',\n defaultBranch: 'main',\n deleteBranch: true,\n expectedTipSha: EVIDENCE_SHA,\n }) as Promise<string>;\n return { closePr, warnings, pushes };\n }\n\n it('deletes at the evidence sha while the branch is still there', async () => {\n const { closePr, pushes } = retirer(EVIDENCE_SHA);\n expect(await closePr()).to.equal('my-lane -> close-pr (no open PR, branch my-lane deleted)');\n expect(pushes).to.deep.equal([['my-lane', EVIDENCE_SHA]]);\n });\n\n it('KEEPS the branch when the tip moved during the run, pushing nothing at all', async () => {\n const { closePr, warnings, pushes } = retirer(MOVED_SHA);\n const summary = await closePr();\n expect(summary).to.contain('branch my-lane kept: its tip advanced after the ownership evidence was read');\n expect(pushes).to.deep.equal([]);\n expect(warnings.join('\\n')).to.contain(`its tip is now ${MOVED_SHA} rather than the ${EVIDENCE_SHA}`);\n });\n\n it('keeps the branch when the tip cannot be re-read at all, rather than trusting the stale answer', async () => {\n const { closePr, pushes } = retirer(undefined);\n expect(await closePr()).to.contain('branch my-lane kept: its tip advanced');\n expect(pushes).to.deep.equal([]);\n });\n\n // The re-read and the push are not atomic; the server gets the last word, and it is not a crash.\n it('reports a lease refusal as the same kept outcome', async () => {\n const { closePr, warnings } = retirer(\n EVIDENCE_SHA,\n new Error('! [rejected] (delete) -> my-lane (stale info)\\nerror: failed to push some refs')\n );\n expect(await closePr()).to.contain('branch my-lane kept: its tip advanced');\n expect(warnings.join('\\n')).to.contain('the remote refused the lease');\n });\n\n it('an unrelated push failure still reads as \"left in place\", not as a race', async () => {\n const { closePr } = retirer(EVIDENCE_SHA, new Error('remote: GH006: Protected branch update failed'));\n expect(await closePr()).to.equal('my-lane -> close-pr (no open PR, branch my-lane left in place)');\n });\n});\n\ndescribe('differentLaneStillClaims uses .bitmap blob equality, not commit reachability', () => {\n function executorWithInheritance(inherited: boolean) {\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {} as any,\n logger: { console: () => {}, consoleWarning: () => {}, error: () => {} } as any,\n gitHost: undefined,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n (executor as any).branchInheritsBitmapFromDefault = async () => inherited;\n return (mirroredLane: string | undefined, laneIdStr: string) =>\n (executor as any).differentLaneStillClaims(mirroredLane, laneIdStr, 'my-branch', 'main') as Promise<boolean>;\n }\n\n it('does not claim when there is no mirrored lane pointer at all — never even checks the blob', async () => {\n const differentLaneStillClaims = executorWithInheritance(true);\n expect(await differentLaneStillClaims(undefined, 'acme.shop/my-lane')).to.equal(false);\n });\n\n it(\"does not claim for this lane's own pointer — never even checks the blob\", async () => {\n const differentLaneStillClaims = executorWithInheritance(true);\n expect(await differentLaneStillClaims('acme.shop/my-lane', 'acme.shop/my-lane')).to.equal(false);\n });\n\n it(\"does not claim when the different-lane .bitmap is byte-identical to the default branch's — inherited\", async () => {\n const differentLaneStillClaims = executorWithInheritance(true);\n expect(await differentLaneStillClaims('acme.shop/other-lane', 'acme.shop/my-lane')).to.equal(false);\n });\n\n it(\"STILL claims when the different-lane .bitmap has diverged from the default branch's — halt, not adopt\", async () => {\n const differentLaneStillClaims = executorWithInheritance(false);\n expect(await differentLaneStillClaims('acme.shop/other-lane', 'acme.shop/my-lane')).to.equal(true);\n });\n});\n\ndescribe('computeHasIndependentHistory gates the ancestry check to own-live claims with a state commit', () => {\n function executorWithAncestryResult(result: boolean) {\n const calls: Array<[string, string]> = [];\n const executor = new LaneSyncExecutor({\n lanes: {} as any,\n ci: {} as any,\n logger: { console: () => {}, consoleWarning: () => {}, error: () => {} } as any,\n gitHost: undefined,\n cfg: resolveSyncConfig({}),\n defaultScope: 'acme.shop',\n });\n (executor as any).hasIndependentHistoryBelowStateCommit = async (stateCommit: string, defaultBranch: string) => {\n calls.push([stateCommit, defaultBranch]);\n return result;\n };\n const compute = (ownership: LaneOwnershipEvidence, stateCommit: string | undefined, defaultBranch: string) =>\n (executor as any).computeHasIndependentHistory(ownership, stateCommit, defaultBranch) as Promise<boolean>;\n return { compute, calls };\n }\n\n it('skips the ancestry check entirely for a reachable claim (own-merged)', async () => {\n const { compute, calls } = executorWithAncestryResult(true);\n expect(await compute('own-merged', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(false);\n expect(calls).to.deep.equal([]);\n });\n\n it('skips the ancestry check entirely for own-superseded too', async () => {\n const { compute, calls } = executorWithAncestryResult(true);\n expect(await compute('own-superseded', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(false);\n expect(calls).to.deep.equal([]);\n });\n\n it('skips the check when there is no state commit to inspect, even for an own-live claim', async () => {\n const { compute, calls } = executorWithAncestryResult(true);\n expect(await compute('own-live', undefined, 'main')).to.equal(false);\n expect(calls).to.deep.equal([]);\n });\n\n it('defers to the ancestry check for an own-live claim with a state commit', async () => {\n const { compute, calls } = executorWithAncestryResult(true);\n expect(await compute('own-live', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main')).to.equal(true);\n expect(calls).to.deep.equal([['aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1', 'main']]);\n });\n});\n\ndescribe('classifyPushRejection confirms a race before calling it one', () => {\n const BASE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';\n const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';\n const REJECTION = new Error('! [rejected] HEAD -> feature (fetch first)\\nerror: failed to push some refs');\n\n function classifier(currentTip: string | undefined) {\n const { executor } = stubExecutor();\n (executor as any).currentBranchTip = async () => currentTip;\n return (baseSha: string | undefined, e: Error) =>\n (executor as any).classifyPushRejection('my-branch', baseSha, e) as Promise<'confirmed-race' | 'not-a-race'>;\n }\n\n it('confirms the race when the branch actually moved off the base we pushed against', async () => {\n const classify = classifier(MOVED_SHA);\n expect(await classify(BASE_SHA, REJECTION)).to.equal('confirmed-race');\n });\n\n it('confirms the race for a brand-new branch that now exists on the remote', async () => {\n const classify = classifier(MOVED_SHA);\n expect(await classify(undefined, REJECTION)).to.equal('confirmed-race');\n });\n\n // Message-text matching alone is not proof: a persistent, unrelated rejection could repeat the same\n // wording forever. Without this re-fetch-and-compare, that would go permanently green.\n it('answers not-a-race when the branch did NOT move — the wording matched but nothing raced', async () => {\n const classify = classifier(BASE_SHA);\n expect(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');\n });\n\n it('answers not-a-race when a brand-new branch still does not exist on the remote', async () => {\n const classify = classifier(undefined);\n expect(await classify(undefined, REJECTION)).to.equal('not-a-race');\n });\n\n // The polarity bug this guards: `currentTip === undefined` here means the re-fetch FAILED (network\n // blip, auth hiccup) — unknown, not evidence the branch moved. `undefined !== baseSha` reads as\n // truthy if compared naively, which would misreport an unanswerable check as a confirmed race and\n // paper over a real, persistent failure. Withhold like every other unknown-answer path in this file.\n it('answers not-a-race when the re-fetch itself fails, even though a base sha is known', async () => {\n const classify = classifier(undefined);\n expect(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');\n });\n\n it('answers not-a-race for a rejection whose wording is not a non-fast-forward race at all', async () => {\n const classify = classifier(MOVED_SHA);\n const unrelated = new Error('remote: GH006: Protected branch update failed');\n expect(await classify(BASE_SHA, unrelated)).to.equal('not-a-race');\n });\n});\n\n// The live incident's actual shape: the snap/export onto the lane already succeeded — the lane truly\n// moved — and only the branch's OWN ledger-commit push (recordLaneHeadOnBranch) lost the race. Nothing\n// exercised `racedLedgerPushSummary` before this; a wording regression there would have gone unnoticed.\ndescribe('executeExportBranch reports the ledger-race wording when only the ledger push races', () => {\n it('surfaces \"lane updated; branch ledger commit lost the push race\" without halting', async () => {\n const { executor } = stubExecutor();\n (executor as any).lastNonSyncCommitMessage = async () => 'feat: some change';\n (executor as any).checkoutFromRemote = async () => {};\n (executor as any).restoreWorkspace = async () => {};\n // The export half already succeeded; only the ledger commit that follows raced.\n (executor as any).snapAndExportOntoLane = async () => ({ status: 'exported' });\n (executor as any).recordLaneHeadOnBranch = async () => ({ status: 'raced' });\n\n const summary = await (executor as any).executeExportBranch({\n target: { hostScope: 'acme.shop', name: 'my-lane' },\n laneIdStr: 'acme.shop/my-lane',\n branch: 'my-lane',\n defaultBranch: 'main',\n });\n\n expect(summary).to.equal(\n 'my-lane -> raced (lane updated; branch ledger commit lost the push race — next run re-plans)'\n );\n expect(summary).to.not.include('HALTED');\n });\n});\n\n// Adoption never snaps or exports, so its raced line must NOT claim the lane was updated — the lane\n// is untouched and only the branch's pointer commit lost the race.\ndescribe('executeAdoptBranch reports a lane-untouched race when its ledger push races', () => {\n it('surfaces \"lane untouched; adoption ledger commit lost the push race\" without halting', async () => {\n const { executor } = stubExecutor();\n (executor as any).deps.ci = { hasUnsyncedWorkChanges: async () => false };\n (executor as any).checkoutFromRemote = async () => {};\n (executor as any).restoreWorkspace = async () => {};\n (executor as any).materializeLane = async () => undefined;\n (executor as any).recordLaneHeadOnBranch = async () => ({ status: 'raced' });\n\n const summary = await (executor as any).executeAdoptBranch({\n target: { hostScope: 'acme.shop', name: 'my-lane' },\n laneIdStr: 'acme.shop/my-lane',\n branch: 'my-lane',\n defaultBranch: 'main',\n });\n\n expect(summary).to.equal(\n 'my-lane -> raced (lane untouched; adoption ledger commit lost the push race — next run re-plans)'\n );\n expect(summary).to.not.include('lane updated');\n expect(summary).to.not.include('HALTED');\n });\n});\n\n// A destructive auto-resolution (onConflict git-wins/lane-wins) that already exported must not vanish\n// from the summary just because the ledger push raced.\ndescribe('racedLedgerPushSummary keeps the conflict-policy clause', () => {\n it('carries the merge path’s policyClause through the raced ledger line', () => {\n expect(racedLedgerPushSummary('my-lane', 'conflicts auto-resolved: git-wins on 3 file(s); ')).to.equal(\n 'my-lane -> raced (conflicts auto-resolved: git-wins on 3 file(s); lane updated; branch ledger commit ' +\n 'lost the push race — next run re-plans)'\n );\n });\n});\n\ndescribe('isProtectedBranch', () => {\n it('refuses the default branch and the main sync branch', () => {\n expect(isProtectedBranch('develop', 'develop', 'bit-sync/main')).to.equal(true);\n expect(isProtectedBranch('bit-sync/main', 'develop', 'bit-sync/main')).to.equal(true);\n });\n\n it('permits an ordinary lane branch', () => {\n expect(isProtectedBranch('my-lane', 'develop', 'bit-sync/main')).to.equal(false);\n });\n});\n"],"mappings":";;AAAA,SAAAA,MAAA;EAAA,MAAAC,IAAA,GAAAC,OAAA;EAAAF,KAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAE,kBAAA;EAAA,MAAAF,IAAA,GAAAC,OAAA;EAAAC,iBAAA,YAAAA,CAAA;IAAA,OAAAF,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAiBA,SAAAG,YAAA;EAAA,MAAAH,IAAA,GAAAC,OAAA;EAAAE,WAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAEA;AACA;AACA;AACA;AACA,SAASI,YAAYA,CAAA,EAAuD;EAC1E,MAAMC,QAAkB,GAAG,EAAE;EAC7B,MAAMC,QAAQ,GAAG,KAAIC,oCAAgB,EAAC;IACpCC,KAAK,EAAE,CAAC,CAAQ;IAChBC,EAAE,EAAE,CAAC,CAAQ;IACbC,MAAM,EAAE;MAAEC,OAAO,EAAEA,CAAA,KAAM,CAAC,CAAC;MAAEC,cAAc,EAAGC,GAAW,IAAKR,QAAQ,CAACS,IAAI,CAACD,GAAG,CAAC;MAAEE,KAAK,EAAEA,CAAA,KAAM,CAAC;IAAE,CAAQ;IAC1GC,OAAO,EAAEC,SAAS;IAClBC,GAAG,EAAE,IAAAC,+BAAiB,EAAC,CAAC,CAAC,CAAC;IAC1BC,YAAY,EAAE;EAChB,CAAC,CAAC;EACF,OAAO;IAAEd,QAAQ;IAAED;EAAS,CAAC;AAC/B;AAIA;AACA,SAASgB,IAAIA,CAACC,EAAU,EAAEC,IAAY,EAA0B;EAC9D,OAAO;IACLD,EAAE,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e,CAAC,CAAC,CAACtH,EAAE,CAACE,KAAK,CAAC,IAAI,CAAC;EACvF,CAAC,CAAC;EAEFN,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1C,IAAAG,cAAM,EAAC,IAAAuH,qCAAiB,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACtH,EAAE,CAACE,KAAK,CAAC,KAAK,CAAC;EAClF,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -101,7 +101,7 @@ class MainSyncExecutor {
101
101
  if (catchUpErr) {
102
102
  const refork = await this.reforkIfMachineOwned(branch);
103
103
  if (refork === 'human-owned') return `${_laneSyncExecutor().HALT_SUMMARY_PREFIX} main -> ${catchUpErr}`;
104
- if (refork === 'raced') return `main -> ${branch} was updated by a concurrent run — deferring to it`;
104
+ if (refork === 'raced') return racedMainSummary(branch);
105
105
  }
106
106
  }
107
107
 
@@ -146,10 +146,29 @@ class MainSyncExecutor {
146
146
  }
147
147
  await (0, _gitOps().addAllExceptScopeAndModules)();
148
148
  await (0, _gitOps().commitWithIdentity)(mainSyncCommitMessage(drift.length));
149
- // Never force: a rejected push means a concurrent run pushed in between, and in direct-push mode
150
- // that rejection is the whole safety story for the default branch. Unambiguous refspec — see
151
- // `lane-sync-executor.commitAllAndPush`.
152
- await _git().git.push(['origin', `HEAD:refs/heads/${branch}`]);
149
+ // The local knowledge of `origin/<branch>` — the tip this run built on; after a rejection it is
150
+ // the baseline `confirmPushRace` checks the re-fetched remote against.
151
+ const baseSha = await _git().git.revparse([`origin/${branch}`]).then(sha => sha.trim() || undefined).catch(() => undefined);
152
+ // Never force. Unambiguous refspec — see `lane-sync-executor.commitAllAndPush`. A rejection means
153
+ // a concurrent run pushed in between; what happens next depends on the mode. Direct-push: the
154
+ // rejection IS the default branch's safety story — stay loud, never swallow. 'pr' mode: the push
155
+ // targets the machine-owned sync branch, where a concurrent-run overlap is the same benign race
156
+ // the lane executor tolerates (`reforkIfMachineOwned` already defers the same way) — confirm it
157
+ // and defer.
158
+ try {
159
+ await _git().git.push(['origin', `HEAD:refs/heads/${branch}`]);
160
+ } catch (e) {
161
+ const message = String(e?.message || e);
162
+ if (directPush || (await (0, _gitOps().confirmPushRace)(branch, baseSha, message)) !== 'confirmed-race') throw e;
163
+ // Drop the losing commit: left on the local sync branch, its orphan sibling would trip the
164
+ // next run's `checkoutPristine` guard. The original rejection text is kept for diagnosability.
165
+ const dropErr = await (0, _gitOps().dropLocalBranchToRemoteTip)(branch);
166
+ if (dropErr) {
167
+ logger.consoleWarning(`Could not drop the unpushed sync commit on ${branch}: ${dropErr}`);
168
+ }
169
+ logger.console((0, _cli().formatWarningSummary)(`main -> push to ${branch} lost to a concurrent run: ${(0, _gitOps().redactUrlCredentials)(message)}`));
170
+ return racedMainSummary(branch);
171
+ }
153
172
  logger.console(_chalk().default.green(`Pushed ${branch}`));
154
173
  if (directPush) {
155
174
  const shortSha = (await _git().git.revparse(['--short', 'HEAD'])).trim();
@@ -317,8 +336,13 @@ class MainSyncExecutor {
317
336
  }
318
337
  }
319
338
 
320
- /** The sync commit message: no `Bit-Lane-Head` trailer — main sync keeps no state. */
339
+ /** The deferral line both raced shapes share: the catch-up refork race and the sync-branch push race. */
321
340
  exports.MainSyncExecutor = MainSyncExecutor;
341
+ function racedMainSummary(branch) {
342
+ return `main -> ${branch} was updated by a concurrent run — deferring to it`;
343
+ }
344
+
345
+ /** The sync commit message: no `Bit-Lane-Head` trailer — main sync keeps no state. */
322
346
  function mainSyncCommitMessage(driftCount) {
323
347
  return [`chore(bit-sync): sync git to latest main scope versions (${driftCount} file(s))`, '', _syncState().SYNC_COMMIT_MARKER].join('\n');
324
348
  }