-
Notifications
You must be signed in to change notification settings - Fork 49.6k
[compiler] clean up retry pipeline: fireRetry
flag -> compileMode
#32511
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
Conversation
if (env.config.validateNoCapitalizedCalls) { | ||
validateNoCapitalizedCalls(hir); | ||
} |
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.
Reordering validateNoCapitalizedCalls
and transformFire
should be safe
): { | ||
fnEffectErrors: Array<CompilerErrorDetailOptions>; | ||
} { |
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.
nit: just return the Array?
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.
or maybe Result<void, Array<CompilerErrorDetailOptions>>
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 makes sense. I do wonder about having just a separate pipeline for fire that has the minimal set of passes applied, vs the complexity of if/else checks to merge the pipelines. But this is fine for now.
|
||
if (compileResult.kind === 'error') { | ||
/** | ||
* If an opt out directive is present, log only instead of throwing and don't mark as | ||
* containing a critical error. | ||
*/ | ||
if (optOutDirectives.length > 0) { | ||
logError(compileResult.error, pass, fn.node.loc ?? null); | ||
} else { | ||
handleError(compileResult.error, pass, fn.node.loc ?? null); | ||
} |
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.
Moved this up as we want to report / log errors before retrying for (1) panicThreshold: 'all' | 'critical_error'
modes and (2) to avoid overwriting bailout logging for non-Fire functions.
Removes `EnvironmentConfig.enableMinimalTransformsForRetry` in favor of `run` parameters. This is a minimal difference but lets us explicitly opt out certain compiler passes based on mode parameters, instead of environment configurations Retry flags don't really make sense to have in `EnvironmentConfig` anyways as the config is user-facing API, while retrying is a compiler implementation detail. (per @josephsavona's feedback #32164 (comment)) > Re the "hacky" framing of this in the PR title: I think this is fine. I can see having something like a compilation or output mode that we use when running the pipeline. Rather than changing environment settings when we re-run, various passes could take effect based on the combination of the mode + env flags. The modes might be: > > * Full: transform, validate, memoize. This is the default today. > * Transform: Along the lines of the backup mode in this PR. Only applies transforms that do not require following the rules of React, like `fire()`. > * Validate: This could be used for ESLint.
…32511) Removes `EnvironmentConfig.enableMinimalTransformsForRetry` in favor of `run` parameters. This is a minimal difference but lets us explicitly opt out certain compiler passes based on mode parameters, instead of environment configurations Retry flags don't really make sense to have in `EnvironmentConfig` anyways as the config is user-facing API, while retrying is a compiler implementation detail. (per @josephsavona's feedback #32164 (comment)) > Re the "hacky" framing of this in the PR title: I think this is fine. I can see having something like a compilation or output mode that we use when running the pipeline. Rather than changing environment settings when we re-run, various passes could take effect based on the combination of the mode + env flags. The modes might be: > > * Full: transform, validate, memoize. This is the default today. > * Transform: Along the lines of the backup mode in this PR. Only applies transforms that do not require following the rules of React, like `fire()`. > * Validate: This could be used for ESLint. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/facebook/react/pull/32511). * #32512 * __->__ #32511 DiffTrain build for [7939d92](7939d92)
Removes
EnvironmentConfig.enableMinimalTransformsForRetry
in favor ofrun
parameters. This is a minimal difference but lets us explicitly opt out certain compiler passes based on mode parameters, instead of environment configurationsRetry flags don't really make sense to have in
EnvironmentConfig
anyways as the config is user-facing API, while retrying is a compiler implementation detail.(per @josephsavona's feedback #32164 (comment))
Stack created with Sapling. Best reviewed with ReviewStack.
fireRetry
flag -> compileMode #32511