Skip to content

[compiler] Add fault tolerance plan document#589

Closed
everettbu wants to merge 1 commit into
mainfrom
pr35872
Closed

[compiler] Add fault tolerance plan document#589
everettbu wants to merge 1 commit into
mainfrom
pr35872

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35872
Original author: josephsavona


Add detailed plan for making the React Compiler fault-tolerant by
accumulating errors across all passes instead of stopping at the first
error. This enables reporting multiple compilation errors at once.


Stack created with Sapling. Best reviewed with ReviewStack.

  • #35884
  • #35883
  • #35882
  • #35881
  • #35880
  • #35879
  • #35878
  • #35877
  • #35876
  • #35875
  • #35874
  • #35873
  • -> #35872

Add detailed plan for making the React Compiler fault-tolerant by
accumulating errors across all passes instead of stopping at the first
error. This enables reporting multiple compilation errors at once.
@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 23, 2026
@greptile-apps

greptile-apps Bot commented Feb 23, 2026

Copy link
Copy Markdown

Greptile Summary

Adds a detailed plan document (compiler/fault-tolerance-overview.md) for making the React Compiler fault-tolerant by accumulating errors across all compilation passes instead of halting at the first error, enabling multi-error reporting.

  • The document is a 320-line design plan covering 8 phases: Environment error infrastructure, Pipeline return type changes, BuildHIR updates, validation/inference/codegen pass migrations, pipeline integration, and testing
  • All referenced source files (Environment.ts, Pipeline.ts, BuildHIR.ts, Program.ts, validation passes, inference passes, codegen) exist and match the described patterns (Result types, .unwrap() calls, etc.)
  • Minor typo on line 20: "construct record" should be "record" (extra word)
  • Pattern categorization in Phase 4 skips from "Pattern B" to "Pattern D" (missing "Pattern C")

Confidence Score: 4/5

  • This PR adds only a documentation/plan file with no code changes, making it very safe to merge.
  • This is a documentation-only PR adding a design plan. It introduces no code changes, so there is zero risk of runtime regressions. The plan content is technically accurate based on verification against the actual source files. Minor text issues (a typo and a skipped pattern label) are the only findings.
  • No files require special attention — this is a documentation-only change.

Important Files Changed

Filename Overview
compiler/fault-tolerance-overview.md New design plan document for making the React Compiler fault-tolerant. Contains a minor typo and a skipped pattern category label, but the technical content is well-structured and references to source files are accurate.

Last reviewed commit: d808047

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 file reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

## Detailed Design

* The Environment needs a way to record errors as compilation proceeds. This should generally store the error (and log, if a logger is configured), but should immediately throw if the error is an invariant (see above).
* BuildHIR should always produce an HIR without error. For syntax forms that are unsupported (currently throwing a Todo error), we should instead construct record the todo error on the environment, and construct a partial HIR. The exact form of the partial HIR can be situation specific:

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Typo: duplicate word
"we should instead construct record the todo error" appears to have an extra word. It should read "we should instead record the todo error" (remove "construct" before "record").

Suggested change
* BuildHIR should always produce an HIR without error. For syntax forms that are unsupported (currently throwing a Todo error), we should instead construct record the todo error on the environment, and construct a partial HIR. The exact form of the partial HIR can be situation specific:
* BuildHIR should always produce an HIR without error. For syntax forms that are unsupported (currently throwing a Todo error), we should instead record the todo error on the environment, and construct a partial HIR. The exact form of the partial HIR can be situation specific:
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/fault-tolerance-overview.md
Line: 20

Comment:
**Typo: duplicate word**
"we should instead construct record the todo error" appears to have an extra word. It should read "we should instead record the todo error" (remove "construct" before "record").

```suggestion
* BuildHIR should always produce an HIR without error. For syntax forms that are unsupported (currently throwing a Todo error), we should instead record the todo error on the environment, and construct a partial HIR. The exact form of the partial HIR can be situation specific:
```

How can I resolve this? If you propose a fix, please make it concise.

- [ ] **4.15 `validateNoJSXInTryStatement`** — change to record on env directly
- [ ] **4.16 `validateStaticComponents`** — change to record on env directly

#### Pattern D passes (currently throw directly, no Result)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing "Pattern C" category
The pass categorization jumps from "Pattern B" to "Pattern D", skipping "Pattern C". If Pattern C was intentionally removed, consider renaming this to "Pattern C" for sequential ordering. Otherwise, it may confuse readers who expect a Pattern C section.

Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/fault-tolerance-overview.md
Line: 201

Comment:
**Missing "Pattern C" category**
The pass categorization jumps from "Pattern B" to "Pattern D", skipping "Pattern C". If Pattern C was intentionally removed, consider renaming this to "Pattern C" for sequential ordering. Otherwise, it may confuse readers who expect a Pattern C section.

How can I resolve this? If you propose a fix, please make it concise.

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Feb 23, 2026
@everettbu
everettbu deleted the pr35872 branch February 23, 2026 23:23
@everettbu
everettbu restored the pr35872 branch February 24, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants