@teambit/ci 1.0.494 → 1.0.495
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.
- package/dist/{preview-1786400681343.js → preview-1786461108763.js} +1 -1
- package/dist/sync/git-ops.d.ts +41 -0
- package/dist/sync/git-ops.js +71 -0
- package/dist/sync/git-ops.js.map +1 -1
- package/dist/sync/git-ops.spec.js +39 -0
- package/dist/sync/git-ops.spec.js.map +1 -1
- package/dist/sync/lane-sync-executor.d.ts +26 -2
- package/dist/sync/lane-sync-executor.js +121 -15
- package/dist/sync/lane-sync-executor.js.map +1 -1
- package/dist/sync/lane-sync-executor.spec.js +111 -13
- package/dist/sync/lane-sync-executor.spec.js.map +1 -1
- package/dist/sync/main-sync-executor.js +30 -6
- package/dist/sync/main-sync-executor.js.map +1 -1
- package/package.json +14 -14
- package/sync/git-ops.spec.ts +60 -0
- package/sync/git-ops.ts +72 -0
- package/sync/lane-sync-executor.spec.ts +108 -9
- package/sync/lane-sync-executor.ts +122 -17
- package/sync/main-sync-executor.ts +37 -5
|
@@ -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
|
|
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,90 @@ 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('classifyPushRejection confirms a race before calling it one', () => {
|
|
421
|
+
const BASE_SHA = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1';
|
|
422
|
+
const MOVED_SHA = 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb2';
|
|
423
|
+
const REJECTION = new Error('! [rejected] HEAD -> feature (fetch first)\nerror: failed to push some refs');
|
|
424
|
+
function classifier(currentTip) {
|
|
425
|
+
const {
|
|
426
|
+
executor
|
|
427
|
+
} = stubExecutor();
|
|
428
|
+
executor.currentBranchTip = async () => currentTip;
|
|
429
|
+
return (baseSha, e) => executor.classifyPushRejection('my-branch', baseSha, e);
|
|
430
|
+
}
|
|
431
|
+
it('confirms the race when the branch actually moved off the base we pushed against', async () => {
|
|
432
|
+
const classify = classifier(MOVED_SHA);
|
|
433
|
+
(0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('confirmed-race');
|
|
434
|
+
});
|
|
435
|
+
it('confirms the race for a brand-new branch that now exists on the remote', async () => {
|
|
436
|
+
const classify = classifier(MOVED_SHA);
|
|
437
|
+
(0, _chai().expect)(await classify(undefined, REJECTION)).to.equal('confirmed-race');
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
// Message-text matching alone is not proof: a persistent, unrelated rejection could repeat the same
|
|
441
|
+
// wording forever. Without this re-fetch-and-compare, that would go permanently green.
|
|
442
|
+
it('answers not-a-race when the branch did NOT move — the wording matched but nothing raced', async () => {
|
|
443
|
+
const classify = classifier(BASE_SHA);
|
|
444
|
+
(0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');
|
|
445
|
+
});
|
|
446
|
+
it('answers not-a-race when a brand-new branch still does not exist on the remote', async () => {
|
|
447
|
+
const classify = classifier(undefined);
|
|
448
|
+
(0, _chai().expect)(await classify(undefined, REJECTION)).to.equal('not-a-race');
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// The polarity bug this guards: `currentTip === undefined` here means the re-fetch FAILED (network
|
|
452
|
+
// blip, auth hiccup) — unknown, not evidence the branch moved. `undefined !== baseSha` reads as
|
|
453
|
+
// truthy if compared naively, which would misreport an unanswerable check as a confirmed race and
|
|
454
|
+
// paper over a real, persistent failure. Withhold like every other unknown-answer path in this file.
|
|
455
|
+
it('answers not-a-race when the re-fetch itself fails, even though a base sha is known', async () => {
|
|
456
|
+
const classify = classifier(undefined);
|
|
457
|
+
(0, _chai().expect)(await classify(BASE_SHA, REJECTION)).to.equal('not-a-race');
|
|
458
|
+
});
|
|
459
|
+
it('answers not-a-race for a rejection whose wording is not a non-fast-forward race at all', async () => {
|
|
460
|
+
const classify = classifier(MOVED_SHA);
|
|
461
|
+
const unrelated = new Error('remote: GH006: Protected branch update failed');
|
|
462
|
+
(0, _chai().expect)(await classify(BASE_SHA, unrelated)).to.equal('not-a-race');
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
|
|
466
|
+
// The live incident's actual shape: the snap/export onto the lane already succeeded — the lane truly
|
|
467
|
+
// moved — and only the branch's OWN ledger-commit push (recordLaneHeadOnBranch) lost the race. Nothing
|
|
468
|
+
// exercised `racedLedgerPushSummary` before this; a wording regression there would have gone unnoticed.
|
|
469
|
+
describe('executeExportBranch reports the ledger-race wording when only the ledger push races', () => {
|
|
470
|
+
it('surfaces "lane updated; branch ledger commit lost the push race" without halting', async () => {
|
|
471
|
+
const {
|
|
472
|
+
executor
|
|
473
|
+
} = stubExecutor();
|
|
474
|
+
executor.lastNonSyncCommitMessage = async () => 'feat: some change';
|
|
475
|
+
executor.checkoutFromRemote = async () => {};
|
|
476
|
+
executor.restoreWorkspace = async () => {};
|
|
477
|
+
// The export half already succeeded (undefined = no error, matching this file's `Error | undefined`
|
|
478
|
+
// contract for `snapAndExportOntoLane`); only the ledger commit that follows raced.
|
|
479
|
+
executor.snapAndExportOntoLane = async () => undefined;
|
|
480
|
+
executor.recordLaneHeadOnBranch = async () => ({
|
|
481
|
+
status: 'raced'
|
|
482
|
+
});
|
|
483
|
+
const summary = await executor.executeExportBranch({
|
|
484
|
+
target: {
|
|
485
|
+
hostScope: 'acme.shop',
|
|
486
|
+
name: 'my-lane'
|
|
487
|
+
},
|
|
488
|
+
laneIdStr: 'acme.shop/my-lane',
|
|
489
|
+
branch: 'my-lane',
|
|
490
|
+
defaultBranch: 'main'
|
|
491
|
+
});
|
|
492
|
+
(0, _chai().expect)(summary).to.equal('my-lane -> raced (lane updated; branch ledger commit lost the push race — next run re-plans)');
|
|
493
|
+
(0, _chai().expect)(summary).to.not.include('HALTED');
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
// A destructive auto-resolution (onConflict git-wins/lane-wins) that already exported must not vanish
|
|
498
|
+
// from the summary just because the ledger push raced.
|
|
499
|
+
describe('racedLedgerPushSummary keeps the conflict-policy clause', () => {
|
|
500
|
+
it('carries the merge path’s policyClause through the raced ledger line', () => {
|
|
501
|
+
(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)');
|
|
502
|
+
});
|
|
503
|
+
});
|
|
406
504
|
describe('isProtectedBranch', () => {
|
|
407
505
|
it('refuses the default branch and the main sync branch', () => {
|
|
408
506
|
(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,OA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G,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","BASE_SHA","REJECTION","classifier","baseSha","e","classifyPushRejection","classify","unrelated","lastNonSyncCommitMessage","checkoutFromRemote","restoreWorkspace","snapAndExportOntoLane","recordLaneHeadOnBranch","status","executeExportBranch","target","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 { 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('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 (undefined = no error, matching this file's `Error | undefined`\n // contract for `snapAndExportOntoLane`); only the ledger commit that follows raced.\n (executor as any).snapAndExportOntoLane = async () => undefined;\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// 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;AAgBA,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,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ACJ,CAAC,CAAC;AAEFT,QAAQ,CAAC,mBAAmB,EAAE,MAAM;EAClCG,EAAE,CAAC,qDAAqD,EAAE,MAAM;IAC9D,IAAAG,cAAM,EAAC,IAAAsG,qCAAiB,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACrG,EAAE,CAACE,KAAK,CAAC,IAAI,CAAC;IAC/E,IAAAH,cAAM,EAAC,IAAAsG,qCAAiB,EAAC,eAAe,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACrG,EAAE,CAACE,KAAK,CAAC,IAAI,CAAC;EACvF,CAAC,CAAC;EAEFN,EAAE,CAAC,iCAAiC,EAAE,MAAM;IAC1C,IAAAG,cAAM,EAAC,IAAAsG,qCAAiB,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC,CAACrG,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
|
|
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
|
-
//
|
|
150
|
-
//
|
|
151
|
-
|
|
152
|
-
|
|
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
|
|
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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cli","_git","_syncState","_workspaceLane","_laneSyncExecutor","_gitOps","e","__esModule","default","CONVERGED_SUMMARY","MainSyncExecutor","constructor","deps","syncMain","opts","cfg","defaultBranch","defaultScope","logger","directPush","mainSync","branch","mainSyncBranch","autoMergeMainSyncPr","consoleWarning","fetchRemoteHeads","syncBranchExists","branchExistsOnRemote","startPoint","console","chalk","blue","resetToStartPoint","catchUpErr","catchUpWithDefaultBranch","refork","reforkIfMachineOwned","HALT_SUMMARY_PREFIX","currentLane","currentLaneIdStr","lanes","results","checkout","checkoutByCLIValues","head","skipNpmInstall","includeNewFromScope","mergeStrategy","newFromScope","length","join","drift","driftFiles","convergedSummary","formatWarningSummary","slice","dryRun","addAllExceptScopeAndModules","commitWithIdentity","mainSyncCommitMessage","git","push","green","shortSha","revparse","trim","prUrl","ensureSyncPr","driftCount","message","restoreWorkspace","checkoutPristine","ci","reloadWorkspaceFromDisk","out","gitWithIdentity","SYNC_COMMIT_MARKER","conflicted","status","Error","raw","catch","undefined","staleTip","log","messages","split","map","filter","Boolean","machineOwned","every","isSyncAuthoredMessage","isStaleLeaseRejection","String","gitHost","pr","findPrByBranch","number","paths","files","file","path","isNonContentPath","Set","existing","htmlUrl","created","createPr","base","title","body","mainSyncPrBody","switchErr","switchToLaneForSync","checkoutPristineRestore","exports","lines","capEntries","id"],"sources":["main-sync-executor.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { formatWarningSummary } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { LanesMain } from '@teambit/lanes';\nimport type { CheckoutMain } from '@teambit/checkout';\nimport { git } from '../git';\nimport type { CiMain } from '../ci.main.runtime';\nimport type { CiSyncConfig } from './sync-config';\nimport { SYNC_COMMIT_MARKER, isSyncAuthoredMessage } from './sync-state';\nimport { currentLaneIdStr } from './workspace-lane';\nimport type { GitHostProvider } from './git-host-provider';\nimport { HALT_SUMMARY_PREFIX, capEntries } from './lane-sync-executor';\nimport {\n addAllExceptScopeAndModules,\n branchExistsOnRemote,\n checkoutPristine,\n checkoutPristineRestore,\n commitWithIdentity,\n fetchRemoteHeads,\n gitWithIdentity,\n isNonContentPath,\n isStaleLeaseRejection,\n} from './git-ops';\n\nexport type MainSyncDeps = {\n checkout: CheckoutMain;\n lanes: LanesMain;\n /** for reloadWorkspaceFromDisk + switchToLaneForSync */\n ci: CiMain;\n logger: Logger;\n /** undefined => PR operations are logged and skipped; the git half of the sync still runs. */\n gitHost?: GitHostProvider;\n cfg: Required<CiSyncConfig>;\n defaultBranch: string;\n defaultScope: string;\n};\n\n/**\n * Reconcile the main scope with the repository's default branch. Stateless: `bit checkout head`\n * writes the latest exported versions, so an empty `git status` IS convergence and any diff IS the\n * drift. Under 'pr' the convergence is proposed via `mainSyncBranch`; under 'direct-push' it lands on\n * the default branch with a plain push. One force push exists: a machine-owned sync branch that\n * conflicts with the default branch is re-forked under a tip lease (`reforkIfMachineOwned`).\n */\n/** the \"nothing to do\" line, shared by both modes */\nconst CONVERGED_SUMMARY = 'main -> converged (checkout head produced no changes)';\n\nexport class MainSyncExecutor {\n constructor(private deps: MainSyncDeps) {}\n\n /**\n * Returns a summary line (HALT-prefixed on failure) and, like `syncLane`, does not throw — a\n * main-sync failure must not erase the lane results collected before it.\n */\n async syncMain(opts: { dryRun?: boolean } = {}): Promise<string> {\n const { cfg, defaultBranch, defaultScope, logger } = this.deps;\n const directPush = cfg.mainSync === 'direct-push';\n // In direct-push mode the sync branch (and its PR) is not consulted, moved or deleted.\n const branch = directPush ? defaultBranch : cfg.mainSyncBranch;\n\n if (cfg.autoMergeMainSyncPr && !directPush) {\n // Enabling auto-merge is host-specific and not part of the GitHostProvider contract.\n logger.consoleWarning(\n `sync.autoMergeMainSyncPr is enabled in the config, but enabling auto-merge is not implemented yet — ` +\n `the sync PR is opened without it. Use a repository auto-merge rule instead.`\n );\n }\n\n try {\n await fetchRemoteHeads();\n // Direct-push always starts from `origin/<defaultBranch>` — the very tip the plain push must\n // fast-forward. In 'pr' mode an existing sync branch is reused so its PR history survives.\n const syncBranchExists = directPush ? false : await branchExistsOnRemote(branch);\n const startPoint = syncBranchExists ? `origin/${branch}` : `origin/${defaultBranch}`;\n logger.console(\n chalk.blue(\n directPush\n ? `main -> checking the main scope against ${defaultBranch} (direct-push)`\n : `main -> checking the main scope against ${defaultBranch} (sync branch ${branch})`\n )\n );\n\n await this.resetToStartPoint(branch, startPoint);\n\n if (syncBranchExists) {\n // Catch up with the default branch: the PR must stay mergeable, and `checkout head` on a stale\n // tree would re-commit pre-merge content over the default branch's changes.\n const catchUpErr = await this.catchUpWithDefaultBranch(branch);\n if (catchUpErr) {\n const refork = await this.reforkIfMachineOwned(branch);\n if (refork === 'human-owned') return `${HALT_SUMMARY_PREFIX} main -> ${catchUpErr}`;\n if (refork === 'raced') return `main -> ${branch} was updated by a concurrent run — deferring to it`;\n }\n }\n\n // `checkout head` resolves versions against the CURRENT lane; a lane pointer on this branch\n // would make the \"drift\" the lane's content. Refuse rather than open a wildly wrong PR.\n // `.bitmap`-derived read: the scope-object read answers \"main\" on a fresh runner and the guard\n // would silently stop refusing exactly where it ships (see `workspace-lane.ts`).\n const currentLane = currentLaneIdStr(this.deps.lanes);\n if (currentLane) {\n return (\n `${HALT_SUMMARY_PREFIX} main -> the .bitmap on ${startPoint} points at lane ` +\n `\"${currentLane}\" rather than main, so the main-scope drift cannot be computed`\n );\n }\n\n // `checkoutByCLIValues` rather than `checkout`: it imports current objects first (so `head`\n // resolves to the remote scope's versions) and persists `.bitmap` on destroy.\n // `includeNewFromScope`: a component exported to the scope's main but never in this repo's\n // `.bitmap` would otherwise be invisible to every sync run forever.\n // `mergeStrategy: 'theirs'` is required: unexported source drift makes components \"modified\",\n // and with no strategy the checkout throws. 'theirs' materializes the exported truth — any\n // reversion of unexported drift is visible in the PR diff. 'ours' is forbidden: it would advance\n // `.bitmap` while keeping the old files, a commit asserting a state the tree does not have.\n const results = await this.deps.checkout.checkoutByCLIValues('', {\n head: true,\n skipNpmInstall: true,\n includeNewFromScope: true,\n mergeStrategy: 'theirs',\n });\n const newFromScope = results.newFromScope ?? [];\n if (newFromScope.length) {\n logger.console(\n chalk.blue(\n `Added ${newFromScope.length} component(s) that exist on ${defaultScope}'s main but not in this ` +\n `workspace: ${newFromScope.join(', ')}`\n )\n );\n }\n\n const drift = await this.driftFiles();\n // Direct-push stays bare: asking the host about `mainSyncBranch`'s PR would be the one\n // interaction with it this mode promises not to make.\n if (!drift.length) return directPush ? CONVERGED_SUMMARY : await this.convergedSummary(branch);\n\n logger.console(\n formatWarningSummary(`main -> drift in ${drift.length} file(s): ${drift.slice(0, 20).join(', ')}`)\n );\n\n if (opts.dryRun) {\n // The working tree WAS written (a diff-based check has no other way); `finally` restores it. Safe\n // only because a dry run over a dirty tree is refused before anything runs — the restore rewinds\n // to HEAD, so an uncommitted change here would be gone (`assertCleanForDryRun`).\n logger.console(\n formatWarningSummary(\n directPush\n ? `Dry-run: main -> would push the drift directly onto ${branch}`\n : `Dry-run: main -> would push ${branch} and open a sync PR`\n )\n );\n return directPush\n ? `main -> drift detected in ${drift.length} file(s) — would push ${branch} directly`\n : `main -> drift detected in ${drift.length} file(s) — would open sync PR`;\n }\n\n await addAllExceptScopeAndModules();\n await commitWithIdentity(mainSyncCommitMessage(drift.length));\n // Never force: a rejected push means a concurrent run pushed in between, and in direct-push mode\n // that rejection is the whole safety story for the default branch. Unambiguous refspec — see\n // `lane-sync-executor.commitAllAndPush`.\n await git.push(['origin', `HEAD:refs/heads/${branch}`]);\n logger.console(chalk.green(`Pushed ${branch}`));\n\n if (directPush) {\n const shortSha = (await git.revparse(['--short', 'HEAD'])).trim();\n return `main -> direct-push (pushed ${branch} @ ${shortSha})`;\n }\n const prUrl = await this.ensureSyncPr({ branch, driftCount: drift.length, newFromScope });\n return `main -> pushed sync commit to ${branch}${prUrl ? ` (PR ${prUrl})` : ''}`;\n } catch (e: any) {\n // Same contract as the lane executor: a HALTED line, never a throw mid-run.\n return `${HALT_SUMMARY_PREFIX} main -> ${e?.message || e}`;\n } finally {\n await this.restoreWorkspace();\n }\n }\n\n /**\n * Put the working tree on the sync branch at a pristine copy of `startPoint`. Pristine is\n * load-bearing for a diff-based reconciler: any stray modification would be indistinguishable from\n * main-scope drift. The reload makes `checkout head` read this branch's `.bitmap`.\n */\n private async resetToStartPoint(branch: string, startPoint: string) {\n await checkoutPristine(branch, startPoint, () => this.deps.ci.reloadWorkspaceFromDisk());\n }\n\n /**\n * Merge the default branch into the sync branch so drift is computed against the repository's\n * current state. Returns a reason string on failure; a conflict needs a human (or deleting the sync\n * branch, which the next run re-forks).\n */\n private async catchUpWithDefaultBranch(branch: string): Promise<string | undefined> {\n const { defaultBranch, logger } = this.deps;\n try {\n // the marker line keeps the branch machine-owned across catch-up merges\n const out = await gitWithIdentity([\n 'merge',\n '-m',\n `merge origin/${defaultBranch} into ${branch}\\n\\n${SYNC_COMMIT_MARKER}`,\n `origin/${defaultBranch}`,\n ]);\n // simple-git resolves on some non-zero exits — judge the merge by state, not by rejection\n const conflicted = (await git.status()).conflicted;\n if (conflicted.length) throw new Error(`merge conflicts in: ${conflicted.join(', ')}`);\n logger.console(chalk.blue(`Brought ${branch} up to date with origin/${defaultBranch}: ${out.trim()}`));\n } catch (e: any) {\n await git.raw(['merge', '--abort']).catch(() => undefined);\n return (\n `could not bring the sync branch ${branch} up to date with origin/${defaultBranch}: ${e?.message || e}. ` +\n `Resolve or delete ${branch} (a deleted sync branch is re-forked from ${defaultBranch} on the next run)`\n );\n }\n // The merge may have brought a new `.bitmap` in from the default branch.\n await this.deps.ci.reloadWorkspaceFromDisk();\n return undefined;\n }\n\n /**\n * Re-fork the sync branch from the default branch when every commit it holds beyond it passes\n * `isSyncAuthoredMessage` — machine state is recomputable from the scope. The force push is\n * leased on the tip the ownership was read from, so a concurrent run's push wins the race.\n */\n private async reforkIfMachineOwned(branch: string): Promise<'re-forked' | 'raced' | 'human-owned'> {\n const { defaultBranch, logger } = this.deps;\n const staleTip = (await git.revparse([`origin/${branch}`])).trim();\n const log = await git.raw(['log', `origin/${defaultBranch}..${staleTip}`, '--format=%B%x1e']);\n const messages = log\n .split('\\x1e')\n .map((message) => message.trim())\n .filter(Boolean);\n const machineOwned = messages.length > 0 && messages.every((message) => isSyncAuthoredMessage(message));\n if (!machineOwned) return 'human-owned';\n logger.console(\n formatWarningSummary(\n `main -> ${branch} conflicts with ${defaultBranch} and carries only ${SYNC_COMMIT_MARKER} commits — ` +\n `re-forking it from origin/${defaultBranch}`\n )\n );\n await this.resetToStartPoint(branch, `origin/${defaultBranch}`);\n try {\n await git.push([`--force-with-lease=refs/heads/${branch}:${staleTip}`, 'origin', `HEAD:refs/heads/${branch}`]);\n } catch (e: any) {\n if (!isStaleLeaseRejection(e?.message || String(e))) throw e;\n logger.console(formatWarningSummary(`main -> ${branch} moved while re-forking — another run owns it now`));\n return 'raced';\n }\n return 're-forked';\n }\n\n /**\n * The \"nothing to do\" line — plus the open sync PR, if any: converged means the SYNC branch matches\n * the scope, and the default branch may still differ until that PR merges.\n */\n private async convergedSummary(branch: string): Promise<string> {\n const { gitHost } = this.deps;\n if (!gitHost) return CONVERGED_SUMMARY;\n const pr = await gitHost.findPrByBranch(branch).catch(() => undefined);\n return pr ? `${CONVERGED_SUMMARY} — open sync PR #${pr.number} still awaits review/merge` : CONVERGED_SUMMARY;\n }\n\n /**\n * The files `bit checkout head` changed, i.e. the drift. Excludes `.bit`/`node_modules` — the same\n * set the commit paths refuse to touch, keeping \"counts as drift\" and \"gets committed\" identical.\n */\n private async driftFiles(): Promise<string[]> {\n const status = await git.status();\n const paths = status.files.map((file) => file.path).filter((path) => !isNonContentPath(path));\n return [...new Set(paths)];\n }\n\n /**\n * Make sure the pushed branch has an open PR. A git-host failure only warns: the branch is pushed,\n * which is the load-bearing half, and the next run retries the PR.\n */\n private async ensureSyncPr({\n branch,\n driftCount,\n newFromScope,\n }: {\n branch: string;\n driftCount: number;\n newFromScope: string[];\n }): Promise<string | undefined> {\n const { gitHost, logger, defaultBranch } = this.deps;\n if (!gitHost) {\n logger.consoleWarning(\n 'No configured git host provider (for GitHub: BIT_GITHUB_TOKEN or GITHUB_TOKEN, plus a repository) — ' +\n 'pushed sync branch, skipping PR operations'\n );\n return undefined;\n }\n try {\n const existing = await gitHost.findPrByBranch(branch);\n if (existing) {\n logger.console(chalk.blue(`Sync PR ${existing.htmlUrl} is already open — pushed the new commit onto it`));\n return existing.htmlUrl;\n }\n const created = await gitHost.createPr({\n head: branch,\n base: defaultBranch,\n title: 'Bit sync: update to latest main scope versions',\n body: mainSyncPrBody({ driftCount, newFromScope }),\n });\n logger.console(chalk.green(`Opened sync PR ${created.htmlUrl}`));\n return created.htmlUrl;\n } catch (e: any) {\n logger.consoleWarning(`Could not open or find the sync PR for ${branch}: ${e?.message || e}`);\n return undefined;\n }\n }\n\n /**\n * Leave git on the default branch and bit on main. Mirrors `LaneSyncExecutor.restoreWorkspace`:\n * best-effort and warn-only so a restore hiccup can't throw out of a `finally` and mask the real\n * error; the clean discards untracked files `checkout head` wrote on the converged/dry-run paths.\n */\n private async restoreWorkspace() {\n const { logger, defaultBranch } = this.deps;\n try {\n if (currentLaneIdStr(this.deps.lanes)) {\n const switchErr = await this.deps.ci.switchToLaneForSync('main');\n if (switchErr) logger.consoleWarning(`Could not switch the workspace back to main: ${switchErr.message}`);\n }\n await checkoutPristineRestore(defaultBranch, () => this.deps.ci.reloadWorkspaceFromDisk());\n } catch (e: any) {\n logger.consoleWarning(`Could not restore the workspace after the main sync: ${e?.message || e}`);\n }\n }\n}\n\n/** The sync commit message: no `Bit-Lane-Head` trailer — main sync keeps no state. */\nfunction mainSyncCommitMessage(driftCount: number): string {\n return [\n `chore(bit-sync): sync git to latest main scope versions (${driftCount} file(s))`,\n '',\n SYNC_COMMIT_MARKER,\n ].join('\\n');\n}\n\nfunction mainSyncPrBody({ driftCount, newFromScope }: { driftCount: number; newFromScope: string[] }): string {\n const lines = [\n 'Automated sync PR: the Bit scope moved ahead of this repository. This PR checks the workspace out to the ' +\n 'latest exported versions (`bit checkout head --auto-merge-resolve theirs`).',\n '',\n `- files changed: ${driftCount}`,\n '- conflicts between this repository and the scope were resolved **in favour of the scope** — if a file here ' +\n 'held changes that were never exported to Bit, this PR reverts them. Review the diff and close the PR ' +\n 'instead of merging if that is not what you want.',\n ];\n if (newFromScope.length) {\n lines.push(\n `- components added from the scope (${newFromScope.length}, not previously in this repository's \\`.bitmap\\`):`,\n // Bounded like the lane PR body: an over-long body is rejected by the host outright.\n ...capEntries(\n newFromScope.map((id) => ` - \\`${id}\\``),\n ' - '\n )\n );\n }\n lines.push(\n '',\n 'This PR is maintained by `bit ci sync` — re-running the command pushes any further drift onto the same branch.'\n );\n return lines.join('\\n');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AA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4DA,UAAU,WAAW,EACjF,EAAE,EACFQ,+BAAkB,CACnB,CAAC1B,IAAI,CAAC,IAAI,CAAC;AACd;AAEA,SAAS8D,cAAcA,CAAC;EAAE5C,UAAU;EAAEpB;AAA6D,CAAC,EAAU;EAC5G,MAAMqE,KAAK,GAAG,CACZ,2GAA2G,GACzG,6EAA6E,EAC/E,EAAE,EACF,oBAAoBjD,UAAU,EAAE,EAChC,8GAA8G,GAC5G,uGAAuG,GACvG,kDAAkD,CACrD;EACD,IAAIpB,YAAY,CAACC,MAAM,EAAE;IACvBoE,KAAK,CAACxD,IAAI,CACR,sCAAsCb,YAAY,CAACC,MAAM,qDAAqD;IAC9G;IACA,GAAG,IAAAqE,8BAAU,EACXtE,YAAY,CAACuC,GAAG,CAAEgC,EAAE,IAAK,SAASA,EAAE,IAAI,CAAC,EACzC,MACF,CACF,CAAC;EACH;EACAF,KAAK,CAACxD,IAAI,CACR,EAAE,EACF,gHACF,CAAC;EACD,OAAOwD,KAAK,CAACnE,IAAI,CAAC,IAAI,CAAC;AACzB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["_chalk","data","_interopRequireDefault","require","_cli","_git","_syncState","_workspaceLane","_laneSyncExecutor","_gitOps","e","__esModule","default","CONVERGED_SUMMARY","MainSyncExecutor","constructor","deps","syncMain","opts","cfg","defaultBranch","defaultScope","logger","directPush","mainSync","branch","mainSyncBranch","autoMergeMainSyncPr","consoleWarning","fetchRemoteHeads","syncBranchExists","branchExistsOnRemote","startPoint","console","chalk","blue","resetToStartPoint","catchUpErr","catchUpWithDefaultBranch","refork","reforkIfMachineOwned","HALT_SUMMARY_PREFIX","racedMainSummary","currentLane","currentLaneIdStr","lanes","results","checkout","checkoutByCLIValues","head","skipNpmInstall","includeNewFromScope","mergeStrategy","newFromScope","length","join","drift","driftFiles","convergedSummary","formatWarningSummary","slice","dryRun","addAllExceptScopeAndModules","commitWithIdentity","mainSyncCommitMessage","baseSha","git","revparse","then","sha","trim","undefined","catch","push","message","String","confirmPushRace","dropErr","dropLocalBranchToRemoteTip","redactUrlCredentials","green","shortSha","prUrl","ensureSyncPr","driftCount","restoreWorkspace","checkoutPristine","ci","reloadWorkspaceFromDisk","out","gitWithIdentity","SYNC_COMMIT_MARKER","conflicted","status","Error","raw","staleTip","log","messages","split","map","filter","Boolean","machineOwned","every","isSyncAuthoredMessage","isStaleLeaseRejection","gitHost","pr","findPrByBranch","number","paths","files","file","path","isNonContentPath","Set","existing","htmlUrl","created","createPr","base","title","body","mainSyncPrBody","switchErr","switchToLaneForSync","checkoutPristineRestore","exports","lines","capEntries","id"],"sources":["main-sync-executor.ts"],"sourcesContent":["import chalk from 'chalk';\nimport { formatWarningSummary } from '@teambit/cli';\nimport type { Logger } from '@teambit/logger';\nimport type { LanesMain } from '@teambit/lanes';\nimport type { CheckoutMain } from '@teambit/checkout';\nimport { git } from '../git';\nimport type { CiMain } from '../ci.main.runtime';\nimport type { CiSyncConfig } from './sync-config';\nimport { SYNC_COMMIT_MARKER, isSyncAuthoredMessage } from './sync-state';\nimport { currentLaneIdStr } from './workspace-lane';\nimport type { GitHostProvider } from './git-host-provider';\nimport { HALT_SUMMARY_PREFIX, capEntries } from './lane-sync-executor';\nimport {\n addAllExceptScopeAndModules,\n branchExistsOnRemote,\n checkoutPristine,\n checkoutPristineRestore,\n commitWithIdentity,\n confirmPushRace,\n dropLocalBranchToRemoteTip,\n fetchRemoteHeads,\n gitWithIdentity,\n isNonContentPath,\n isStaleLeaseRejection,\n redactUrlCredentials,\n} from './git-ops';\n\nexport type MainSyncDeps = {\n checkout: CheckoutMain;\n lanes: LanesMain;\n /** for reloadWorkspaceFromDisk + switchToLaneForSync */\n ci: CiMain;\n logger: Logger;\n /** undefined => PR operations are logged and skipped; the git half of the sync still runs. */\n gitHost?: GitHostProvider;\n cfg: Required<CiSyncConfig>;\n defaultBranch: string;\n defaultScope: string;\n};\n\n/**\n * Reconcile the main scope with the repository's default branch. Stateless: `bit checkout head`\n * writes the latest exported versions, so an empty `git status` IS convergence and any diff IS the\n * drift. Under 'pr' the convergence is proposed via `mainSyncBranch`; under 'direct-push' it lands on\n * the default branch with a plain push. One force push exists: a machine-owned sync branch that\n * conflicts with the default branch is re-forked under a tip lease (`reforkIfMachineOwned`).\n */\n/** the \"nothing to do\" line, shared by both modes */\nconst CONVERGED_SUMMARY = 'main -> converged (checkout head produced no changes)';\n\nexport class MainSyncExecutor {\n constructor(private deps: MainSyncDeps) {}\n\n /**\n * Returns a summary line (HALT-prefixed on failure) and, like `syncLane`, does not throw — a\n * main-sync failure must not erase the lane results collected before it.\n */\n async syncMain(opts: { dryRun?: boolean } = {}): Promise<string> {\n const { cfg, defaultBranch, defaultScope, logger } = this.deps;\n const directPush = cfg.mainSync === 'direct-push';\n // In direct-push mode the sync branch (and its PR) is not consulted, moved or deleted.\n const branch = directPush ? defaultBranch : cfg.mainSyncBranch;\n\n if (cfg.autoMergeMainSyncPr && !directPush) {\n // Enabling auto-merge is host-specific and not part of the GitHostProvider contract.\n logger.consoleWarning(\n `sync.autoMergeMainSyncPr is enabled in the config, but enabling auto-merge is not implemented yet — ` +\n `the sync PR is opened without it. Use a repository auto-merge rule instead.`\n );\n }\n\n try {\n await fetchRemoteHeads();\n // Direct-push always starts from `origin/<defaultBranch>` — the very tip the plain push must\n // fast-forward. In 'pr' mode an existing sync branch is reused so its PR history survives.\n const syncBranchExists = directPush ? false : await branchExistsOnRemote(branch);\n const startPoint = syncBranchExists ? `origin/${branch}` : `origin/${defaultBranch}`;\n logger.console(\n chalk.blue(\n directPush\n ? `main -> checking the main scope against ${defaultBranch} (direct-push)`\n : `main -> checking the main scope against ${defaultBranch} (sync branch ${branch})`\n )\n );\n\n await this.resetToStartPoint(branch, startPoint);\n\n if (syncBranchExists) {\n // Catch up with the default branch: the PR must stay mergeable, and `checkout head` on a stale\n // tree would re-commit pre-merge content over the default branch's changes.\n const catchUpErr = await this.catchUpWithDefaultBranch(branch);\n if (catchUpErr) {\n const refork = await this.reforkIfMachineOwned(branch);\n if (refork === 'human-owned') return `${HALT_SUMMARY_PREFIX} main -> ${catchUpErr}`;\n if (refork === 'raced') return racedMainSummary(branch);\n }\n }\n\n // `checkout head` resolves versions against the CURRENT lane; a lane pointer on this branch\n // would make the \"drift\" the lane's content. Refuse rather than open a wildly wrong PR.\n // `.bitmap`-derived read: the scope-object read answers \"main\" on a fresh runner and the guard\n // would silently stop refusing exactly where it ships (see `workspace-lane.ts`).\n const currentLane = currentLaneIdStr(this.deps.lanes);\n if (currentLane) {\n return (\n `${HALT_SUMMARY_PREFIX} main -> the .bitmap on ${startPoint} points at lane ` +\n `\"${currentLane}\" rather than main, so the main-scope drift cannot be computed`\n );\n }\n\n // `checkoutByCLIValues` rather than `checkout`: it imports current objects first (so `head`\n // resolves to the remote scope's versions) and persists `.bitmap` on destroy.\n // `includeNewFromScope`: a component exported to the scope's main but never in this repo's\n // `.bitmap` would otherwise be invisible to every sync run forever.\n // `mergeStrategy: 'theirs'` is required: unexported source drift makes components \"modified\",\n // and with no strategy the checkout throws. 'theirs' materializes the exported truth — any\n // reversion of unexported drift is visible in the PR diff. 'ours' is forbidden: it would advance\n // `.bitmap` while keeping the old files, a commit asserting a state the tree does not have.\n const results = await this.deps.checkout.checkoutByCLIValues('', {\n head: true,\n skipNpmInstall: true,\n includeNewFromScope: true,\n mergeStrategy: 'theirs',\n });\n const newFromScope = results.newFromScope ?? [];\n if (newFromScope.length) {\n logger.console(\n chalk.blue(\n `Added ${newFromScope.length} component(s) that exist on ${defaultScope}'s main but not in this ` +\n `workspace: ${newFromScope.join(', ')}`\n )\n );\n }\n\n const drift = await this.driftFiles();\n // Direct-push stays bare: asking the host about `mainSyncBranch`'s PR would be the one\n // interaction with it this mode promises not to make.\n if (!drift.length) return directPush ? CONVERGED_SUMMARY : await this.convergedSummary(branch);\n\n logger.console(\n formatWarningSummary(`main -> drift in ${drift.length} file(s): ${drift.slice(0, 20).join(', ')}`)\n );\n\n if (opts.dryRun) {\n // The working tree WAS written (a diff-based check has no other way); `finally` restores it. Safe\n // only because a dry run over a dirty tree is refused before anything runs — the restore rewinds\n // to HEAD, so an uncommitted change here would be gone (`assertCleanForDryRun`).\n logger.console(\n formatWarningSummary(\n directPush\n ? `Dry-run: main -> would push the drift directly onto ${branch}`\n : `Dry-run: main -> would push ${branch} and open a sync PR`\n )\n );\n return directPush\n ? `main -> drift detected in ${drift.length} file(s) — would push ${branch} directly`\n : `main -> drift detected in ${drift.length} file(s) — would open sync PR`;\n }\n\n await addAllExceptScopeAndModules();\n await commitWithIdentity(mainSyncCommitMessage(drift.length));\n // The local knowledge of `origin/<branch>` — the tip this run built on; after a rejection it is\n // the baseline `confirmPushRace` checks the re-fetched remote against.\n const baseSha = await git\n .revparse([`origin/${branch}`])\n .then((sha) => sha.trim() || undefined)\n .catch(() => undefined);\n // Never force. Unambiguous refspec — see `lane-sync-executor.commitAllAndPush`. A rejection means\n // a concurrent run pushed in between; what happens next depends on the mode. Direct-push: the\n // rejection IS the default branch's safety story — stay loud, never swallow. 'pr' mode: the push\n // targets the machine-owned sync branch, where a concurrent-run overlap is the same benign race\n // the lane executor tolerates (`reforkIfMachineOwned` already defers the same way) — confirm it\n // and defer.\n try {\n await git.push(['origin', `HEAD:refs/heads/${branch}`]);\n } catch (e: any) {\n const message = String(e?.message || e);\n if (directPush || (await confirmPushRace(branch, baseSha, message)) !== 'confirmed-race') throw e;\n // Drop the losing commit: left on the local sync branch, its orphan sibling would trip the\n // next run's `checkoutPristine` guard. The original rejection text is kept for diagnosability.\n const dropErr = await dropLocalBranchToRemoteTip(branch);\n if (dropErr) {\n logger.consoleWarning(`Could not drop the unpushed sync commit on ${branch}: ${dropErr}`);\n }\n logger.console(\n formatWarningSummary(`main -> push to ${branch} lost to a concurrent run: ${redactUrlCredentials(message)}`)\n );\n return racedMainSummary(branch);\n }\n logger.console(chalk.green(`Pushed ${branch}`));\n\n if (directPush) {\n const shortSha = (await git.revparse(['--short', 'HEAD'])).trim();\n return `main -> direct-push (pushed ${branch} @ ${shortSha})`;\n }\n const prUrl = await this.ensureSyncPr({ branch, driftCount: drift.length, newFromScope });\n return `main -> pushed sync commit to ${branch}${prUrl ? ` (PR ${prUrl})` : ''}`;\n } catch (e: any) {\n // Same contract as the lane executor: a HALTED line, never a throw mid-run.\n return `${HALT_SUMMARY_PREFIX} main -> ${e?.message || e}`;\n } finally {\n await this.restoreWorkspace();\n }\n }\n\n /**\n * Put the working tree on the sync branch at a pristine copy of `startPoint`. Pristine is\n * load-bearing for a diff-based reconciler: any stray modification would be indistinguishable from\n * main-scope drift. The reload makes `checkout head` read this branch's `.bitmap`.\n */\n private async resetToStartPoint(branch: string, startPoint: string) {\n await checkoutPristine(branch, startPoint, () => this.deps.ci.reloadWorkspaceFromDisk());\n }\n\n /**\n * Merge the default branch into the sync branch so drift is computed against the repository's\n * current state. Returns a reason string on failure; a conflict needs a human (or deleting the sync\n * branch, which the next run re-forks).\n */\n private async catchUpWithDefaultBranch(branch: string): Promise<string | undefined> {\n const { defaultBranch, logger } = this.deps;\n try {\n // the marker line keeps the branch machine-owned across catch-up merges\n const out = await gitWithIdentity([\n 'merge',\n '-m',\n `merge origin/${defaultBranch} into ${branch}\\n\\n${SYNC_COMMIT_MARKER}`,\n `origin/${defaultBranch}`,\n ]);\n // simple-git resolves on some non-zero exits — judge the merge by state, not by rejection\n const conflicted = (await git.status()).conflicted;\n if (conflicted.length) throw new Error(`merge conflicts in: ${conflicted.join(', ')}`);\n logger.console(chalk.blue(`Brought ${branch} up to date with origin/${defaultBranch}: ${out.trim()}`));\n } catch (e: any) {\n await git.raw(['merge', '--abort']).catch(() => undefined);\n return (\n `could not bring the sync branch ${branch} up to date with origin/${defaultBranch}: ${e?.message || e}. ` +\n `Resolve or delete ${branch} (a deleted sync branch is re-forked from ${defaultBranch} on the next run)`\n );\n }\n // The merge may have brought a new `.bitmap` in from the default branch.\n await this.deps.ci.reloadWorkspaceFromDisk();\n return undefined;\n }\n\n /**\n * Re-fork the sync branch from the default branch when every commit it holds beyond it passes\n * `isSyncAuthoredMessage` — machine state is recomputable from the scope. The force push is\n * leased on the tip the ownership was read from, so a concurrent run's push wins the race.\n */\n private async reforkIfMachineOwned(branch: string): Promise<'re-forked' | 'raced' | 'human-owned'> {\n const { defaultBranch, logger } = this.deps;\n const staleTip = (await git.revparse([`origin/${branch}`])).trim();\n const log = await git.raw(['log', `origin/${defaultBranch}..${staleTip}`, '--format=%B%x1e']);\n const messages = log\n .split('\\x1e')\n .map((message) => message.trim())\n .filter(Boolean);\n const machineOwned = messages.length > 0 && messages.every((message) => isSyncAuthoredMessage(message));\n if (!machineOwned) return 'human-owned';\n logger.console(\n formatWarningSummary(\n `main -> ${branch} conflicts with ${defaultBranch} and carries only ${SYNC_COMMIT_MARKER} commits — ` +\n `re-forking it from origin/${defaultBranch}`\n )\n );\n await this.resetToStartPoint(branch, `origin/${defaultBranch}`);\n try {\n await git.push([`--force-with-lease=refs/heads/${branch}:${staleTip}`, 'origin', `HEAD:refs/heads/${branch}`]);\n } catch (e: any) {\n if (!isStaleLeaseRejection(e?.message || String(e))) throw e;\n logger.console(formatWarningSummary(`main -> ${branch} moved while re-forking — another run owns it now`));\n return 'raced';\n }\n return 're-forked';\n }\n\n /**\n * The \"nothing to do\" line — plus the open sync PR, if any: converged means the SYNC branch matches\n * the scope, and the default branch may still differ until that PR merges.\n */\n private async convergedSummary(branch: string): Promise<string> {\n const { gitHost } = this.deps;\n if (!gitHost) return CONVERGED_SUMMARY;\n const pr = await gitHost.findPrByBranch(branch).catch(() => undefined);\n return pr ? `${CONVERGED_SUMMARY} — open sync PR #${pr.number} still awaits review/merge` : CONVERGED_SUMMARY;\n }\n\n /**\n * The files `bit checkout head` changed, i.e. the drift. Excludes `.bit`/`node_modules` — the same\n * set the commit paths refuse to touch, keeping \"counts as drift\" and \"gets committed\" identical.\n */\n private async driftFiles(): Promise<string[]> {\n const status = await git.status();\n const paths = status.files.map((file) => file.path).filter((path) => !isNonContentPath(path));\n return [...new Set(paths)];\n }\n\n /**\n * Make sure the pushed branch has an open PR. A git-host failure only warns: the branch is pushed,\n * which is the load-bearing half, and the next run retries the PR.\n */\n private async ensureSyncPr({\n branch,\n driftCount,\n newFromScope,\n }: {\n branch: string;\n driftCount: number;\n newFromScope: string[];\n }): Promise<string | undefined> {\n const { gitHost, logger, defaultBranch } = this.deps;\n if (!gitHost) {\n logger.consoleWarning(\n 'No configured git host provider (for GitHub: BIT_GITHUB_TOKEN or GITHUB_TOKEN, plus a repository) — ' +\n 'pushed sync branch, skipping PR operations'\n );\n return undefined;\n }\n try {\n const existing = await gitHost.findPrByBranch(branch);\n if (existing) {\n logger.console(chalk.blue(`Sync PR ${existing.htmlUrl} is already open — pushed the new commit onto it`));\n return existing.htmlUrl;\n }\n const created = await gitHost.createPr({\n head: branch,\n base: defaultBranch,\n title: 'Bit sync: update to latest main scope versions',\n body: mainSyncPrBody({ driftCount, newFromScope }),\n });\n logger.console(chalk.green(`Opened sync PR ${created.htmlUrl}`));\n return created.htmlUrl;\n } catch (e: any) {\n logger.consoleWarning(`Could not open or find the sync PR for ${branch}: ${e?.message || e}`);\n return undefined;\n }\n }\n\n /**\n * Leave git on the default branch and bit on main. Mirrors `LaneSyncExecutor.restoreWorkspace`:\n * best-effort and warn-only so a restore hiccup can't throw out of a `finally` and mask the real\n * error; the clean discards untracked files `checkout head` wrote on the converged/dry-run paths.\n */\n private async restoreWorkspace() {\n const { logger, defaultBranch } = this.deps;\n try {\n if (currentLaneIdStr(this.deps.lanes)) {\n const switchErr = await this.deps.ci.switchToLaneForSync('main');\n if (switchErr) logger.consoleWarning(`Could not switch the workspace back to main: ${switchErr.message}`);\n }\n await checkoutPristineRestore(defaultBranch, () => this.deps.ci.reloadWorkspaceFromDisk());\n } catch (e: any) {\n logger.consoleWarning(`Could not restore the workspace after the main sync: ${e?.message || e}`);\n }\n }\n}\n\n/** The deferral line both raced shapes share: the catch-up refork race and the sync-branch push race. */\nfunction racedMainSummary(branch: string): string {\n return `main -> ${branch} was updated by a concurrent run — deferring to it`;\n}\n\n/** The sync commit message: no `Bit-Lane-Head` trailer — main sync keeps no state. */\nfunction mainSyncCommitMessage(driftCount: number): string {\n return [\n `chore(bit-sync): sync git to latest main scope versions (${driftCount} file(s))`,\n '',\n SYNC_COMMIT_MARKER,\n ].join('\\n');\n}\n\nfunction mainSyncPrBody({ driftCount, newFromScope }: { driftCount: number; newFromScope: string[] }): string {\n const lines = [\n 'Automated sync PR: the Bit scope moved ahead of this repository. This PR checks the workspace out to the ' +\n 'latest exported versions (`bit checkout head --auto-merge-resolve theirs`).',\n '',\n `- files changed: ${driftCount}`,\n '- conflicts between this repository and the scope were resolved **in favour of the scope** — if a file here ' +\n 'held changes that were never exported to Bit, this PR reverts them. Review the diff and close the PR ' +\n 'instead of merging if that is not what you want.',\n ];\n if (newFromScope.length) {\n lines.push(\n `- components added from the scope (${newFromScope.length}, not previously in this repository's \\`.bitmap\\`):`,\n // Bounded like the lane PR body: an over-long body is rejected by the host outright.\n ...capEntries(\n newFromScope.map((id) => ` - \\`${id}\\``),\n ' - '\n )\n );\n }\n lines.push(\n '',\n 'This PR is maintained by `bit ci sync` — re-running the command pushes any further drift onto the same branch.'\n );\n return lines.join('\\n');\n}\n"],"mappings":";;;;;;AAAA,SAAAA,OAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,MAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,KAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,IAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAIA,SAAAI,KAAA;EAAA,MAAAJ,IAAA,GAAAE,OAAA;EAAAE,IAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AAGA,SAAAK,WAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,UAA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