[react-compiler-healthcheck] Add verbose failed-component reporting#515
[react-compiler-healthcheck] Add verbose failed-component reporting#515everettbu wants to merge 1 commit into
Conversation
Greptile OverviewGreptile SummaryThis PR adds a
Confidence Score: 4/5
Important Files Changed
Last reviewed commit: d62ecc4 |
| const verboseFailures = getVerboseFailures(); | ||
| if (verboseFailures.length === 0) { |
There was a problem hiding this comment.
Verbose count may not match summary count
The summary line uses countUniqueLocInEvents() to deduplicate failures by filename + location, but getVerboseFailures() returns every raw event without deduplication. When multiple compiler errors fire for the same function (e.g. multiple rule violations in the same pass, as noted in the comment on countUniqueLocInEvents), verbose mode will list more entries than the summary's failed-component count implies. This could confuse users who see "compiled 8 out of 10 components" (2 failures) but then a verbose list of 5 entries.
Consider either deduplicating verbose output to match the summary count, or adding a note in the verbose header explaining that multiple failures may map to the same component.
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts
Line: 232:233
Comment:
**Verbose count may not match summary count**
The summary line uses `countUniqueLocInEvents()` to deduplicate failures by filename + location, but `getVerboseFailures()` returns every raw event without deduplication. When multiple compiler errors fire for the same function (e.g. multiple rule violations in the same pass, as noted in the comment on `countUniqueLocInEvents`), verbose mode will list more entries than the summary's failed-component count implies. This could confuse users who see "compiled 8 out of 10 components" (2 failures) but then a verbose list of 5 entries.
Consider either deduplicating verbose output to match the summary count, or adding a note in the verbose header explaining that multiple failures may map to the same component.
How can I resolve this? If you propose a fix, please make it concise.| function getFailureReason(event: FailureEvent): string { | ||
| switch (event.kind) { | ||
| case 'CompileError': { | ||
| const description = event.detail.description; | ||
| if (description == null || description.length === 0) { | ||
| return event.detail.reason; | ||
| } | ||
| return `${event.detail.reason}: ${description}`; | ||
| } | ||
| case 'CompileDiagnostic': { | ||
| if ( | ||
| event.detail.description == null || | ||
| event.detail.description.length === 0 | ||
| ) { | ||
| return event.detail.reason; | ||
| } | ||
| return `${event.detail.reason}: ${event.detail.description}`; | ||
| } |
There was a problem hiding this comment.
Duplicate logic in CompileError and CompileDiagnostic branches
The CompileError and CompileDiagnostic cases have identical logic for extracting the failure reason. Consider consolidating them:
| function getFailureReason(event: FailureEvent): string { | |
| switch (event.kind) { | |
| case 'CompileError': { | |
| const description = event.detail.description; | |
| if (description == null || description.length === 0) { | |
| return event.detail.reason; | |
| } | |
| return `${event.detail.reason}: ${description}`; | |
| } | |
| case 'CompileDiagnostic': { | |
| if ( | |
| event.detail.description == null || | |
| event.detail.description.length === 0 | |
| ) { | |
| return event.detail.reason; | |
| } | |
| return `${event.detail.reason}: ${event.detail.description}`; | |
| } | |
| function getFailureReason(event: FailureEvent): string { | |
| switch (event.kind) { | |
| case 'CompileError': | |
| case 'CompileDiagnostic': { | |
| if ( | |
| event.detail.description == null || | |
| event.detail.description.length === 0 | |
| ) { | |
| return event.detail.reason; | |
| } | |
| return `${event.detail.reason}: ${event.detail.description}`; | |
| } |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Prompt To Fix With AI
This is a comment left during a code review.
Path: compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts
Line: 149:166
Comment:
**Duplicate logic in `CompileError` and `CompileDiagnostic` branches**
The `CompileError` and `CompileDiagnostic` cases have identical logic for extracting the failure reason. Consider consolidating them:
```suggestion
function getFailureReason(event: FailureEvent): string {
switch (event.kind) {
case 'CompileError':
case 'CompileDiagnostic': {
if (
event.detail.description == null ||
event.detail.description.length === 0
) {
return event.detail.reason;
}
return `${event.detail.reason}: ${event.detail.description}`;
}
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35782
Original author: Arktomson
Summary
This PR adds a
--verboseflag toreact-compiler-healthcheckso failed component compilation details are printed only when requested.--verboseboolean CLI option inreact-compiler-healthcheck.ActionableFailuresandOtherFailures, including:Fixes #35772
How did you test this change?
I verified both build success and runtime CLI behavior in default and verbose modes.
Observed results:
[ActionableFailure] ...line with source location and compiler reason.