Conversation
Greptile SummaryThis PR replaces the detailed fault tolerance planning document (
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: c950ee1 |
| ``` | ||
| **Recording errors** — Passes record errors via `env.recordError(diagnostic)`. Errors are accumulated on `Environment.#errors` and checked at the end of the pipeline via `env.hasErrors()` / `env.aggregateErrors()`. | ||
|
|
||
| **`tryRecord()` wrapper** — In Pipeline.ts, validation passes are wrapped in `env.tryRecord(() => pass(hir))` which catches thrown `CompilerError`s (non-invariant) and records them. Infrastructure/transformation passes are NOT wrapped in `tryRecord()` because later passes depend on their output being structurally valid. |
There was a problem hiding this comment.
Documentation references non-existent tryRecord() method
The documentation states that validation passes are wrapped in env.tryRecord(() => pass(hir)), but tryRecord() does not exist anywhere in the source code. Grepping for tryRecord across compiler/packages/babel-plugin-react-compiler/src/ returns zero results.
In reality, validation passes were refactored to call env.recordError() directly rather than being wrapped in a tryRecord() catch-and-record helper. The description of tryRecord() as catching thrown CompilerErrors is inaccurate — passes no longer throw; they record errors inline.
This same inaccuracy appears in the passes README.md at lines 309-310.
Consider updating the documentation to reflect the actual pattern: passes call env.recordError(diagnostic) directly instead of throwing, and there is no tryRecord() wrapper.
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/CLAUDE.md
Line: 238
Comment:
**Documentation references non-existent `tryRecord()` method**
The documentation states that validation passes are wrapped in `env.tryRecord(() => pass(hir))`, but `tryRecord()` does not exist anywhere in the source code. Grepping for `tryRecord` across `compiler/packages/babel-plugin-react-compiler/src/` returns zero results.
In reality, validation passes were refactored to call `env.recordError()` directly rather than being wrapped in a `tryRecord()` catch-and-record helper. The description of `tryRecord()` as catching thrown `CompilerError`s is inaccurate — passes no longer throw; they record errors inline.
This same inaccuracy appears in the passes `README.md` at lines 309-310.
Consider updating the documentation to reflect the actual pattern: passes call `env.recordError(diagnostic)` directly instead of throwing, and there is no `tryRecord()` wrapper.
How can I resolve this? If you propose a fix, please make it concise.| - **Validation passes** are wrapped in `env.tryRecord()` in Pipeline.ts, which catches non-invariant `CompilerError`s and records them. If a validation pass throws, compilation continues. | ||
| - **Infrastructure/transformation passes** (enterSSA, eliminateRedundantPhi, inferMutationAliasingEffects, codegen, etc.) are NOT wrapped in `tryRecord()` because subsequent passes depend on their output being structurally valid. If they fail, compilation aborts. |
There was a problem hiding this comment.
Same tryRecord() documentation issue as CLAUDE.md
These two bullet points reference env.tryRecord() which does not exist in the implementation. Validation passes now call env.recordError() directly instead of throwing, so there's no tryRecord() wrapper catching exceptions. This should be updated to match the actual error-recording approach.
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/babel-plugin-react-compiler/docs/passes/README.md
Line: 309-310
Comment:
**Same `tryRecord()` documentation issue as CLAUDE.md**
These two bullet points reference `env.tryRecord()` which does not exist in the implementation. Validation passes now call `env.recordError()` directly instead of throwing, so there's no `tryRecord()` wrapper catching exceptions. This should be updated to match the actual error-recording approach.
How can I resolve this? If you propose a fix, please make it concise.Add concise fault tolerance documentation to CLAUDE.md and the passes README covering error accumulation, tryRecord wrapping, and the distinction between validation vs infrastructure passes. Remove the detailed planning document now that the work is complete.
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35888
Original author: josephsavona
Add concise fault tolerance documentation to CLAUDE.md and the passes
README covering error accumulation, tryRecord wrapping, and the
distinction between validation vs infrastructure passes. Remove the
detailed planning document now that the work is complete.
Stack created with Sapling. Best reviewed with ReviewStack.