-
Notifications
You must be signed in to change notification settings - Fork 47.5k
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 error codes #7999
Fix error codes #7999
Conversation
gulp.src(paths.reactDOM.src), | ||
gulp.src(paths.reactNative.src), | ||
gulp.src(paths.reactTestRenderer.src) | ||
).pipe(extractErrors(errorCodeOpts)); |
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.
Could you explain what's going on here? Why does this matter?
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 error code generator was written in a way that it reads the file first, traverses the AST, and appends to the target file. I guess when we invoke it multiple times it causes a race condition and overwrites the same file.
To be honest there should a better way if I'm more knowledgeable in Gulp :). This PR simply changes it back to the way that the generator was used.
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.
Yea, pretty sure that's racing. FWIW, you can probably just gulp.src([array of paths]).pipe(...)
(can't test though right now so could be wrong).
@zpao thanks, I changed it to use |
Friendly ping: this needs to be fixed for the 15.4.0 release. |
Which branches does this need to be merged into? |
Other than the script update, I recommend merging the codes into master to unblock things like #7963. Specifically #7963 modifies an existing invariant message, and there's a test for the behavior in production so the PR author needs to regenerate the error codes. @zpao updates the error codes when he cuts a release so only the codes in |
I didn’t know this, and didn’t update them when cutting RCs. Do I need to? Since @zpao is transitioning out of the team it would be great if you could provide instructions for what to do before the release, and what should not be done. Apologies if you provided them before. |
I also noticed that the error transform spews warnings every time I run |
6237ec2
to
d7347d2
Compare
@gaearon Sorry about the delay. We've only talked about this in chats and I don't think I've formally documented it down. I just added a README for the error code system. I also added a note for cutting a new release as follows (copied from the new README):
I thought about this again and I think this is a better process for keeping everything in sync. Therefore I reverted the commit for updating |
I think running in master and cherrypicking back might not be safe unless On Friday, October 21, 2016, Dustan Kasten [email protected] wrote:
|
@zpao Thanks! Yeah I thought about it again and I agree with you (there's an updated workflow at #7999 (comment)). |
@gaearon Just saw your updates in #8033. Just making sure, did you intend to let the script collect error messages in |
This reverts commit b8f3aee.
gulp.src(paths.reactDOM.src).pipe(extractErrors(errorCodeOpts)), | ||
gulp.src(paths.reactNative.src).pipe(extractErrors(errorCodeOpts)), | ||
gulp.src(paths.reactTestRenderer.src).pipe(extractErrors(errorCodeOpts)), | ||
gulp.src(paths.reactNoopRenderer.src).pipe(extractErrors(errorCodeOpts)) |
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.
@gaearon I rebased and removed reactNoopRenderer
from the list of extract-errors
targets. Please let me know if it 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.
Yea, totally. I was just copy pasting.
Keyan, what is my next step? Merge this in master and cherry pick to 15-stable and 15-dev? |
@gaearon Yeah, for this PR, let's:
When you cut a release, let's do:
|
* took codes.json from the 15-dev branch * fixed react:extract-errors task in gulpfile * generated error codes * Revert "generated error codes" This reverts commit b8f3aee. * Added a README for the error code system
* took codes.json from the 15-dev branch * fixed react:extract-errors task in gulpfile * generated error codes * Revert "generated error codes" This reverts commit b8f3aee. * Added a README for the error code system
* took codes.json from the 15-dev branch * fixed react:extract-errors task in gulpfile * generated error codes * Revert "generated error codes" This reverts commit b8f3aee. * Added a README for the error code system
I noticed that the error code in the
15-dev
branch is not in sync with a freshly generated one (#7963) or in master. Specifically some invariants insrc/isomorphic/hooks
are missing. This is probably caused by this change while we were splitting the packages.In this PR I copied the
codes.json
file from the15-dev
branch and fixed the gulp script.and regenerated error codes. For now, we only regenerate error codes when we cut a release and the master one doesn't get updated; It might be better if we sync thecodes.json
file back to master after each release, otherwise it'd be hard to modify an existing error message (like #7963).Edited: please see a better process at #7999 (comment).
Reviewers:
@sebmarkbage @gaearon and cc @zpao
Test Plan:
npm run build
with the latestcodes.json
and there should be no warnings