From 5ec525da16ce863c60a5cf297dbccd20a7267d89 Mon Sep 17 00:00:00 2001 From: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com> Date: Thu, 3 Sep 2026 09:56:25 -0400 Subject: [PATCH] fix(renovate): handle conda pin prefix in regex manager Update the conda environment regex manager config to store extracted values with a `==` prefix via `currentValueTemplate`, aligning with conda versioning expectations. The tests now assert prefixed values and compute replacements using Renovate's conda `getNewValue` helper so updates preserve correct conda pin formatting. --- renovate-config.json5 | 1 + tests/renovate-config.test.mjs | 19 ++++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/renovate-config.json5 b/renovate-config.json5 index 6dfb5c57..aaa2ff67 100644 --- a/renovate-config.json5 +++ b/renovate-config.json5 @@ -223,6 +223,7 @@ "matchStrings": [ "(?[ \\t]*)-[ \\t]*(?[A-Za-z0-9_.-]+)[ \\t]*=[ \\t]*(?[^=\\s#][^\\s#]*)", ], + "currentValueTemplate": "=={{{currentValue}}}", "datasourceTemplate": "conda", "packageNameTemplate": "conda-forge/{{{depName}}}", "versioningTemplate": "conda", diff --git a/tests/renovate-config.test.mjs b/tests/renovate-config.test.mjs index 4885d6cf..ae086ecd 100644 --- a/tests/renovate-config.test.mjs +++ b/tests/renovate-config.test.mjs @@ -3,6 +3,7 @@ import fs from 'node:fs'; import test from 'node:test'; import JSON5 from 'json5'; +import {api as condaVersioning} from 'renovate/dist/modules/versioning/conda/index.js'; import {extractPackageFile as extractCdnUrlPackageFile} from 'renovate/dist/modules/manager/cdnurl/index.js'; import {extractPackageFile as extractRegexPackageFile} from 'renovate/dist/modules/manager/custom/regex/index.js'; import {compile} from 'renovate/dist/util/template/index.js'; @@ -132,14 +133,14 @@ dependencies: })), [ { - currentValue: '1.2.3', + currentValue: '==1.2.3', datasource: 'conda', depName: 'doxygen', packageName: 'conda-forge/doxygen', versioning: 'conda', }, { - currentValue: '4.5.6', + currentValue: '==4.5.6', datasource: 'conda', depName: 'graphviz', packageName: 'conda-forge/graphviz', @@ -149,16 +150,24 @@ dependencies: ); const dependency = dependencies[0]; - const newVersion = nextTestVersion(dependency.currentValue); + const currentVersion = dependency.currentValue.replace(/^==/, ''); + const newVersion = nextTestVersion(currentVersion); + const newValue = condaVersioning.getNewValue({ + currentValue: dependency.currentValue, + currentVersion, + isReplacement: false, + newVersion, + rangeStrategy: 'replace', + }); const updatedReplaceString = compile( condaEnvironmentManager.autoReplaceStringTemplate, - {...dependency, newVersion}, + {...dependency, newValue, newVersion}, false, ); const updatedContent = content.replace(dependency.replaceString, updatedReplaceString); const updatedDependencies = extractCondaDependencies(fileName, updatedContent); - assert.equal(updatedDependencies[0].currentValue, newVersion); + assert.equal(updatedDependencies[0].currentValue, newValue); assert.match(updatedContent, new RegExp(` - doxygen=${newVersion.replaceAll('.', '\\.')}`)); assert.match(updatedContent, / - graphviz = 4\.5\.6 # Keep an inline comment\./); });