Skip to content

fix(cargo): Skip "replace" range upgrade if new version still matches#33773

Merged
rarkins merged 1 commit intorenovatebot:mainfrom
zharinov:fix/cargo-versioning-replace-guard
Jan 23, 2025
Merged

fix(cargo): Skip "replace" range upgrade if new version still matches#33773
rarkins merged 1 commit intorenovatebot:mainfrom
zharinov:fix/cargo-versioning-replace-guard

Conversation

@zharinov
Copy link
Copy Markdown
Collaborator

@zharinov zharinov commented Jan 22, 2025

Changes

Context

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@zharinov zharinov requested review from rarkins and viceice January 22, 2025 21:37
@rarkins
Copy link
Copy Markdown
Contributor

rarkins commented Jan 22, 2025

What does a packageFiles with updates entry look like for a case like this? e.g. if it's got a package file value of 1.2 and latest version is 1.3.4 will currentVersion=1.3.4? I want to make sure this works end-to-end

@zharinov
Copy link
Copy Markdown
Collaborator Author

Yes, and I can't actually reproduce it, because no versions left greater than the latest one, so everything gets filtered out, and getNewValue is never called (even when the locked version is lower).

Checkout reproduction repo: https://github.com/renovate-testing/test-19809-fix-replace-strategy

But yes, when I use debugger and trick the currentVersion to be lower one, it filters out upgrade based on this condition (see line 720):

  • res.updates = res.updates
    .filter(
    (update) => update.newValue !== null || config.currentValue === null,
    )
    .filter((update) => update.newDigest !== null)
    .filter(
    (update) =>
    (is.string(update.newName) &&
    update.newName !== config.packageName) ||
    update.isReplacement === true ||
    update.newValue !== config.currentValue ||
    update.isLockfileUpdate === true ||
    // TODO #22198
    (update.newDigest &&
    !update.newDigest.startsWith(config.currentDigest!)),
    );

@rarkins
Copy link
Copy Markdown
Contributor

rarkins commented Jan 23, 2025

So maybe this bug isn't really a bug anymore because it can't happen?

Comment thread lib/modules/versioning/cargo/index.spec.ts
@rarkins rarkins added this pull request to the merge queue Jan 23, 2025
Merged via the queue into renovatebot:main with commit 6af55c2 Jan 23, 2025
@rarkins rarkins deleted the fix/cargo-versioning-replace-guard branch January 23, 2025 11:34
@renovate-release
Copy link
Copy Markdown

🎉 This PR is included in version 39.125.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

SuperSandro2000 added a commit to SuperSandro2000/renovate that referenced this pull request Jan 23, 2025
* upstream/main: (73 commits)
  fix(cargo): Skip "replace" range upgrade if new version still matches (renovatebot#33773)
  feat(presets): Add nestjs/config to nest monorepo (renovatebot#33785)
  chore(deps): update python:3.13 docker digest to 6ee7975 (renovatebot#33781)
  chore(deps): update dependency @types/node to v22.10.7 (renovatebot#33780)
  feat: Drop older `timeStamp` field support (renovatebot#33734)
  feat: Switch to `Timestamp` type (renovatebot#33648)
  chore(deps): update github/codeql-action action to v3.28.3 (renovatebot#33767)
  build(deps): update dependency @renovatebot/osv-offline to v1.5.12 (renovatebot#33766)
  build(deps): update dependency fs-extra to v11.3.0 (renovatebot#33765)
  chore(deps): update codecov/codecov-action action to v5.2.0 (renovatebot#33763)
  build(deps): update dependency cronstrue to v2.53.0 (renovatebot#33762)
  docs: added list of valid namespace codes for the cacheTtlOverride config (renovatebot#33754)
  test(npm): use fs test utils in extract/pnpm.spec.ts (renovatebot#33756)
  docs: remove platform information from Mend-hosted App config page (renovatebot#33724)
  feat(presets): add monorepo html-eslint (renovatebot#33730)
  feat(presets): add arrow-kt monorepo (renovatebot#33740)
  build(deps): update dependency better-sqlite3 to v11.8.0 (renovatebot#33750)
  chore(deps): update dependency eslint-plugin-jest to v28.11.0 (renovatebot#33749)
  chore(deps): update dependency eslint-plugin-jest to v28.10.1 (renovatebot#33747)
  chore(deps): update otel/opentelemetry-collector-contrib docker tag to v0.118.0 (renovatebot#33746)
  ...
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Feb 23, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cargo replace rangeStrategy leads to in-range updates when "x.y" specified in Cargo.toml

3 participants