postUpgradeTasks changes are dropped when a branch has duplicate updatedArtifacts entries for the same path
Describe the proposed change(s).
Discussed in #42729.
When several updateArtifacts() calls in one branch return the same file, updatedArtifacts holds more than one entry for that path. Any change a postUpgradeTasks command makes to that file is then lost from the commit, even though Renovate logs Post-upgrade file saved.
Cause
processUpdateArtifactResults()- pushes every returned file, so the same path can appear more than oncepostUpgradeCommandsExecutor()- writes every entry to disk before running the tasks, then refreshes only the first matching entry withupdatedArtifacts.find()prepareCommit()- writes the entries in order, so the last entry, which still holds the content from before the task ran, overwrites the updated one
Affected ecosystems
Reported in the discussion for:
- NuGet with Central Package Management, where several package files regenerate the same lock files
- Go workspaces with
gomodTidyAll, wheredependentFilesreturnsgo.modandgo.sumthat the directly updated module already returned - uv workspaces, where each member
pyproject.tomlrelocks the shared rootuv.lock, and a grouped branch upgrades a different package in each member
Reproduction
- Go: https://github.com/dlm6693/renovate-repro-42729 (branches
evidence/unpatched-mainandevidence/with-fixdiffer only by the dropped marker line) - uv: a minimal tree with controls in https://github.com/renovatebot/renovate/discussions/42729
Proposed fix
Remove duplicate entries where they are created. In processUpdateArtifactResults(), replace an existing entry with the same path instead of pushing a new one, so the last result wins. This matches what prepareCommit() commits today, and later steps never see two entries for one path.
Source: renovatebot/renovate