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(structured-logging): fix wrongly reporting status as success when we should still be in pending state #26380

Merged

Conversation

pieh
Copy link
Contributor

@pieh pieh commented Aug 11, 2020

Description

The setStatus action creator calls are not working correctly right now. This PR aims to add bunch of tests first (some of which will fail), and add code changes showing that hose fixes some problems later.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Aug 11, 2020
@pieh pieh added topic: reporter and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Aug 11, 2020
@gatsby-cloud
Copy link

gatsby-cloud bot commented Aug 11, 2020

Gatsby Cloud Build Report

client-only-paths

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 18s

Performance

Lighthouse report

Metric Score
Performance 💚 100
Accessibility 🔶 85
Best Practices 💚 100
SEO 🔶 70

🔗 View full report

@gatsby-cloud
Copy link

gatsby-cloud bot commented Aug 11, 2020

Gatsby Cloud Build Report

using-styled-components

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 18s

Performance

Lighthouse report

Metric Score
Performance 💚 100
Accessibility 💚 90
Best Practices 💚 100
SEO 💚 90

🔗 View full report

@gatsby-cloud-staging
Copy link

gatsby-cloud-staging bot commented Aug 11, 2020

Gatsby Cloud Build Report

gatsby-master

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 1m

Performance

Lighthouse report

Metric Score
Performance 💚 97
Accessibility 🔶 87
Best Practices 💚 93
SEO 🔶 73

🔗 View full report

@pieh pieh force-pushed the fix/structured-logging/fix-delayed-set-status branch from c0e53d2 to 0a6c431 Compare August 11, 2020 20:45
@gatsby-cloud
Copy link

gatsby-cloud bot commented Aug 11, 2020

Gatsby Cloud Build Report

using-reach-skip-nav

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 22s

Performance

Lighthouse report

Metric Score
Performance 💚 100
Accessibility 💚 100
Best Practices 💚 100
SEO 🔶 82

🔗 View full report

@gatsby-cloud-staging
Copy link

gatsby-cloud-staging bot commented Aug 11, 2020

Gatsby Cloud Build Report

gatsby

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 22m

Performance

Lighthouse report

Metric Score
Performance 💚 92
Accessibility 💚 100
Best Practices 💚 100
SEO 🔶 76

🔗 View full report

@pieh pieh force-pushed the fix/structured-logging/fix-delayed-set-status branch from 0a6c431 to ecedcb6 Compare August 11, 2020 21:03
@gatsby-cloud
Copy link

gatsby-cloud bot commented Aug 11, 2020

Gatsby Cloud Build Report

gatsby

🎉 Your build was successful! See the Deploy preview here.

Build Details

View the build logs here.

🕐 Build time: 23m

@pieh pieh changed the title fix(structured-logging): fix wrongly reporting status as success when we should still be in pending state [wip] fix(structured-logging): fix wrongly reporting status as success when we should still be in pending state Aug 12, 2020
@pieh pieh marked this pull request as ready for review August 12, 2020 07:18
@pieh pieh requested a review from a team as a code owner August 12, 2020 07:18
Comment on lines -138 to +166
const actionsToEmit: ActionsToEmit = []

const logsState = getStore().getState().logs

const globalStatus = getGlobalStatus(id, status)

if (globalStatus !== logsState.status) {
actionsToEmit.push(setStatus(globalStatus))
}

actionsToEmit.push({
type: Actions.PendingActivity,
payload: {
id,
type: ActivityTypes.Pending,
status,
return [
setStatus(globalStatus),
{
type: Actions.PendingActivity,
payload: {
id,
type: ActivityTypes.Pending,
status,
},
},
})

return actionsToEmit
]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

gist of this and other activity related code changes is that we always would use setStatus action creator as it internally already checks for global status (or pending global status for delayed dispatchs)

Copy link
Contributor

@pvdz pvdz left a comment

Choose a reason for hiding this comment

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

I hope I won't have to debug these test cases failing at some point. I love that you wrote them but predict they will be hard to figure out how to fix if they fail.
Anyways, lgtm :)

Copy link
Contributor

@wardpeet wardpeet left a comment

Choose a reason for hiding this comment

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

I like tests! 🙏

Copy link
Contributor

@sidharthachatterjee sidharthachatterjee left a comment

Choose a reason for hiding this comment

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

This is good. Definitely an improvement (other than the fix)

@sidharthachatterjee sidharthachatterjee merged commit d74ea66 into master Aug 12, 2020
@sidharthachatterjee sidharthachatterjee deleted the fix/structured-logging/fix-delayed-set-status branch August 12, 2020 08:00
@sidharthachatterjee
Copy link
Contributor

Successfully published:

  • gatsby-admin@0.1.133
  • gatsby-cli@2.12.84
  • gatsby@2.24.44

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.

None yet

4 participants