diff --git a/common/changes/@microsoft/rush/fix-problem-collector-pipeline_2026-03-20-22-38.json b/common/changes/@microsoft/rush/fix-problem-collector-pipeline_2026-03-20-22-38.json new file mode 100644 index 00000000000..84060c0c50b --- /dev/null +++ b/common/changes/@microsoft/rush/fix-problem-collector-pipeline_2026-03-20-22-38.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Fix ProblemCollector wiring in OperationExecutionRecord: add preventAutoclose, strip ANSI colors before matching, and always include problemCollector in the terminal pipeline", + "type": "patch" + } + ], + "packageName": "@microsoft/rush" +} diff --git a/libraries/rush-lib/src/logic/operations/OperationExecutionRecord.ts b/libraries/rush-lib/src/logic/operations/OperationExecutionRecord.ts index 63da9421b54..301690ff933 100644 --- a/libraries/rush-lib/src/logic/operations/OperationExecutionRecord.ts +++ b/libraries/rush-lib/src/logic/operations/OperationExecutionRecord.ts @@ -114,6 +114,8 @@ export class OperationExecutionRecord implements IOperationRunnerContext, IOpera preventAutoclose: true }); public readonly problemCollector: ProblemCollector = new ProblemCollector({ + // Allow writing to this object after transforms have been closed. We clean it up manually in a finally block. + preventAutoclose: true, matcherJson: [ { name: 'rushstack-file-error-unix', @@ -322,14 +324,21 @@ export class OperationExecutionRecord implements IOperationRunnerContext, IOpera // // +--> quietModeTransform? --> collatedWriter // | - // normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable + // normalizeNewlineTransform --1--> stderrLineTransform --2--> projectLogWritable? // | // +--> stdioSummarizer - const destination: TerminalWritable = projectLogWritable - ? new SplitterTransform({ - destinations: [projectLogWritable, stdioSummarizer, problemCollector] - }) - : stdioSummarizer; + // | + // +--> removeColorsTransform --> problemCollector + const removeColorsTransform: TextRewriterTransform = new TextRewriterTransform({ + destination: problemCollector, + removeColors: true + }); + + const destination: TerminalWritable = new SplitterTransform({ + destinations: projectLogWritable + ? [projectLogWritable, stdioSummarizer, removeColorsTransform] + : [stdioSummarizer, removeColorsTransform] + }); const stderrLineTransform: StderrLineTransform = new StderrLineTransform({ destination,