[rush] Add --show-existing-failure-logs parameter to skip execution and replay failure logs
Summary
Fixes the workflow inefficiency when performing sweeping monorepo changes (e.g., TypeScript upgrades) where developers lose track of which projects failed after fixing individual failures. Adds --show-existing-failure-logs parameter that replays error logs from previous runs without re-executing operations.
Fixes microsoft/rushstack#5450
Details
Implementation:
-
PhasedScriptAction: Added--show-existing-failure-logsflag parameter, incompatible with--watch -
ShowExistingFailureLogsPlugin: New plugin that:- Checks for
.rush/temp/operation/<phase>/error.logfiles - Returns
OperationStatus.Failureif error log exists (replays viaOperationMetadataManager.tryRestoreAsync) - Returns
OperationStatus.Skippedif no error log (silences operation) - Applied before cache/skip plugins to ensure precedence
- Checks for
- Build cache and legacy skip detection bypassed when flag active
-
Changelog: Added change file for
@microsoft/rushdocumenting the new feature as a minor version change
Design choice: Returns terminal status from beforeExecuteOperation hook to prevent runner execution while preserving full operation graph traversal for dependencies.
Performance: Near-instant execution (0.00s per operation) - only reads existing files, no computation or network I/O.
How it was tested
Unit tests: Added comprehensive tests for ShowExistingFailureLogsPlugin covering both error log presence/absence scenarios.
Manual validation:
- Introduced TypeScript error in
@microsoft/rush-lib, ranrush build --only @microsoft/rush-libto generate error log - Fixed error, ran
rush build --show-existing-failure-logs --only @microsoft/rush-lib - Verified: Operation completed in 0.00s, error log replayed exactly, no actual execution occurred
- Tested with
--toselection: Confirmed operations without error logs were silenced (Skipped status)
Impacted documentation
- Website docs may need update for phased command parameters: https://rushjs.io/pages/commands/rush_build/
- Consider adding example to "Selecting subsets of projects" article
Example usage:
# Typical workflow during TypeScript upgrade
rush build # See multiple failures
rush build --to failing-pkg # Fix one package
rush build --show-existing-failure-logs # Review remaining failures without re-running
Original prompt
This section details on the original issue you should resolve
<issue_title>[rush] Add a parameter to PhasedScriptAction that skips execution and just dumps any existing failure logs</issue_title> <issue_description>## Summary When performing sweeping changes to a monorepo, for example upgrading TypeScript, one will often find themselves in the following loop:
- Run a broad
rush buildorrush testcommand to find issues- Encounter several projects with issues
- Drill into a single project's failure log and work through the issues
- Recompile the failed project and see if any new issues show up
- Once the focused project is fixed, go back to (1) because all record of which other projects failed is hard to come by
It would be useful to be able to run a command like
rush test --show-existing-failure-logsthat would simply build the graph, look for the error log files, and for any operations where they exist, replay the log in the same manner as for a build cache hit. All operations that did not have existing failures would be silenced.Additional use cases: AI agents could run
rush build --to x, ignore the output (other than exit code), then runrush build --to x --show-existing-failure-logsto inject only the relevant information into the context.</issue_description>Comments on the Issue (you are @copilot in this section)
- Fixes microsoft/rushstack#5450
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
@copilot - this change needs a changelog entry.
@copilot - this change needs a changelog entry.
Added changelog entry in commit 735ca53.