Skip to content
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

[git-webkit] Add screen-reader friendly review wizard (Part 2) #28389

Conversation

JonWBedard
Copy link
Member

@JonWBedard JonWBedard commented May 10, 2024

74313d0

[git-webkit] Add screen-reader friendly review wizard (Part 2)
https://bugs.webkit.org/show_bug.cgi?id=261242
rdar://115083100

Reviewed by Andres Gonzalez and Elliott Williams.

Allow user to review and comment on a pull request by editing a local file.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/review.py:
(Review.truncate_strs): Turn a nested dictionary of strings into a nested dictionary
of lists of string based on where newline are in strings.
(Review.user_delta): Detect which users have been added or removed from a list of users.
(Review.invoke_wizard): Diff the original file with a user's local edits and return those
local edits to be converted into actions on a pull request.
(Review.main): Given the difference returned by invoke_wizard, programatically add comments,
change pull request metadata and approve (or reject) the pull request.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/review_unittest.py:
(TestReview.editor_callback):
(TestReview.editor_callback.callback):
(TestReview.test_truncate_strs):
(TestReview.test_user_delta_github):
(TestReview.test_user_delta_bitbucket):
(TestReview.test_edit_metadata):
(TestReview.test_comment_commit_message):
(TestReview.test_comment):
(TestReview.test_comment_reply):
(TestReview.test_comment_reply_only_one):
(TestReview.test_comment_reply_both):
(TestReview.test_diff_file_comment):
(TestReview.test_diff_inline_comment):
(TestReview.test_github_read_comments):
(TestReview.test_bitbucket_no_edit):
(TestReview.test_github_no_edit):
(TestReview.test_bitbucket_approve):
(TestReview.test_github_deny):
(TestReview.test_bitbucket_edit_deny):
(TestReview.test_github_edit_approve):
(TestReview.test_bitbucket_edit_refresh):
(TestReview.test_github_edit_refresh):
(TestReview.test_bitbucket_edit_comment):
(TestReview.test_github_edit_comment):
(TestReview.test_bitbucket_edit_comment_commit_message):
(TestReview.test_github_edit_comment_commit_message):
(TestReview.test_bitbucket_edit_comment_inline_diff):
(TestReview.test_github_edit_comment_inline_diff):
(TestReview.test_bitbucket_edit_title):
(TestReview.test_github_edit_title):
(TestReview.test_bitbucket_edit_open):
(TestReview.test_github_edit_close):
(TestReview.test_bitbucket_edit_merged_close):
(TestReview.test_github_edit_merged_open):
(TestReview.test_bitbucket_add_labels):
(TestReview.test_github_edit_labels):
(TestReview.test_github_edit_invalid_labels):

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

2d8839c

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug   πŸ§ͺ wpe-wk2   πŸ§ͺ wincairo-tests
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ webkitpy   πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  wpe-cairo
  πŸ§ͺ api-ios βœ… πŸ§ͺ mac-wk2 βœ… πŸ›  gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2   πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ services   πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress   πŸ§ͺ api-gtk
  πŸ›  watch
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim

@JonWBedard JonWBedard self-assigned this May 10, 2024
@JonWBedard JonWBedard added the Tools / Tests Tools in the Tools directory, build issues, test infrastructure, and bugs in test cases label May 10, 2024
@JonWBedard
Copy link
Member Author

This is stacked on #27628, because the reading and writing are pretty distinct operations and should be evaluated separately.

@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard [git-webkit] Add screen-reader friendly review wizard (Part 2) May 10, 2024
@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard (Part 2) [git-webkit] Add screen-reader friendly review wizard (Part 1) May 13, 2024
@JonWBedard JonWBedard requested a review from emw-apple May 13, 2024 22:28
@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard (Part 1) [git-webkit] Add screen-reader friendly review wizard (Part 2) May 13, 2024
@AndresGonzalezApple
Copy link
Contributor

This is stacked on #27628, because the reading and writing are pretty distinct operations and should be evaluated separately.
Looks good!

@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard (Part 2) [git-webkit] Add screen-reader friendly review wizard May 15, 2024
@JonWBedard JonWBedard force-pushed the eng/add-screen-reader-friendly-review-wizard-part-2 branch from 1ed0d3f to 98f4331 Compare May 15, 2024 18:28
@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard [git-webkit] Add screen-reader friendly review wizard (Part 2) May 15, 2024
Copy link
Contributor

@emw-apple emw-apple left a comment

Choose a reason for hiding this comment

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

Nothing too surprising in the code. I did notice that we're inconsistent about whether PRs are called "pull requests" or "pull-requests". GitHub uses the former, and I think that's the generally accepted spelling. Would be nice to clean that up before landing.


if pull_request.opened and did_approve is None and user and pull_request.author != user:
did_approve = dict(Yes=True, Block=False).get(Terminal.choose(
'Would you like approve this change?',
Copy link
Contributor

Choose a reason for hiding this comment

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

grammar: "Would you like to approve this change?"

if pull_request.opened and did_approve is None and user and pull_request.author != user:
did_approve = dict(Yes=True, Block=False).get(Terminal.choose(
'Would you like approve this change?',
default='No', options=('Yes', 'No', 'Block'),
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes / No / Block does not feel very intuitive to me. In response to the question "Would you like to approve this change?", "No" sounds like r-, but it's actually what GitHub calls "Comment".

Could we use the same idioms as GitHub? Like: "How would you like to review this change?" with choices "Comment only", "Approve", "Request changes"

@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard (Part 2) [git-webkit] Add screen-reader friendly review wizard (Part 1) May 23, 2024
@JonWBedard JonWBedard force-pushed the eng/add-screen-reader-friendly-review-wizard-part-2 branch from 98f4331 to 2d8839c Compare May 24, 2024 00:03
@JonWBedard JonWBedard changed the title [git-webkit] Add screen-reader friendly review wizard (Part 1) [git-webkit] Add screen-reader friendly review wizard (Part 2) May 24, 2024
@JonWBedard JonWBedard added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label May 24, 2024
https://bugs.webkit.org/show_bug.cgi?id=261242
rdar://115083100

Reviewed by Andres Gonzalez and Elliott Williams.

Allow user to review and comment on a pull request by editing a local file.

* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/program/review.py:
(Review.truncate_strs): Turn a nested dictionary of strings into a nested dictionary
of lists of string based on where newline are in strings.
(Review.user_delta): Detect which users have been added or removed from a list of users.
(Review.invoke_wizard): Diff the original file with a user's local edits and return those
local edits to be converted into actions on a pull request.
(Review.main): Given the difference returned by invoke_wizard, programatically add comments,
change pull request metadata and approve (or reject) the pull request.
* Tools/Scripts/libraries/webkitscmpy/webkitscmpy/test/review_unittest.py:
(TestReview.editor_callback):
(TestReview.editor_callback.callback):
(TestReview.test_truncate_strs):
(TestReview.test_user_delta_github):
(TestReview.test_user_delta_bitbucket):
(TestReview.test_edit_metadata):
(TestReview.test_comment_commit_message):
(TestReview.test_comment):
(TestReview.test_comment_reply):
(TestReview.test_comment_reply_only_one):
(TestReview.test_comment_reply_both):
(TestReview.test_diff_file_comment):
(TestReview.test_diff_inline_comment):
(TestReview.test_github_read_comments):
(TestReview.test_bitbucket_no_edit):
(TestReview.test_github_no_edit):
(TestReview.test_bitbucket_approve):
(TestReview.test_github_deny):
(TestReview.test_bitbucket_edit_deny):
(TestReview.test_github_edit_approve):
(TestReview.test_bitbucket_edit_refresh):
(TestReview.test_github_edit_refresh):
(TestReview.test_bitbucket_edit_comment):
(TestReview.test_github_edit_comment):
(TestReview.test_bitbucket_edit_comment_commit_message):
(TestReview.test_github_edit_comment_commit_message):
(TestReview.test_bitbucket_edit_comment_inline_diff):
(TestReview.test_github_edit_comment_inline_diff):
(TestReview.test_bitbucket_edit_title):
(TestReview.test_github_edit_title):
(TestReview.test_bitbucket_edit_open):
(TestReview.test_github_edit_close):
(TestReview.test_bitbucket_edit_merged_close):
(TestReview.test_github_edit_merged_open):
(TestReview.test_bitbucket_add_labels):
(TestReview.test_github_edit_labels):
(TestReview.test_github_edit_invalid_labels):

Canonical link: https://commits.webkit.org/279255@main
@webkit-commit-queue webkit-commit-queue force-pushed the eng/add-screen-reader-friendly-review-wizard-part-2 branch from 2d8839c to 74313d0 Compare May 24, 2024 04:05
@webkit-commit-queue
Copy link
Collaborator

Committed 279255@main (74313d0): https://commits.webkit.org/279255@main

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

@webkit-commit-queue webkit-commit-queue merged commit 74313d0 into WebKit:main May 24, 2024
@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 May 24, 2024
@JonWBedard JonWBedard deleted the eng/add-screen-reader-friendly-review-wizard-part-2 branch May 24, 2024 17:33
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
5 participants