Skip to content

[compiler] log if a compiler error was opted out of#100

Closed
everettbu wants to merge 1 commit into
mainfrom
pr/compiler-inform-opted-out
Closed

[compiler] log if a compiler error was opted out of#100
everettbu wants to merge 1 commit into
mainfrom
pr/compiler-inform-opted-out

Conversation

@everettbu

@everettbu everettbu commented Dec 12, 2025

Copy link
Copy Markdown

Mirror of facebook/react#33618
Original author: phryneas


Summary

(This is likely not a finished plugin, but a grounds for discussion around this feature.)

In logEvent, I would like to be able to distinguish between errors that I already opted out via "use no memo"/"use no forget" and new, unhandled errors.

How did you test this change?

No tests yet, I want to know if this is something worth pursuing first before I put more work into this.

@greptile-apps

greptile-apps Bot commented Dec 12, 2025

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR adds an optedOut boolean field to CompileErrorEvent to distinguish between compiler errors that were explicitly opted out using directives like "use no memo" or "use no forget", versus new unhandled errors. The change enables better telemetry by allowing consumers to filter error logs based on whether they were intentionally suppressed.

  • Added optional optedOut field to CompileErrorEvent type definition
  • Modified logError function to accept an optedOut parameter and include it in logged events
  • Passes true when logging errors for functions with opt-out directives, false for all other error cases

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The change is simple, well-scoped, and backwards-compatible. The optedOut field is optional, so existing logger implementations won't break. The logic correctly distinguishes between opted-out errors (when directives.optOut != null) and regular errors, properly threading the boolean through the call chain.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts 5/5 Added optional optedOut boolean field to CompileErrorEvent type to distinguish opted-out errors
compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Program.ts 5/5 Added optedOut parameter to logError function, passes true when function has opt-out directive, false otherwise

@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.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@everettbu everettbu added the Resolution: Stale Automatically closed due to inactivity label Dec 21, 2025
@everettbu

Copy link
Copy Markdown
Author

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

@everettbu everettbu closed this Dec 22, 2025
@everettbu
everettbu deleted the pr/compiler-inform-opted-out branch December 22, 2025 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Resolution: Stale Automatically closed due to inactivity

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants