-
Notifications
You must be signed in to change notification settings - Fork 701
[rush] Treat a phased command with zero operations as success #5915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Sean Larkin (TheLarkInn)
merged 2 commits into
main
from
fix/phased-command-noop-exit-code
Aug 5, 2026
+170
−4
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/changes/@microsoft/rush/fix-noop-exit-code_2026-07-28-18-56-00.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "packageName": "@microsoft/rush", | ||
| "comment": "Fix an issue where a phased command exited with a nonzero exit code when its overall execution status was successful but not `SUCCESS`. This covers an iteration that scheduled no operations because a plugin consumed the work itself (which broke `rush <command> --drop-graph` in `@rushstack/rush-buildxl-graph-plugin`), as well as an iteration that a plugin short-circuited with a `SKIPPED` or `FROM CACHE` status.", | ||
| "type": "patch" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/rush" | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
libraries/rush-lib/src/cli/test/clearOperationsAndRunBuildActionRepo/a/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "name": "a", | ||
| "version": "1.0.0", | ||
| "description": "Test package a", | ||
| "scripts": { | ||
| "build": "fake_build_task_but_works_with_mock", | ||
| "rebuild": "fake_REbuild_task_but_works_with_mock" | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
libraries/rush-lib/src/cli/test/clearOperationsAndRunBuildActionRepo/b/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "name": "b", | ||
| "version": "1.0.0", | ||
| "description": "Test package b", | ||
| "scripts": { | ||
| "build": "fake_build_task_but_works_with_mock", | ||
| "rebuild": "fake_REbuild_task_but_works_with_mock" | ||
| } | ||
| } |
8 changes: 8 additions & 0 deletions
8
.../cli/test/clearOperationsAndRunBuildActionRepo/common/autoinstallers/plugins/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "plugins", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "dependencies": { | ||
| "rush-mock-clear-operations-plugin": "file:../../../../rush-mock-clear-operations-plugin" | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...stallers/plugins/rush-plugins/rush-mock-clear-operations-plugin/rush-plugin-manifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "plugins": [ | ||
| { | ||
| "pluginName": "rush-mock-clear-operations-plugin", | ||
| "description": "Rush plugin for testing a phased command that produces no operations", | ||
| "entryPoint": "index.js" | ||
| } | ||
| ] | ||
| } |
9 changes: 9 additions & 0 deletions
9
...ib/src/cli/test/clearOperationsAndRunBuildActionRepo/common/config/rush/rush-plugins.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "plugins": [ | ||
| { | ||
| "packageName": "rush-mock-clear-operations-plugin", | ||
| "pluginName": "rush-mock-clear-operations-plugin", | ||
| "autoinstallerName": "plugins" | ||
| } | ||
| ] | ||
| } |
17 changes: 17 additions & 0 deletions
17
libraries/rush-lib/src/cli/test/clearOperationsAndRunBuildActionRepo/rush.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "npmVersion": "6.4.1", | ||
| "rushVersion": "5.62.2", | ||
| "projectFolderMinDepth": 1, | ||
| "projectFolderMaxDepth": 99, | ||
|
|
||
| "projects": [ | ||
| { | ||
| "packageName": "a", | ||
| "projectFolder": "a" | ||
| }, | ||
| { | ||
| "packageName": "b", | ||
| "projectFolder": "b" | ||
| } | ||
| ] | ||
| } |
31 changes: 31 additions & 0 deletions
31
libraries/rush-lib/src/cli/test/rush-mock-clear-operations-plugin/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import type { RushSession, IPhasedCommand, Operation } from '../../../index'; | ||
|
|
||
| /** | ||
| * Mimics the shape of `@rushstack/rush-buildxl-graph-plugin`, which performs its work during | ||
| * `createOperationsAsync` and then returns an empty operation set because there is nothing left | ||
| * for Rush to execute. | ||
| * | ||
| * Such an invocation must be reported as a success, not a failure. | ||
| */ | ||
| export default class RushMockClearOperationsPlugin { | ||
| public apply(rushSession: RushSession): void { | ||
| rushSession.hooks.runAnyPhasedCommand.tapPromise( | ||
| RushMockClearOperationsPlugin.name, | ||
| async (command: IPhasedCommand) => { | ||
| command.hooks.createOperationsAsync.tapPromise( | ||
| { | ||
| name: RushMockClearOperationsPlugin.name, | ||
| // Run after every other plugin has finished creating operations. | ||
| stage: Number.MAX_SAFE_INTEGER | ||
| }, | ||
| async () => { | ||
| return new Set<Operation>(); | ||
| } | ||
| ); | ||
| } | ||
| ); | ||
| } | ||
| } | ||
6 changes: 6 additions & 0 deletions
6
libraries/rush-lib/src/cli/test/rush-mock-clear-operations-plugin/package.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| { | ||
| "name": "rush-mock-clear-operations-plugin", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "dependencies": {} | ||
| } |
9 changes: 9 additions & 0 deletions
9
libraries/rush-lib/src/cli/test/rush-mock-clear-operations-plugin/rush-plugin-manifest.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| { | ||
| "plugins": [ | ||
| { | ||
| "pluginName": "rush-mock-clear-operations-plugin", | ||
| "description": "Rush plugin for testing a phased command that produces no operations", | ||
| "entryPoint": "index.js" | ||
| } | ||
| ] | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.