From 11a6d536dc82dc3af017559799be1b952cf3054a Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Fri, 18 Jul 2025 13:47:15 -0400 Subject: [PATCH 1/8] fix: do not try and sync on cobuild waiting Signed-off-by: Aramis Sennyey --- .../rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts b/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts index 942e8156639..c10133cd2f3 100644 --- a/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts +++ b/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts @@ -32,6 +32,7 @@ export class PnpmSyncCopyOperationPlugin implements IPhasedCommandPlugin { //skip if the phase is skipped or no operation if ( + status === OperationStatus.Waiting || status === OperationStatus.Skipped || status === OperationStatus.NoOp || status === OperationStatus.Failure From f54e4b8eb155aee4e71f016c8adb6a4bf6e03664 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Fri, 18 Jul 2025 13:48:08 -0400 Subject: [PATCH 2/8] add changeset Signed-off-by: Aramis Sennyey --- .../rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json diff --git a/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json b/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json new file mode 100644 index 00000000000..a284c9789be --- /dev/null +++ b/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json @@ -0,0 +1,11 @@ +{ + "changes": [ + { + "comment": "Do not try to sync cobuild waiting state.", + "type": "none", + "packageName": "@microsoft/rush" + } + ], + "packageName": "@microsoft/rush", + "email": "aramissennyeydd@users.noreply.github.com" +} \ No newline at end of file From e384ddd93c512de3c08e74a1336ba9aa1e55cb57 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Fri, 18 Jul 2025 14:28:51 -0400 Subject: [PATCH 3/8] only assign operations on complete Signed-off-by: Aramis Sennyey --- .../operations/OperationExecutionManager.ts | 35 +++++++++++-------- .../operations/PnpmSyncCopyOperationPlugin.ts | 1 - 2 files changed, 20 insertions(+), 16 deletions(-) diff --git a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts index 7908a106e91..2f7aacdefb5 100644 --- a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts +++ b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts @@ -263,14 +263,19 @@ export class OperationExecutionManager { const onOperationCompleteAsync: (record: OperationExecutionRecord) => Promise = async ( record: OperationExecutionRecord ) => { - try { - await this._afterExecuteOperation?.(record); - } catch (e) { - this._reportOperationErrorIfAny(record); - record.error = e; - record.status = OperationStatus.Failure; + // If the operation is not terminal, we should _only_ notify the queue to assign operations. + if (!record.isTerminal) { + this._executionQueue.assignOperations(); + } else { + this._onOperationComplete(record); + try { + await this._afterExecuteOperation?.(record); + } catch (e) { + this._reportOperationErrorIfAny(record); + record.error = e; + record.status = OperationStatus.Failure; + } } - this._onOperationComplete(record); }; const onOperationStartAsync: ( @@ -296,8 +301,8 @@ export class OperationExecutionManager { const status: OperationStatus = this._hasAnyFailures ? OperationStatus.Failure : this._hasAnyNonAllowedWarnings - ? OperationStatus.SuccessWithWarning - : OperationStatus.Success; + ? OperationStatus.SuccessWithWarning + : OperationStatus.Success; return { operationResults: this._executionRecords, @@ -431,13 +436,13 @@ export class OperationExecutionManager { this._hasAnyNonAllowedWarnings = this._hasAnyNonAllowedWarnings || !runner.warningsAreAllowed; break; } - } - if (record.isTerminal) { - // If the operation was not remote, then we can notify queue that it is complete - this._executionQueue.complete(record); - } else { - this._executionQueue.assignOperations(); + default: { + throw new InternalError(`Unexpected operation status: ${status}`); + } } + + // If the operation was not remote, then we can notify queue that it is complete + this._executionQueue.complete(record); } } diff --git a/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts b/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts index c10133cd2f3..942e8156639 100644 --- a/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts +++ b/libraries/rush-lib/src/logic/operations/PnpmSyncCopyOperationPlugin.ts @@ -32,7 +32,6 @@ export class PnpmSyncCopyOperationPlugin implements IPhasedCommandPlugin { //skip if the phase is skipped or no operation if ( - status === OperationStatus.Waiting || status === OperationStatus.Skipped || status === OperationStatus.NoOp || status === OperationStatus.Failure From 982df3fd13963ef4ee13d27f1a63add6b1f6b305 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Fri, 18 Jul 2025 14:29:38 -0400 Subject: [PATCH 4/8] update changeset Signed-off-by: Aramis Sennyey --- .../rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json b/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json index a284c9789be..d59e2c90cad 100644 --- a/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json +++ b/common/changes/@microsoft/rush/sennyeya-fix-pnpm-sync_2025-07-18-17-47.json @@ -1,7 +1,7 @@ { "changes": [ { - "comment": "Do not try to sync cobuild waiting state.", + "comment": "Do not run afterExecuteOperation if the operation has not actually completed.", "type": "none", "packageName": "@microsoft/rush" } From a4bb24f65f8e72c599208429f77acc4d046166d7 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Fri, 18 Jul 2025 15:57:13 -0400 Subject: [PATCH 5/8] fix snapshots Signed-off-by: Aramis Sennyey --- .../__snapshots__/OperationExecutionManager.test.ts.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap b/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap index deb3e8fe623..9edfc3231a4 100644 --- a/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap +++ b/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap @@ -40,7 +40,7 @@ Array [ }, Object { "kind": "O", - "text": "[green]\\"operation2 (success)\\" completed successfully in 15.00 seconds.[default] + "text": "[green]\\"operation2 (success)\\" completed successfully in 10.00 seconds.[default] ", }, Object { @@ -56,7 +56,7 @@ Array [ }, Object { "kind": "O", - "text": "[green]\\"operation (success)\\" completed successfully in 15.00 seconds.[default] + "text": "[green]\\"operation (success)\\" completed successfully in 10.00 seconds.[default] ", }, Object { @@ -212,7 +212,7 @@ Array [ }, Object { "kind": "E", - "text": "[yellow]\\"operation2 (success with warnings)\\" completed with warnings in 15.00 seconds.[default] + "text": "[yellow]\\"operation2 (success with warnings)\\" completed with warnings in 10.00 seconds.[default] ", }, Object { @@ -240,7 +240,7 @@ Array [ }, Object { "kind": "E", - "text": "[yellow]\\"operation (success with warnings)\\" completed with warnings in 15.00 seconds.[default] + "text": "[yellow]\\"operation (success with warnings)\\" completed with warnings in 10.00 seconds.[default] ", }, Object { From e12caeb3fc90a763e1212c4c361ae722a974fba0 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:20:01 -0400 Subject: [PATCH 6/8] Update libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts Co-authored-by: David Michon --- .../rush-lib/src/logic/operations/OperationExecutionManager.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts index 2f7aacdefb5..d1fcbb445a3 100644 --- a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts +++ b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts @@ -267,7 +267,6 @@ export class OperationExecutionManager { if (!record.isTerminal) { this._executionQueue.assignOperations(); } else { - this._onOperationComplete(record); try { await this._afterExecuteOperation?.(record); } catch (e) { @@ -275,6 +274,7 @@ export class OperationExecutionManager { record.error = e; record.status = OperationStatus.Failure; } + this._onOperationComplete(record); } }; From 97254eafaa6d56ccd85118bdfb49032968885cf5 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Tue, 22 Jul 2025 16:22:14 -0400 Subject: [PATCH 7/8] fix test cases Signed-off-by: Aramis Sennyey --- .../__snapshots__/OperationExecutionManager.test.ts.snap | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap b/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap index 9edfc3231a4..deb3e8fe623 100644 --- a/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap +++ b/libraries/rush-lib/src/logic/operations/test/__snapshots__/OperationExecutionManager.test.ts.snap @@ -40,7 +40,7 @@ Array [ }, Object { "kind": "O", - "text": "[green]\\"operation2 (success)\\" completed successfully in 10.00 seconds.[default] + "text": "[green]\\"operation2 (success)\\" completed successfully in 15.00 seconds.[default] ", }, Object { @@ -56,7 +56,7 @@ Array [ }, Object { "kind": "O", - "text": "[green]\\"operation (success)\\" completed successfully in 10.00 seconds.[default] + "text": "[green]\\"operation (success)\\" completed successfully in 15.00 seconds.[default] ", }, Object { @@ -212,7 +212,7 @@ Array [ }, Object { "kind": "E", - "text": "[yellow]\\"operation2 (success with warnings)\\" completed with warnings in 10.00 seconds.[default] + "text": "[yellow]\\"operation2 (success with warnings)\\" completed with warnings in 15.00 seconds.[default] ", }, Object { @@ -240,7 +240,7 @@ Array [ }, Object { "kind": "E", - "text": "[yellow]\\"operation (success with warnings)\\" completed with warnings in 10.00 seconds.[default] + "text": "[yellow]\\"operation (success with warnings)\\" completed with warnings in 15.00 seconds.[default] ", }, Object { From 64b44637f48427896320ff1c55aa279c02925b1e Mon Sep 17 00:00:00 2001 From: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:44:35 -0400 Subject: [PATCH 8/8] Update libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts --- .../rush-lib/src/logic/operations/OperationExecutionManager.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts index d1fcbb445a3..01cc0845889 100644 --- a/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts +++ b/libraries/rush-lib/src/logic/operations/OperationExecutionManager.ts @@ -442,7 +442,6 @@ export class OperationExecutionManager { } } - // If the operation was not remote, then we can notify queue that it is complete this._executionQueue.complete(record); } }