Skip to content

Conversation

@JonWBedard
Copy link
Member

@JonWBedard JonWBedard commented Nov 10, 2022

42fd020

[ews] merge-queue fails to find reviewer on GitHub PRs with lots of review activity
https://bugs.webkit.org/show_bug.cgi?id=243548
rdar://98129710

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps.py:
(GitHubMixin):
(GitHubMixin.get_reviewers): Handle pagination when retrieving reviews. Approval
and rejection should override older approval or rejection.
* Tools/CISupport/ews-build/steps_unittest.py:
(TestGitHubMixin):
(TestGitHubMixin.Response): Mock of request's response class.
(TestGitHubMixin.test_no_reviewers):
(TestGitHubMixin.test_single_review):
(TestGitHubMixin.test_multipe_reviews):
(TestGitHubMixin.test_retracted_review):
(TestGitHubMixin.test_pagination):
(TestGitHubMixin.test_reviewers_invalid_response):
(TestGitHubMixin.test_reviewers_error):

Canonical link: https://commits.webkit.org/256752@main

84ed6b2

Misc iOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios 🛠 mac ✅ 🛠 wpe 🛠 🧪 win
✅ 🧪 bindings ✅ 🛠 ios-sim 🛠 mac-debug ✅ 🛠 gtk 🛠 wincairo
✅ 🧪 webkitperl 🧪 ios-wk2 🛠 mac-AS-debug 🧪 gtk-wk2
🧪 api-ios 🧪 api-mac 🧪 api-gtk
✅ 🛠 tv 🧪 mac-wk1
✅ 🧪 services ✅ 🛠 tv-sim 🧪 mac-wk2
✅ 🛠 watch 🧪 mac-AS-debug-wk2
✅ 🛠 🧪 unsafe-merge 🛠 watch-sim 🧪 mac-wk2-stress

@JonWBedard JonWBedard self-assigned this Nov 10, 2022
@JonWBedard JonWBedard added Safari 13 Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases labels Nov 10, 2022
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's make this 10 as a parameter as well, so that it's explicit and easy to modify later on if we need to change it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can change it to something like: for page in range(1, LIMIT_NUM_PAGES + 1)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: can rename to something like: LIMIT_REVIEWS_PER_PAGE

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need this check?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're asking for 100 on the page. If the page has less than 100, we can safely assume this is the last page. Most of the time, we won't even make a second request.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like the comparison need to be inverted than. Should be if len(response_content) < self.LIMIT:

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to add self._addToLog here to help in debugging such failures.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what are we doing here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the logic being implemented here? what's id_val? maybe rename id_val to something more readable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're trying to make sure that someone can override an r+ with an r- in the future. id_val comes from GitHub, it's the review "id" (according to GitHub's API). Larger numbers are newer. We could use timestamp, expect I didn't really want to decode the GitHub timestamp.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok.
Also, id_val is a local variable in this line, maybe we can call it _id.
Also, since this is important logic, probably having a explicit for loop with a comment explaining what we are doing is better (instead of using list comprehension).

@JonWBedard JonWBedard force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from ee5993a to 2107c05 Compare November 10, 2022 22:26
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still seems inverse. Maybe I am missing something.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, my brain just wasn't working...updating

@JonWBedard JonWBedard force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from 2107c05 to 6d27bff Compare November 10, 2022 23:15
@JonWBedard JonWBedard requested a review from aj062 November 10, 2022 23:26
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 11, 2022
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should it be continue or break. Seems like continue will result in an infinite loop.

Copy link
Member

@aj062 aj062 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would be good to add some unit-tests.
Can override/mock GitHubMixin.fetch_data_from_url_with_authentication_github() in unit-tests to avoid network request.

@JonWBedard JonWBedard removed the merging-blocked Applied to prevent a change from being merged label Nov 15, 2022
@JonWBedard JonWBedard force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from 6d27bff to ff5809f Compare November 15, 2022 16:57
@JonWBedard JonWBedard force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from ff5809f to 8b9cc8b Compare November 16, 2022 19:42
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: this range would be one less than self.NUM_PAGE_LIMIT

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to construct this variable here, it's used only to construct the url variable. We can directly construct url in one go inside the for loop.

e.g.: url = f'{api_url}/pulls/{pr_number}/reviews?per_page={self.PER_PAGE_LIMIT}&page={page}

@JonWBedard JonWBedard force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from 8b9cc8b to 84ed6b2 Compare November 16, 2022 22:34
@JonWBedard JonWBedard added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 16, 2022
…eview activity

https://bugs.webkit.org/show_bug.cgi?id=243548
rdar://98129710

Reviewed by Aakash Jain.

* Tools/CISupport/ews-build/steps.py:
(GitHubMixin):
(GitHubMixin.get_reviewers): Handle pagination when retrieving reviews. Approval
and rejection should override older approval or rejection.
* Tools/CISupport/ews-build/steps_unittest.py:
(TestGitHubMixin):
(TestGitHubMixin.Response): Mock of request's response class.
(TestGitHubMixin.test_no_reviewers):
(TestGitHubMixin.test_single_review):
(TestGitHubMixin.test_multipe_reviews):
(TestGitHubMixin.test_retracted_review):
(TestGitHubMixin.test_pagination):
(TestGitHubMixin.test_reviewers_invalid_response):
(TestGitHubMixin.test_reviewers_error):

Canonical link: https://commits.webkit.org/256752@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch from 84ed6b2 to 42fd020 Compare November 16, 2022 22:42
@webkit-commit-queue
Copy link
Collaborator

Committed 256752@main (42fd020): https://commits.webkit.org/256752@main

Reviewed commits have been landed. Closing PR #6355 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 42fd020 into WebKit:main Nov 16, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 16, 2022
@JonWBedard JonWBedard deleted the eng/ews-merge-queue-fails-to-find-reviewer-on-GitHub-PRs-with-lots-of-review-activity branch November 17, 2022 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants