Skip to content

feat(gerrit): rework scm implementation#38966

Open
felipecrs wants to merge 99 commits intorenovatebot:mainfrom
felipecrs:simplify-gerrit-scm
Open

feat(gerrit): rework scm implementation#38966
felipecrs wants to merge 99 commits intorenovatebot:mainfrom
felipecrs:simplify-gerrit-scm

Conversation

@felipecrs
Copy link
Copy Markdown
Contributor

@felipecrs felipecrs commented Oct 30, 2025

Important

This PR currently depends on:

And is best reviewed after it is merged. The actual diff can be seen here.

Because of the alarming number of changed lines, here is the actual number when not considering the PRs above and tests:

git diff --stat gerrit-fix-create-pr simplify-gerrit-scm -- . ':!*.spec.ts' ':!*spec.ts.snap'
lib/modules/platform/gerrit/index.ts |  47 +++++++++++--
lib/modules/platform/gerrit/scm.ts   | 184 +++++++++---------------------------------------
lib/modules/platform/gerrit/types.ts |   3 +-
lib/modules/platform/gerrit/utils.ts |   3 +-
lib/util/git/index.ts                |  63 ++++++++++++++++-
lib/util/git/types.ts                |  19 +++++
6 files changed, 157 insertions(+), 162 deletions(-)

Changes

This significantly refactors the Gerrit SCM to leverage the Default SCM implementation as much as possible.

On the local git repository initialization, all open changes are now fetched as remote branch references. I call these virtual branches.

The mindset here is to make the local Gerrit clone behave as similarly as possible to a GitHub/GitLab clone, so that we can reuse most of the logic from Default SCM.

The benefits are:

  • Much less code to maintain in the Gerrit SCM implementation
  • Dramatic reduction of the number of HTTP requests to the Gerrit server, which also leads to a dramatic performance improvement

This PR is followed up by the PR below, which completes the optimization cycle for Gerrit:

Here's a comparative benchmark.

Context

Please select one of the below:

  • This closes an existing Issue:
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Claude Opus 4.6 was used to implement tests and help to review the code.

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

The public repository: https://review.gerrithub.io/q/project:felipecrs/renovate-repro-spring-framework

@felipecrs felipecrs marked this pull request as draft October 30, 2025 19:20
@felipecrs felipecrs force-pushed the simplify-gerrit-scm branch from 41d6798 to b5494ef Compare October 30, 2025 19:37
@felipecrs felipecrs force-pushed the simplify-gerrit-scm branch from b5494ef to 75fdfeb Compare October 30, 2025 19:41
@felipecrs felipecrs marked this pull request as ready for review April 1, 2026 19:17
@felipecrs felipecrs marked this pull request as draft April 1, 2026 20:20
@felipecrs
Copy link
Copy Markdown
Contributor Author

felipecrs commented Apr 2, 2026

This PR is in a good, functional state (tested in against a few repositories).

But it shouldn't be reviewed as it currently depends on this other one to be merged first:

@felipecrs
Copy link
Copy Markdown
Contributor Author

felipecrs commented Apr 7, 2026

Old benchmarks from Oct 30, 2025

I ran some tests against a relatively big repository:

And here are some early results:

Test method:

  • All test runs had no prior cache (rm -rf /tmp/renovate) except a Redis instance shared across runs.
    • The Redis database was populated before running the baseline.
  • A report was generated for the baseline run, and to ensure sanity between the runs, this report was compared to each other run's report. They all match 100%.
    • This is very deterministic in full dry-run mode, but I understand it may be vary a bit on real runs.

Here's a newer one.

@felipecrs felipecrs changed the title refactor(gerrit): rework scm implementation feat(gerrit): rework scm implementation Apr 8, 2026
@felipecrs felipecrs marked this pull request as ready for review April 16, 2026 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants