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

Fix status checks rendering #4542

Merged
merged 4 commits into from
Apr 11, 2023
Merged

Fix status checks rendering #4542

merged 4 commits into from
Apr 11, 2023

Conversation

kabel
Copy link
Contributor

@kabel kabel commented Feb 19, 2023

  • Properly converts GraphQL StatusContext and CheckRun types to PullRequestCheckStatus model
    • State is mapped from schema defined values to model values
    • Avatar URL is converted to enterprise-safe URL (was causing 404s)
  • Await the mergable status from GraphQL is it was undefined in the REST list response
  • Only set a required review as a failure when there are no other checks or there is review with requested changes

@kabel
Copy link
Contributor Author

kabel commented Feb 19, 2023

Given

  • An enterprise instance
  • A repository clone with two open pull requests that are able to be merged

Treeview render

Before:
image

After:
image

Overview webview with the checks box expanded:

Before:
image

and after clicking the description treeview node to "refresh" the model/page:
image

After:
image

@alexr00 alexr00 added this to the March 2023 milestone Feb 20, 2023
@kabel
Copy link
Contributor Author

kabel commented Feb 24, 2023

In f394a8c753909849b766ecf3b7c9f46c5881453a, I included more fixes to better match the web version of the merge message container and tree view.

Before
image

After
image

The required reviews message is now pulled out of the checks list and is more accurately shown the right state:

image
image
image

kabel added 2 commits March 22, 2023 11:47
* Properly converts GraphQL StatusContext and CheckRun types to PullRequestCheckStatus model
  * State is mapped from schema defined values to model values
  * Avatar URL is converted to enterprise-safe URL (was causing 404s)
* Await the mergable status from GraphQL is it was undefined in the REST list response
* Only set a required review as a failure when there are no other checks or there is review with requested changes
* Uses the GraphQL `refUpdateRule` field to expose branch protection rules
* Model `PullRequestReviewRequirement` contains the renderable information

Also fixes additional status checks issues
* Branch protection expected PR checks are included
* Checks include if they are required by branch protection
* If the branch is BEHIND, a different merge status is shown
* The tree can accurately decorate a PR with review statuses
@kabel kabel force-pushed the pr-checks-types branch from f394a8c to 12334c6 Compare March 22, 2023 16:51
@alexr00 alexr00 modified the milestones: March 2023, April 2023 Mar 23, 2023
@alexr00
Copy link
Member

alexr00 commented Mar 23, 2023

@kabel thank you for all the PRs. I've had a busy March so I haven't had a chance to give them a review yet. We're finishing up our endgame release process now through Monday, and I'm planning to catch up on all the PRs that need my attention starting tomorrow.

Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

👏 nice change, thank you! I've made a couple comments, which you can address in the next day or two if you want. Otherwise I plan to approve and merge after I release tomorrow.


return [checks, reviewRequirement];
Copy link
Member

Choose a reason for hiding this comment

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

If there are no checks and no rule about requiring reviews we should still return null or undefined. It just going to be noisy for users who don't have rules set up to to see a bunch of green checks so we should just show nothing.

Copy link
Contributor Author

@kabel kabel Apr 1, 2023

Choose a reason for hiding this comment

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

Sure, I can widen the type of the returned tuple to include null in the first element's type. However, I don't think that will have a martial change on the UI, as the merge component already took into account the lack of (empty array) any status checks.

Edit:
If you meant instead to return null instead of the tuple, that just overly complicates the return handling for the modules that consume this function. As it is now, it will return [null, null] which is a fairly straightforward tuple of two nullable types.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Example on PR of repo without status checks:

Before
image

After
image

src/github/githubRepository.ts Outdated Show resolved Hide resolved
Copy link
Member

@alexr00 alexr00 left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!

@alexr00 alexr00 enabled auto-merge (squash) April 11, 2023 10:45
@alexr00 alexr00 merged commit 68260df into microsoft:main Apr 11, 2023
@kabel kabel deleted the pr-checks-types branch April 23, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants