RFR: 2043: Skara mistakenly tagged the wrong commit when processing a /tag command

Erik Joelsson erikj at openjdk.org
Thu Sep 28 18:21:33 UTC 2023


The method `GitLabRepository::recentCommitComments` may sometimes return a comment associated with the wrong commit. We have seen it happen, which caused a tag to be set on the wrong commit. My theory is that this was caused by a race, which was probably made more potent due to GitLab sometimes being slow in returning up to date data. See bug for more details.

The main fix is to always verify that an event note about a recent commit comment actually matches a comment found on the commit in question. The current implementation has a quick return when only one potential commit is found.

In addition to that, I'm also reworking the implementation to be a bit more robust. @zhaosongzs found that there is an alternate API for retrieving commit comments called "discussions" and that gives us more data, notably the same ID field as an event has. This makes it possible to match an event note with a commit comment note by ID instead of by the combination of author and created_at. From this further simplifications naturally fell out.

A CommitComment returned from `GitLabRepository::addCommitComment` no longer contains a value for ID. I think this is more correct than making up a value. I verified that no code seems to be using the returned object currently, so this shouldn't impact anything.

The two new tests were run and inspected manually.

-------------

Commit messages:
 - SKARA-2043

Changes: https://git.openjdk.org/skara/pull/1564/files
 Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1564&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-2043
  Stats: 136 lines in 2 files changed: 76 ins; 20 del; 40 mod
  Patch: https://git.openjdk.org/skara/pull/1564.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1564/head:pull/1564

PR: https://git.openjdk.org/skara/pull/1564


More information about the skara-dev mailing list