Commit Graph

28 Commits

Author SHA1 Message Date
Sebastian Poxhofer 4b4d14ec00 feat(manager): pass extracted constraints to updateArtifacts (#45826)
* feat(manager): pass extracted constraints to updateArtifacts

`extractedConstraints` were collected during extraction but only ever read
by `fetch.ts` for the lookup. At artifact time every manager had to derive
the same tool constraints a second time, and when the updated package file
no longer carried the constraint there was nothing to fall back to.

`generateBranchConfig()` now merges the `extractedConstraints` of all
upgrades of a branch onto the branch config, which reaches `updateArtifacts()`
through `patchConfigForArtifactsUpdate()`. `UpdateArtifactsConfig` declares
the field and documents what it contains.

The new `resolveToolConstraint()` helper implements the ladder once:
user `constraints` > an optional artifact-time derivation > the extracted
value. The derivation is ranked above the extracted value on purpose: it
reads the package files as the branch changed them, so poetry (python is an
updatable dependency there), composer, pipenv (`pipenv` can be a dev
package) and pep621 (`requires-python` is an updatable dependency) would
otherwise regress to a stale constraint. pipenv, pep621 uv/pdm, poetry and
composer are migrated to the helper and keep their derivation.

Behaviour change: these managers now use the extract-time constraint as a
last resort instead of running unconstrained, for example on lock file
maintenance where pipenv deletes `Pipfile.lock` before deriving.

`execute-post-upgrade-commands.ts` is unaffected: it reads
`upgrade.constraints` per upgrade, and the extracted values are kept in a
separate field rather than folded into `constraints`, so post-upgrade task
tool constraints still come from user config only.

Not migrated, because their constraints are never extracted, so the
fallback would be dead code: bundler (`ruby`/`bundler`), pixi (`pixi`),
pep621 uv (`required-version`) and npm's node ladder, whose last step
already reads `package.json` engines.

* refactor(manager): resolve tool constraints through resolveToolConstraint()

Every manager now obtains the constraint of a tool it runs through
`resolveToolConstraint()` instead of reading `config.constraints` itself, so
the precedence "user config, then a value derived from the updated files, then
the constraints collected during extraction" applies everywhere. The helper
treats an empty string as not set at every step and accepts the
`PostUpdateConfig` shape, whose `constraints` may be `null`.

Behaviour changes that go beyond the new fallback to extracted constraints:

- `mix` applies its hardcoded erlang default only after the extracted
  constraint, so an erlang version collected at extraction can win over it.
- `kustomize` decides `HELM_EXPERIMENTAL_OCI` from the fully resolved helm
  constraint; `generateHelmEnvs()` takes that value instead of the config.
- `npm` (yarn): an upgrade of yarn without a new value now consults the user
  constraint before deriving one from package.json or the lock file.
- The "Using <tool> constraint from config" debug lines in bundler, composer,
  copier and pip-compile are gone, as the helper is the only reader of the
  config now.

Helpers that read the config synchronously became async: bundler
`getBundlerConstraint()`, copier `getPythonVersionConstraint()` and
`getCopierVersionConstraint()`, pip-compile `get*VersionConstraint()` and
`getToolVersionConstraint()`, gomod `deriveGoToolchainConstraints()` and
`getUpdateImportPathCmds()`, mise `getMiseLockToolConstraints()`. composer
`getPhpConstraint()` is removed.

Each converted manager has a test showing the extracted constraint reaching
the executed tool, and, where a derive callback exists, that the derived value
still wins over it.

* refactor(linters): add prefer-resolve-tool-constraint rule

Reports member reads and destructuring of `constraints` and
`extractedConstraints` from a manager config in `lib/modules/manager/**`, so
that tool constraints are resolved through `resolveToolConstraint()` in
`lib/modules/manager/util.ts` only. Writes and the same properties on package
files, which extraction has to populate, are not reported. The helper itself
and spec files are exempt in `.oxlintrc.json`.

* refactor(manager): inline thin resolveToolConstraint wrappers

Drop copier/utils.ts and the pip-compile getPipToolsVersionConstraint /
getUvVersionConstraint helpers, which only forwarded to
resolveToolConstraint(). Callers now call it directly.

* docs(development): note lock file maintenance in tool constraints section

* refactor(manager): address review on tool constraint resolution

composer only runs extractConstraints() when a user constraint is missing,
via Lazy. UpdateArtifactsConfig no longer re-declares constraints and
extractedConstraints, which ToolConstraintsConfig already provides.
2026-09-14 11:09:07 +00:00
Sebastian Poxhofer 73b90e958b refactor: remove string concetation for production code (#43442)
refactor: prefer templates rather than `+`
2026-05-19 13:31:27 +00:00
Jamie Tanna c5a87efec8 chore(types): add missing ConstraintName enforcement (#42745)
* chore(types): correct JSDoc

* chore(types): add missing `ConstraintName` enforcement

* fixup! chore(types): add missing `ConstraintName` enforcement

By simplifying this case, which should never happen, as the types
wouldn't allow it.

* chore: reorder for typechecking simplicity

* fixup! chore(types): add missing `ConstraintName` enforcement
2026-04-21 11:50:34 +00:00
Sergei Zharinov 930cf6633c refactor: Rewrite imports with .ts extensions (#40700)
fix: Additional vi.mock path corrections and prettier formatting
2026-01-26 22:48:17 +00:00
Elaman Imashov 01801296a7 fix(composer): do not use --minimal-changes with lockFileMaintenance and add postUpdateOption for not using it (#39824)
* Make --minimal-config configurable.

* Fix accidental remove.

* Remove composerMinimalChange from wrong file

* Update docs/usage/configuration-options.md

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>

* Add composerMinimalChanges to the renovateconfig interface.

* Use postupdateoptions.

* Remove the lock file before lock file maintenance upgrade.

* Import

* Flip to use composerNoMinimalChanges

* Minor fixes.

* Update artifacts.spec.ts

* Ignore tests for exception during lock file deletion (similar to npm, pnpm, etc)

* Move v8 comment.

* Remove composer lock removal

* docs(composer): reword `composerNoMinimalChanges`

* Fix Markdown formatting

---------

Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Co-authored-by: Jamie Tanna <github@jamietanna.co.uk>
2025-12-11 11:17:28 +00:00
RahulGautamSingh 76f911041a refactor: use named exports (#39196)
* use named exports

* fix test

* add missing imnport

* fix prettier
2025-11-10 12:00:35 +00:00
Stefano Arlandini d0976b49be feat(manager/composer): support updates with minimal changes (#34218)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2025-03-12 11:20:27 +00:00
Stefano Arlandini d300cd0f5c fix(manager/composer): use intersects() instead of matches() to compare tool constraint (#34256)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-03-06 07:19:51 +00:00
renovate[bot] 55845508b6 chore(deps): update eslint monorepo to v9 (major) (#33573)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2025-02-20 11:31:13 +00:00
Sergei Zharinov a39ca89101 refactor: Host rule types (#28454) 2024-04-17 05:00:00 +00:00
Sergei Zharinov b69416ce17 refactor(prettier): Force trailing commas (#25631) 2023-11-07 15:50:29 +00:00
Michael Kriese f0d676242a fix: better branch code coverage (#24276) 2023-09-07 04:39:39 +00:00
Jiahao Guo 58748ab6c2 refactor(util): move GitHub token related utils to proper place (#23869) 2023-08-15 14:26:38 +00:00
Rhys Arkins 36e2b328bb chore: update types reference 2023-08-15 11:31:15 +02:00
renovate[bot] fe739befbf chore(deps): update linters to v6 (major) (#23325)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-08-02 15:07:49 +00:00
Sergei Zharinov 664dc808e7 refactor(composer): Use schema for parsing (#21520) 2023-05-07 20:51:20 +00:00
DjordyKoert 62b57aa27c feat: disable setting COMPOSER_AUTH for gitlab (#20634)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2023-04-17 06:16:02 +00:00
Rhys Arkins 1767f7608b fix: Revert "refactor: safely parse composer files" (#21448) 2023-04-12 14:30:33 +02:00
Jamie Magee 965054d7d4 refactor: safely parse composer files (#21173) 2023-04-08 15:08:07 +00:00
Eric Durand-Tremblay e8a5437cd3 feat(manager/composer): support git-tags hostRules for github.com when updating artifacts (#18004)
Co-authored-by: Rhys Arkins <rhys@arkins.net>
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
fixes undefined
2023-01-13 13:33:49 +00:00
Rhys Arkins fc605a59c0 fix(composer): Revert "feat(manager/composer): support git-tags hostRules for github.com when updating artifacts" (#17961) 2022-09-25 07:06:44 +03:00
Eric Durand-Tremblay 781b8fbcb7 feat(manager/composer): support git-tags hostRules for github.com when updating artifacts (#16193) 2022-08-30 16:49:01 +03:00
Gary Lockett 94cfaecef2 fix(manager/composer): match composer's handling of the patch number for platform PHP version (#17299)
Signed-off-by: Gary Lockett <gary@creativecow.uk>
2022-08-29 06:31:33 +00:00
IKEDA Sho 72db89f6e5 refactor: Fix constraint typos (#16879) 2022-08-01 04:02:55 +00:00
Sergei Zharinov e4dbd4ad49 fix(ci): Restrict template expressions (#16834)
* fix(ci): Restrict template expressions

* Fix

* Fix

* Fix
2022-07-30 16:28:31 +02:00
Michael Kriese e5c6f38d75 refactor: enable strict checks (#16168)
* refactor:  enable strict checks

* chore: revert changes

* chore: fix tsconfig
2022-06-21 13:00:21 +02:00
Michael Kriese f5f06c73be refactor(manager): more strict null checks (#15168) 2022-04-20 06:19:59 +02:00
Rhys Arkins dca3418bbd refactor: lib/modules (#14488)
Moves datasource, manager, platform and versioning code from lib/ into new lib/modules/

BREAKING CHANGE: External tools must update paths to datasource, manager, platform and versioning
2022-03-04 09:04:02 +01:00