Skip to content

Commit b1bef90

Browse files
ericprestemonEric Prestemoniclanton
authored
[rush] Fix(#5552): sort additionalFilesForOperation for hashing (#5629)
* [rush] Fix(#5552): sort additionalFilesForOperation for hashing Fixes #5552: sort additionalFilesForOperation to produce a stable hash for caching * Update common/changes/@microsoft/rush/eric.prestemon-fix-5552_2026-02-18-01-11.json Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com> --------- Co-authored-by: Eric Prestemon <eric.prestemon@users.noreply.github.com> Co-authored-by: Ian Clanton-Thuon <iclanton@users.noreply.github.com>
1 parent fca1ad5 commit b1bef90

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@microsoft/rush",
5+
"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.",
6+
"type": "none"
7+
}
8+
],
9+
"packageName": "@microsoft/rush"
10+
}

libraries/rush-lib/src/logic/incremental/InputsSnapshot.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,9 @@ export class InputsSnapshot implements IInputsSnapshot {
334334
const additionalFilesForOperation: ReadonlySet<string> | undefined =
335335
record.additionalFilesByOperationName?.get(operationName);
336336
if (additionalFilesForOperation) {
337-
for (const [filePath, hash] of this._resolveHashes(additionalFilesForOperation)) {
337+
// Sort the additional files to ensure deterministic hash computation
338+
const sortedAdditionalFiles: string[] = Array.from(additionalFilesForOperation).sort();
339+
for (const [filePath, hash] of this._resolveHashes(sortedAdditionalFiles)) {
338340
hashes.set(filePath, hash);
339341
}
340342
}

0 commit comments

Comments
 (0)