-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[NoQA] Fix the internal QA PR section losing its state #9946
Conversation
// Get the internalQA PR list, preserving the previous state of `isResolved` | ||
const internalQAPRList = _.sortBy( | ||
currentStagingDeployCashData.internalQAPRList, | ||
'number', | ||
); |
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.
We are first getting the list of the InternalQA PRs from the previous issue body.
return GithubUtils.generateStagingDeployCashBody( | ||
newTag, | ||
_.pluck(PRList, 'url'), | ||
_.pluck(_.where(PRList, {isVerified: true}), 'url'), | ||
_.pluck(_.where(PRList, {isAccessible: true}), 'url'), | ||
_.pluck(deployBlockers, 'url'), | ||
_.pluck(_.where(deployBlockers, {isResolved: true}), 'url'), | ||
_.pluck(_.where(internalQAPRList, {isResolved: true}), 'url'), | ||
didVersionChange ? false : currentStagingDeployCashData.isTimingDashboardChecked, | ||
didVersionChange ? false : currentStagingDeployCashData.isFirebaseChecked, |
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.
And then passing as a parameter an array of URLs of only those PRs which are resolved (the checkbox has been ticked)
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `; | ||
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `; |
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.
And finally check if the URL is in the resolvedInternalQAPRs
array as the verifiedOrNoQAPRs
does not include the necessary InternalQA PRs with isResolved
field, hence it was always false and it have reset the checkbox to unchecked state.
@@ -533,7 +534,7 @@ describe('GithubUtils', () => { | |||
)); | |||
|
|||
test('Test some verified internalQA PRs', () => ( | |||
githubUtils.generateStagingDeployCashBody(tag, [...basePRList, ...internalQAPRList], [internalQAPRList[0]]) | |||
githubUtils.generateStagingDeployCashBody(tag, [...basePRList, ...internalQAPRList], [], [], [], [], [internalQAPRList[0]]) |
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.
We need to pass this new argument containing the resolved/verified InternalQA PR to the function in the test to make sure that the checkbox state has been preserved.
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.
The reason this test has been passing before (although this feature clearly does not work) is that we have not been simulating the actual flow as it happens in reality. We have passed in the checked-off internalQA PR as a third argument, which then made it to the verifiedOrNoQAPRs array which then worked, however, normally, the internalQA PR would never make it to the third argument so it always resetted the checkboxes 😢
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.
Okay, makes sense 👍
This should be ready for a review, thank you very much for having a look. I will kindly ask @roryabraham and @yuwenmemon for reviews as you have worked on this before. |
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.
This looks good. Mind if we test on the next checklist? Don't want to introduce potential breaking changes or distractions when we seem close to deploying the current (massive) checklist to production.
@@ -533,7 +534,7 @@ describe('GithubUtils', () => { | |||
)); | |||
|
|||
test('Test some verified internalQA PRs', () => ( | |||
githubUtils.generateStagingDeployCashBody(tag, [...basePRList, ...internalQAPRList], [internalQAPRList[0]]) | |||
githubUtils.generateStagingDeployCashBody(tag, [...basePRList, ...internalQAPRList], [], [], [], [], [internalQAPRList[0]]) |
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.
Okay, makes sense 👍
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.
Due to my current limited knowledge about GH actions, I asked a few questions and I'll leave it to others to approve.
issueBody += '\r\n\r\n\r\n**Internal QA:**'; | ||
_.each(internalQAPRMap, (assignees, URL) => { | ||
const assigneeMentions = _.reduce(assignees, (memo, assignee) => `${memo} @${assignee}`, ''); | ||
issueBody += `\r\n${_.contains(verifiedOrNoQAPRs, URL) ? '- [x]' : '- [ ]'} `; | ||
issueBody += `\r\n${_.contains(resolvedInternalQAPRs, URL) ? '- [x]' : '- [ ]'} `; |
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.
Why is there so much code duplication for creating the internal QA PR list and getStagingDeployCashData
in these Github actions? I'm very new to Github actions.
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.
Check out the documentation here
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
// The format of this map is following: | ||
// { | ||
// 'https://github.com/Expensify/App/pull/9641': [ 'PauloGasparSv', 'kidroca' ], | ||
// 'https://github.com/Expensify/App/pull/9642': [ 'mountiny', 'kidroca' ] | ||
// } |
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.
Added this comment to explain what the format of the map will be as it is not immediately clear imho, which then probably lead to the bug.
@roryabraham @neil-marcellini Updated this PR with a fix to the additional bug, which I thought for some reason was gone haha. Left comments explaining the changes and why it was failing. |
const internalQAPRList = this.getStagingDeployCashInternalQA(issue); | ||
return _.sortBy(_.union(PRList, internalQAPRList), 'number'); | ||
return _.sortBy(PRList, 'number'); |
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.
Actually, this is what was causing the internalQA PRs to be added to the normal PR list as well as the internal QA section. It is not necessary to be added here since the PRs are already fetched and then filtered somewhere else. This should fix that bug.
And yes, we can test it, but it on this checklist! |
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.
This LGTM, but also I feel like maybe this code has hit a critical mass of complexity where we need to do some refactoring. If you want we can do the refactoring separately. I'll leave that up to you.
Going to merge and test this using a Test deploy blocker! 2 bugs to test, they have the same testing steps:
InternalQA is present in the list of other PRs too
Preserving the checked state of the internalQA PR
That is it 🎉 happy testing! |
Given we will QA it now, internalQA is not correct for this PR, removing and will report here how the testing went! |
@mountiny looks like this was merged without passing tests. Please add a note explaining why this was done and remove the |
Not an emergency. Tests were passing. |
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
First part worked: InternalQA is present in the list of other PRs too Second part did not 😡 Preserving the checked state of the internalQA PR Looking into the logs |
Oh, found the problem, from the logs:
You can see the |
The follow up PR fixed it! #10007 🎉 |
🚀 Deployed to production by @yuwenmemon in version: 1.1.86-5 🚀
|
Details
The internal QA section of the Staging deploy issue loses its state when the issue is regenerated when new deploy blocker is found or we CP some PR to Staging.
Not ideal.
This PR aims to fix this situation by passing a list of URLs of the InternalQA PRs which were checked off already to the function which generates the new issue body.
I have left comments in the PR to explain how this is fixing the problem and also why the integration test hasn't caught this issue previously.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/198446
Tests
Automated tests cover this change.
Manual tests:
InternalQA
labelCP Staging
andInternalQA
labels and merge itPR Review Checklist
Contributor (PR Author) Checklist
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
)src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)PR Reviewer Checklist
The Contributor+ will copy/paste it into a new comment and complete it after the author checklist is completed
### Fixed Issues
section aboveTests
sectionQA steps
sectiontoggleReport
and notonIconClick
).src/languages/*
filesSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
have been tested & I retested again)/** comment above it */
displayName
propertythis
properly so there are no scoping issues (i.e. foronClick={this.submit}
the methodthis.submit
should be bound tothis
in the constructor)this
are necessary to be bound (i.e. avoidthis.submit = this.submit.bind(this);
ifthis.submit
is never passed to a component event handler likeonClick
)StyleUtils.getBackgroundAndBorderStyle(themeColors.componentBG
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)QA Steps
Check the Tests section.
Screenshots
N/A