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

Can't reject patch with broken logic #267

Open
atomrab opened this issue Jun 10, 2020 · 3 comments
Open

Can't reject patch with broken logic #267

atomrab opened this issue Jun 10, 2020 · 3 comments
Labels

Comments

@atomrab
Copy link

atomrab commented Jun 10, 2020

David Novak submitted a patch that then broke because he had removed a parent period but not the child periods (currently patch #4). He successfully resubmitted after fixing the problem, and I successfully merged that patch -- but I can't merge the bad patch, because every time I try to open it, it generates the following error:

Error stack
TypeError: Cannot read property 'Symbol(RelatedPeriods)' of undefined
at https://client.perio.do/periodo-client-4.4.3.min.js:18:17964
at Array.forEach ()
at https://client.perio.do/periodo-client-4.4.3.min.js:18:17792
at Array.forEach ()
at https://client.perio.do/periodo-client-4.4.3.min.js:18:17700
at Array.forEach ()
at module.exports (https://client.perio.do/periodo-client-4.4.3.min.js:18:17673)
at new module.exports (https://client.perio.do/periodo-client-4.4.3.min.js:18:16077)
at https://client.perio.do/periodo-client-4.4.3.min.js:120:19497
at async throwIfUnsuccessful (https://client.perio.do/periodo-client-4.4.3.min.js:120:36776)
Component stack
in F
in Unknown
in Unknown
in ConnectFunction
in div
in Clean.div
in UI:Box
in Resource:review-patch
in div
in Clean.div
in UI:Box
in div
in Clean.div
in UI:Box
in MenuedResource
in div
in Clean.div
in UI:Box
in div
in Clean.div
in UI:Grid
in ThemeProvider
in PeriodoApplication
in F
in ThemeProvider
in Provider
in Unknown

@rybesh, can you reject from the server side?

@rybesh
Copy link
Member

rybesh commented Jun 10, 2020

OK, I rejected the broken patch. We still need to figure out what to do about invalid patches like this.

@ptgolden ptgolden added the bug label Jun 30, 2020
@ptgolden
Copy link
Member

I'm going to:

  1. Add componentDidCatch to the patch visualization that has an error message if something like this pops up in the future. That way, even if there's something wonky going on, the patch can still be rejected.

  2. When generating a patch, go over every period's related periods to make sure there aren't any periods that won't be present when applying the patch

@ptgolden
Copy link
Member

The problem Adam ran into was fixed by the above PR, specifically this addition:

// It's possible that this related period might not exist, if this is
// a strangely formed dataset.
if (!relatedPeriod) return

...but I'll still add a componentDidCatch in case there's something weird in the future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants