-
Notifications
You must be signed in to change notification settings - Fork 4
(Re-)infer candidate from state #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(Re-)infer candidate from state #141
Conversation
6d97c67 to
a21b16e
Compare
|
@alex-mckenna Since I am sort of restoring my previous changes now, I took the |
... in order to prepare for a future change.
66bf88c to
023df3b
Compare
This eliminates the need for the getIntegrationCandidate function and simplifies test fixtures.
from the 'Project' module in favour of just using 'integratedPullRequests'. The getIntegrationCandidates function was added to tests/Spec as it has nice uses there.
... in order to detect that PRs are merged in the order of merge comments and not by PR id.
|
@fatho You have previously reviewed #131, which was the PR that had the bug and was reverted. This PR re-adds the same functionality, so part of the code is the same as in the previous PR. I think it makes sense for you to review again in this case. The end result is quite different in some parts, and the code of this new version is IMHO more elegant than the one of #131. |
fatho
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for adding the tests!
src/Logic.hs
Outdated
| BuildPending _ -> pure state | ||
| BuildSucceeded -> pushCandidate (pullRequestId, pullRequest) sha state | ||
| -- If the build failed, give feedback on the PR | ||
| BuildFailed _ -> pure $ Pr.setNeedsFeedback pullRequestId True state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, so instead of always setting this to true when there's activity on a failed PR, we now only do this when the state initially changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Before, for a BuildFailed candidate:
- set PR build to failed when event is received
- go through the event loop
- in
proceedCandidate, "discover" and set that the PR needs feedback - go through the event loop again
- post comment (for the PR that needs feedback)
Now:
- set PR build to failed and that it needs feedback
- go through the event loop
- post comment (for the PR that needs feedback)
| pr { Pr.integrationStatus = Integrated buildSha newStatus | ||
| , Pr.needsFeedback = case newStatus of | ||
| BuildPending (Just _) -> True | ||
| BuildFailed _ -> True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... (cont'd from previous comment), which would be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, exactly. And we only need to post comments when we get the BuildPending status with a URL and when the build fails.
|
@fatho Thanks for the review. I will merge this into master now and tag it so that I can have this ready for deploy at an appropriate time this week. @OpsBotPrime merge |
|
Pull request approved for merge by @rudymatela, rebasing now. |
Approved-by: rudymatela Auto-deploy: false
|
Rebased as 1bd9c99, waiting for CI … |
Fixes: #131
This reapplies the changes of #131 starting from a version where tests assure that Hoff is not stuck in an infinite comment loop. The summary of #131 still holds:
TODO
BuildFailedare not candidatesneedsFeedbackonhandleBuildStatusChanged