diff --git a/common/changes/@microsoft/rush/eric.prestemon-fix-5552_2026-02-18-01-11.json b/common/changes/@microsoft/rush/eric.prestemon-fix-5552_2026-02-18-01-11.json new file mode 100644 index 00000000000..213e3ec34ef --- /dev/null +++ b/common/changes/@microsoft/rush/eric.prestemon-fix-5552_2026-02-18-01-11.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@microsoft/rush", + "comment": "Sort the `additionalFilesForOperation` property in operation settings entries in projects' `config/rush-project.json` files before computing operation hashes to produce a stable hash for caching.", + "type": "none" + } + ], + "packageName": "@microsoft/rush" +} \ No newline at end of file diff --git a/libraries/rush-lib/src/logic/incremental/InputsSnapshot.ts b/libraries/rush-lib/src/logic/incremental/InputsSnapshot.ts index 8eeaa5ed224..0568558d014 100644 --- a/libraries/rush-lib/src/logic/incremental/InputsSnapshot.ts +++ b/libraries/rush-lib/src/logic/incremental/InputsSnapshot.ts @@ -318,7 +318,9 @@ export class InputsSnapshot implements IInputsSnapshot { const additionalFilesForOperation: ReadonlySet | undefined = record.additionalFilesByOperationName?.get(operationName); if (additionalFilesForOperation) { - for (const [filePath, hash] of this._resolveHashes(additionalFilesForOperation)) { + // Sort the additional files to ensure deterministic hash computation + const sortedAdditionalFiles: string[] = Array.from(additionalFilesForOperation).sort(); + for (const [filePath, hash] of this._resolveHashes(sortedAdditionalFiles)) { hashes.set(filePath, hash); } }