RFR: 2231: JCheck ran twice unnecessarily

Zhao Song zsong at openjdk.org
Thu Apr 11 20:36:13 UTC 2024


Recently, I found sometimes JCheck ran twice unnecessarily in some prs.
For example:
https://github.com/openjdk/jdk/pull/16005
https://github.com/openjdk/jdk/pull/14586

In the above prs, the authors didn't update .jcheck/conf in the source branch, but skara executed jcheck twice with the jcheck config in the merged commit(merged target branch and source branch).

After investigation,l  found that in this case, skara bot will make a mistake.
Let's say we have two branches:
Target branch: initialCommit <-- updateJCheckCommit <-- latestCommit
Source Branch: initialCommit <-- editCommit
In CheckRun, Skara bot would create a squashed commit(final head is editCommit and parent is latestCommit), and the squashed commit would include diffs in updateJCheckCommit, latestCommit, editCommit. Later, Skara bot would use CheckRun#isFileUpdated to check if .jcheck/conf is updated in the squashed commit and it will return true, therefore  run jcheck twice.

To resolve this problem, I think we should rewrite isFileUpdated, skara bot should find the common ancestor of target branch and source branch first, then check if the file is updated between mergeBase and the head of source branch.

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

Commit messages:
 - update
 - SKARA-2231

Changes: https://git.openjdk.org/skara/pull/1635/files
  Webrev: https://webrevs.openjdk.org/?repo=skara&pr=1635&range=00
  Issue: https://bugs.openjdk.org/browse/SKARA-2231
  Stats: 78 lines in 2 files changed: 61 ins; 10 del; 7 mod
  Patch: https://git.openjdk.org/skara/pull/1635.diff
  Fetch: git fetch https://git.openjdk.org/skara.git pull/1635/head:pull/1635

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


More information about the skara-dev mailing list