Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 18, 2025

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 #5450

Details

Implementation:

  • PhasedScriptAction: Added --show-existing-failure-logs flag parameter, incompatible with --watch
  • ShowExistingFailureLogsPlugin: New plugin that:
    • Checks for .rush/temp/operation/<phase>/error.log files
    • Returns OperationStatus.Failure if error log exists (replays via OperationMetadataManager.tryRestoreAsync)
    • Returns OperationStatus.Skipped if no error log (silences operation)
    • Applied before cache/skip plugins to ensure precedence
  • Build cache and legacy skip detection bypassed when flag active
  • Changelog: Added change file for @microsoft/rush documenting 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:

  1. Introduced TypeScript error in @microsoft/rush-lib, ran rush build --only @microsoft/rush-lib to generate error log
  2. Fixed error, ran rush build --show-existing-failure-logs --only @microsoft/rush-lib
  3. Verified: Operation completed in 0.00s, error log replayed exactly, no actual execution occurred
  4. Tested with --to selection: Confirmed operations without error logs were silenced (Skipped status)

Impacted documentation

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:

  1. Run a broad rush build or rush test command to find issues
  2. Encounter several projects with issues
  3. Drill into a single project's failure log and work through the issues
  4. Recompile the failed project and see if any new issues show up
  5. 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-logs that 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 run rush build --to x --show-existing-failure-logs to inject only the relevant information into the context.</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ 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 AI changed the title [WIP] Add parameter to PhasedScriptAction to show existing failure logs [rush] Add --show-existing-failure-logs parameter to skip execution and replay failure logs Nov 18, 2025
Copilot AI requested a review from iclanton November 18, 2025 23:17
Copilot finished work on behalf of iclanton November 18, 2025 23:17
@iclanton
Copy link
Member

@copilot - this change needs a changelog entry.

Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot - this change needs a changelog entry.

Added changelog entry in commit 735ca53.

Copilot finished work on behalf of iclanton November 19, 2025 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

[rush] Add a parameter to PhasedScriptAction that skips execution and just dumps any existing failure logs

2 participants