RFR: 1069: PR ends up in bad state if interrupted just after push

Erik Joelsson erikj at openjdk.java.net
Wed Jun 9 18:49:25 UTC 2021

On Mon, 7 Jun 2021 21:44:02 GMT, Erik Joelsson <erikj at openjdk.org> wrote:

> This change adds a new transaction step when integrating a PR, to better handle if the bot gets interrupted mid integration. Currently, if the change is pushed and the bot is interrupted before closing, changing labels or adding the final "commit pushed" comment, the PR can end up in a limbo state.
> The new step is another comment "Going to push commit as ..." which gets added right before the git push command is run. Using this comment, it's now possible to automatically recover if the bot gets interrupted. The integration command checks for any such comments and if found, checks if the commit hash is present in the target. If it is, the PR was already pushed, and the command will just close it out as normal.
> I also decided to move the output of any rebase command to this prepush comment, so we don't risk losing it.

Adding new patch addressing review comments. Reverted the allComments change. Added testing of interruption between posting the prepush comment and doing the push.

The big change here is I discovered the SponsorCommand had a lot of duplicate code that needed to be updated in the same way. The Skara codebase seem to shun inheritance to share logic, so I tried to just move some things to static methods on IntegrateCommand and have SponsorCommand call them when suitable. There are more duplicates that could be given the same treatment, but I tried to limit the changes here to what was relevant for this fix. I'm thinking a super class could help a lot here in a future change.

I also duplicated the main test I wrote from IntegrateTests to SponsorTests to verify the same behaviors since we have two almost identical code paths for the same thing.


PR: https://git.openjdk.java.net/skara/pull/1183

More information about the skara-dev mailing list