Commit Graph

38 Commits

Author SHA1 Message Date
Sebastian Poxhofer 05e1271376 test: use expect().resolves instead of awaiting inside expect (#45672)
Enables the vitest/prefer-expect-resolves oxlint rule and applies its
autofix across the spec suite.
2026-09-04 10:40:46 +00:00
Dharma Teja Thoutam 40fce9aba7 fix(gerrit): resolve relative submodule URLs for nested project paths (#44667)
* fix(gerrit): resolve relative submodule URLs for nested project paths

* Fix tests after rebase

---------

Co-authored-by: Felipe Santos <felipe.santos@ericsson.com>
2026-09-03 12:41:31 +00:00
Quentin BERTRAND d83651c8de fix(gerrit): use max available Code-Review vote value for autoApprove (#44425)
* fix(gerrit): use max available Code-Review vote value for autoApprove

* Update lib/modules/platform/gerrit/scm.ts

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>

* refactor(gerrit): extract Code-Review label name into a constant

* fix(gerrit): skip Code-Review vote and warn if label is not defined on project

* test(gerrit): restore Code-Review+2 auto-approve test with a defined label

* docs(gerrit): shorten getAutoApproveLabelValue() comment

* fix(gerrit): use static log message with metadata object for logger.warn

* refactor(gerrit): extract GerritLabels type alias

---------

Co-authored-by: Felipe Santos <felipecassiors@gmail.com>
2026-07-27 19:35:42 +00:00
Sebastian Poxhofer 5ad36a2387 test(linters): add linting rule to enforce usage of host rules test util (#44692)
* ci(linter): add renovate/no-host-rules-mock rule

Flags vi.mock()/vi.doMock() calls whose module specifier contains
"host-rules" in spec files. Tests should configure real rules via
hostRules.add() instead of mocking the host-rules module.

Enabled at "warn" severity instead of "error": the repo currently has
35 pre-existing violations across 34 spec files, which exceeds the
agreed fix threshold of 12 files. No violation fixes are included;
migrating each spec to real hostRules.add()/clear() setup is a
semantic test rewrite that should be done incrementally, after which
the rule can be promoted to "error".

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): enforce renovate/no-host-rules-mock at error

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(datasource): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(manager): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(platform): use real host-rules instead of mocking

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* test(util,workers): use real host-rules instead of mocking

Also narrow renovate/no-host-rules-mock to the host-rules module itself so that mocking e.g. host-rules-from-env is not flagged.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* ci(linter): mention '~test/host-rules.ts' util in no-host-rules-mock message

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-19 10:36:12 +00:00
Felipe Santos 18c9c9340e feat(gerrit): rework scm implementation (#38966)
* fix(gerrit): remove memCache to fix prNo coming as null when pr-created

* perf(gerrit): remove custom scm functions

* Fully remove login parameter from configureScm()

* Fetch refspecs in batches

* Remove unnecessary error handling

* Add tests

* Throw if branch init fails

* Simplify tests a little

* Reduce more the tests

* More test changes

* Reuse the existing test setup more

* Undo test import change

* Improve initializeBranchesFromRefspecs JSDoc

* The same for deleteBranchCreatedFromRefspec

* Reduce a log to trace level

* Abandon Code-Review -2 changes before initializing repository

* Simply initialize the branches after git.initRepo()

* Rework approach to be more generic

* Add TODO comment about commitAndPush()

* fix(gerrit): defer change creation to `createPr()`

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Refactor hashtags handling

* Add prTitle to all missing commitAndPush()

* Fix type check

* Fix test issue

* Fix gerrit tests

* Add warning when prTitle is set in updatePr

* Remove now useless labels from commitAndPush

* Fix gerrit client coverage

* Fix gerrit scm coverage

* Fix rebase coverage

* Improve TODO about assignees

* Fix formatting

* Fix review comment

* Extract to a pushForReview function

* Fix after #41382

* Fix onboarding

* Cleanup code

* Fix ESLint

* Fix tests

* Restore gitRetry for git.merge

* Fix tests

* Simplify hashtags code

* Delete pendingChangeBranch in pushForReview()

* Fix test name

* Remove unnecessary test comments

* Improve test name again

* Fix another test name

* Delete local branch in Gerrit SCM

* Add test for deleting pending branch

* Add tests for pushForReview()

* Simplify/optimize commitAndPush

* Align jsdoc terminology on virtual branches

* Remove no longer relevant TODO

* Update virtal branch on push

* Simplify deleteVirtualBranch

* Fix test case name

* Improve another test name

* Restore test deleted by mistake

* Fix another small test inconsistency

* Fix coverage

* Fix Renovate not detecting modified commits

* Simplify Gerrit commitAndPush by leveraging git.commitFiles

* Fix some code style issues

* Revert "Simplify Gerrit commitAndPush by leveraging git.commitFiles"

This reverts commit d71edcc279.

* Fix another small code style issue

* Use isUndefined instead

* Fix one small test style issue

* Fix more code style issues

* Fix Gerrit mergeToLocal trying to fetch (and probably failing)

* Extract refs/remotes/origin to a function

* Rename virtualBranchRef to remoteBranchRef

* Fix remoteBranchRef tsc

* Consistently use currentRevision in Gerrit tests

* Remove unnecessary type assertion

* Instrument "fetch virtual branches"

* Remove pendingChangeBranches, avoid overriding deleteBranch and mergeToLocal

* Optimize virtual branches fetch (no longer requires update-ref), convert virtualBranches to Record, rename setVirtualBranch to registerVirtualBranch

* Combine registerVirtualBranch and updateVirtualBranch into a single setVirtualBranch, and update ref in virtual branch too

* Fix virtualBranches not being initialized

* Add some debug logs

* Simplify mergeToLocal for virtual branches

* Revert "Simplify mergeToLocal for virtual branches"

This reverts commit 375d57a474.

* Remove useless isVirtual const

* test(git): add toThrow message for virtualBranches fetch error

Satisfy vitest/require-to-throw-message so oxlint passes.

* Update lib/util/git/types.ts

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

* Address review feedback

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
2026-07-17 21:47:08 +00:00
Felipe Santos b3a21cfc51 fix(gerrit): enforce username in SSH Git URLs (#43651) 2026-07-14 18:21:10 +00:00
Sebastian Poxhofer ad0b59f8b7 refactor(oxlint): enable vitest/require-to-throw-message (#44421) 2026-07-07 17:47:04 +00:00
Sebastian Poxhofer 171a591d84 feat(git): validate commit shas (#43988)
* feat(git): validate length commit shas

* test: adapt test mocks

* chore: update import paths

* feat(git): make the validation more strict and support repositories using sha256

* test: add fakeSha function for deterministic git commit shas in tests
2026-06-15 06:36:57 +00:00
Sebastian Poxhofer dfe806f9ac refactor(gerrit): use schema validated getJson instead of getJsonUnchecked (#43777)
* fix(platform/gerrit): replace getJsonUnchecked with validated getJson

Migrate all getJsonUnchecked calls in lib/modules/platform/gerrit/client.ts
to use Zod-validated getJson. Co-locate schemas in schema.ts with lenient
optional fields to ensure backward compatibility with all existing API responses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* strictly follow previous interfaces

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-09 17:23:04 +00:00
Sergei Zharinov 9bf2f6b4be fix(gerrit): Use addMessageIfNotAlreadyExists in updatePr (#43155) 2026-05-07 20:13:25 +00:00
Felipe Santos 1bbe82400e fix(gerrit): defer change creation to createPr() (#39250)
* fix(gerrit): defer change creation to `createPr()`

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Refactor hashtags handling

* Add prTitle to all missing commitAndPush()

* Fix gerrit tests

* Add warning when prTitle is set in updatePr

* Remove now useless labels from commitAndPush

* Fix gerrit client coverage

* Fix gerrit scm coverage

* Fix rebase coverage

* Improve TODO about assignees

* Fix formatting

* Fix review comment

* Extract to a pushForReview function

* Fix after #41382

* Fix onboarding

* Cleanup code

* Fix ESLint

* Fix tests

* Restore gitRetry for git.merge

* Fix tests

* Simplify hashtags code

* Delete pendingChangeBranch in pushForReview()

* Fix test name

* Remove unnecessary test comments

* Improve test name again

* Fix another test name

* Delete local branch in Gerrit SCM

* Add test for deleting pending branch

* Add tests for pushForReview()

* Fix test case name

* Improve another test name

* Fix another small test inconsistency

* Fix some code style issues

* Use isUndefined instead

* Fix one small test style issue

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
2026-04-28 08:29:26 +00:00
Felipe Santos 7ebba26236 feat: add commitHourlyLimit (#36226)
* feat: add `commitHourlyLimit`

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Update docs/usage/configuration-options.md

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

* Remove date optionality

* Fix lint comment

* Fix coverage

* Restore contents of commit.spec.ts

* Use ! somewhere else too

* Change optional parameter to nullish

* Refactor `!` to use proper check

* Fix set-branch-commit.spec.ts lint

* Fix test coverage

* Apply suggestions from code review

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

* Split commit-limit-reached into two

* Fix review comments

* Use toUTC() where applicable

* Simplify another test to utc()

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
Co-authored-by: RahulGautamSingh <rahultesnik@gmail.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2026-02-19 18:00:32 +00:00
Sergei Zharinov 9d857c1f68 refactor(lint): Organize imports with biome (#40966) 2026-02-06 13:40:01 +00:00
Felipe Santos 5db0218ec1 fix(gerrit): not cloning submodules (#40089) 2026-01-28 22:25:16 +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
RahulGautamSingh a052292daf refactor(platforms): changes around createdAt field (#40063)
* refactor(platforms): changes around  field

* push test changes
2025-12-18 14:13:34 +00:00
Felipe Santos c1b45a56b7 feat(gerrit): use most efficient search operators based on Gerrit version (#39223)
* fix(gerrit): use most efficient search operators based on Gerrit version

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Address review comments

* Use ignore if instead

* Rename client.version to client.gerritVersion

* Update lib/modules/platform/gerrit/client.spec.ts

Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
Co-authored-by: Sebastian Poxhofer <secustor@users.noreply.github.com>
2025-12-12 18:49:01 +00:00
Felipe Santos 28116f7d40 feat(gerrit): support moving changes to different target branches (#39046)
* feat(gerrit): support moving changes to different target branches

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>

* Update lib/modules/platform/types.ts

---------

Signed-off-by: Felipe Santos <felipe.santos@ericsson.com>
Co-authored-by: Michael Kriese <michael.kriese@gmx.de>
2025-12-11 15:58:45 +00:00
Felipe Santos 84633f1e56 fix(gerrit): avoid retrieving messages in updatePr and createPr (#39015)
* fix(gerrit): avoid retrieving change messages in updatePr and createPr

* Remove more of now unnecessary code

* Remove useless TODOs
2025-11-12 15:42:22 +00:00
Felipe Santos fc3f7a8ee7 fix(gerrit): remove memCache to fix prNo coming as null when pr-created (#38957) 2025-10-31 07:47:19 +00:00
Felipe Santos 3ea1611e87 feat(gerrit): handle pagination when querying changes (#38535)
* feat(gerrit): handle pagination when querying changes

* Add noPagination option, rename pageLimit to limit, and JSDoc them

* Rename limit to pageLimit

* Rename test references
2025-10-27 17:36:50 +00:00
renovate[bot] 1280fe4dc7 chore(deps): update dependency @vitest/eslint-plugin to v1.3.16 (main) (#38502)
* chore(deps): update dependency @vitest/eslint-plugin to v1.3.16

| datasource | package               | from   | to     |
| ---------- | --------------------- | ------ | ------ |
| npm        | @vitest/eslint-plugin | 1.3.13 | 1.3.16 |

* fix linting errors

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: secustor <sebastian@poxhofer.at>
2025-10-13 09:24:15 +00:00
Felipe Santos 30b0599efe feat(gerrit): suggest use of rebase hashtag (#36955) 2025-07-11 13:29:24 +00:00
Felipe Santos 6e4f334d2b fix(gerrit): use change instead of change-request terminology (#35908) 2025-07-04 17:41:14 +00:00
Felipe Santos 8db486bf2e feat(gerrit): add support for labels through hashtags (#35900) 2025-07-04 08:44:34 +00:00
Felipe Santos 21042b226a fix(gerrit): various fixes and optimizations (#35661) 2025-06-06 07:27:27 +00:00
Felipe Santos 664b8fe30c feat(gerrit): add message when abandoning change due to Code-Review -2 (#36207) 2025-05-29 10:39:46 +00:00
Felipe Santos 3d68582b8a fix(gerrit): auto-approve without calling gerrit api (#35315) 2025-04-17 13:43:11 +00:00
Michael Kriese 19c115c813 test: cleanup (#34785) 2025-03-13 17:52:09 +00:00
Michael Kriese 4f60a8b7fe test: mock git globally (#34783) 2025-03-13 15:48:02 +00:00
Michael Kriese 997c23502e test: migrate to vitest (#34475)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
2025-02-26 09:35:54 +00:00
Felipe Santos e22b96e7b3 fix(gerrit): getBranchStatus not returning red for failed checks (#32812) 2024-11-30 09:49:26 +00:00
Felipe Santos 73821c6c73 feat(gerrit): Reduce email notifications (#32817) 2024-11-30 05:51:52 +00:00
Felipe Santos f7e4668eff fix(gerrit): improve commit message vs pr title workaround (#32115) 2024-11-12 05:54:01 +00:00
RahulGautamSingh 4b502025fe refactor: rename platformOptions -> platformPrOptions (#30173) 2024-07-16 07:33:55 +00:00
Felipe Santos 9841fa00c9 fix(gerrit): commitBody option not being effective (#28774) 2024-05-02 08:39:28 +00:00
Rhys Arkins 59df10183a feat(platform): getRepoForceRebase -> getBranchForceRebase (#27052)
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
2024-02-06 09:14:11 +00:00
Markus Schulz b2422d86fd feat: Support for Platform "Gerrit" (#18961)
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
Co-authored-by: Rhys Arkins <rhys@arkins.net>
2023-12-29 17:55:25 +00:00