Skip to content

[compiler] Add --verbose flag to react-compiler-healthcheck#538

Closed
everettbu wants to merge 1 commit into
mainfrom
healthcheck-verbose-flag
Closed

[compiler] Add --verbose flag to react-compiler-healthcheck#538
everettbu wants to merge 1 commit into
mainfrom
healthcheck-verbose-flag

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35812
Original author: apoorvdarshan


Summary

  • Adds a --verbose (-v) CLI flag to react-compiler-healthcheck
  • When enabled, prints per-component failure details (file path, line/column, error reason) after the existing summary line
  • Failures are grouped into "Actionable failures" (red) and "Other failures" (yellow), deduplicated by source location

Test plan

  • Build with npx tsup in compiler/packages/react-compiler-healthcheck
  • Run without --verbose and confirm output is unchanged (summary only)
  • Run with --verbose and confirm failure details are printed with file paths, locations, and reasons
  • Run with -v alias and confirm it behaves the same as --verbose

When --verbose (-v) is passed, the healthcheck CLI now prints
per-component failure details (file path, line/column, and error
reason) grouped into actionable and other failures, in addition
to the existing summary line.
@greptile-apps

greptile-apps Bot commented Feb 18, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds a --verbose (-v) CLI flag to react-compiler-healthcheck that, when enabled, prints per-component failure details (file path, line/column, error reason) grouped into "Actionable failures" (red) and "Other failures" (yellow) after the existing summary line.

  • The CLI wiring in index.ts is clean—adds the yargs option and threads it through to report().
  • The new getFailureReason and printFailureDetails functions in reactCompiler.ts correctly extract failure information from all relevant LoggerEvent kinds.
  • The deduplication logic in the new printFailureDetails uses filename:line:column keys, which is more correct than the pre-existing countUniqueLocInEvents (which uses fnLoc.start as-is, stringifying to [object Object]). This mismatch means the summary count and the verbose detail count may disagree. While the root bug predates this PR, the new verbose output will make the discrepancy visible to users.

Confidence Score: 3/5

  • This PR is safe to merge but may produce confusing output due to a pre-existing dedup bug that becomes visible with verbose mode.
  • The new code is well-structured and the CLI flag is wired correctly. The main concern is that the deduplication logic in printFailureDetails is inconsistent with the existing countUniqueLocInEvents, meaning the summary count and verbose detail count may not match. This is a user-facing inconsistency that could cause confusion, though the underlying bug predates this PR.
  • Pay close attention to compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts — the dedup key mismatch between countUniqueLocInEvents and printFailureDetails should ideally be resolved.

Important Files Changed

Filename Overview
compiler/packages/react-compiler-healthcheck/src/checks/reactCompiler.ts Adds getFailureReason, printFailureDetails functions and a verbose parameter to report(). Deduplication in printFailureDetails uses a different key format than existing countUniqueLocInEvents, which could cause confusing count mismatches in verbose output.
compiler/packages/react-compiler-healthcheck/src/index.ts Adds --verbose / -v CLI flag via yargs and passes it through to reactCompilerCheck.report(). Straightforward wiring change with no issues.

Last reviewed commit: 4dff802

@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, 1 comment

Edit Code Review Agent Settings | Greptile

Comment on lines +159 to +164
for (const e of events) {
if (e.filename != null && e.fnLoc != null) {
const key = `${e.filename}:${e.fnLoc.start.line}:${e.fnLoc.start.column}`;
if (!seen.has(key)) {
seen.set(key, e);
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Deduplication key inconsistency with countUniqueLocInEvents

The deduplication key here uses e.fnLoc.start.line and e.fnLoc.start.column, while the existing countUniqueLocInEvents (line 126) uses ${e.fnLoc.start}:${e.fnLoc.end}. Since fnLoc.start is an object ({line, column}), the existing function's key stringifies to filename:[object Object]:[object Object], which effectively deduplicates by filename only.

This means the count shown in the summary line (e.g., "5 out of 10 components") could disagree with the number of items printed in verbose mode, since verbose correctly deduplicates by filename:line:column. This pre-existing bug in countUniqueLocInEvents isn't introduced by this PR, but combining it with the new verbose output will make the discrepancy visible to users.

Consider aligning the dedup logic—either fix countUniqueLocInEvents to use .start.line/.start.column/.end.line/.end.column, or extract a shared helper for building dedup keys.

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: 159-164

Comment:
**Deduplication key inconsistency with `countUniqueLocInEvents`**

The deduplication key here uses `e.fnLoc.start.line` and `e.fnLoc.start.column`, while the existing `countUniqueLocInEvents` (line 126) uses `${e.fnLoc.start}:${e.fnLoc.end}`. Since `fnLoc.start` is an object (`{line, column}`), the existing function's key stringifies to `filename:[object Object]:[object Object]`, which effectively deduplicates by filename only.

This means the count shown in the summary line (e.g., "5 out of 10 components") could disagree with the number of items printed in verbose mode, since verbose correctly deduplicates by `filename:line:column`. This pre-existing bug in `countUniqueLocInEvents` isn't introduced by this PR, but combining it with the new verbose output will make the discrepancy visible to users.

Consider aligning the dedup logic—either fix `countUniqueLocInEvents` to use `.start.line`/`.start.column`/`.end.line`/`.end.column`, or extract a shared helper for building dedup keys.

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 18, 2026
@everettbu
everettbu deleted the healthcheck-verbose-flag branch February 18, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants