Skip to content

Add React Doctor CI Buildkite job#2659

Open
sejas wants to merge 11 commits intotrunkfrom
stu-1307-add-react-doctor-ci
Open

Add React Doctor CI Buildkite job#2659
sejas wants to merge 11 commits intotrunkfrom
stu-1307-add-react-doctor-ci

Conversation

@sejas
Copy link
Member

@sejas sejas commented Feb 24, 2026

Related issues

Proposed Changes

  • Add a new React Doctor Buildkite CI step that runs in parallel with lint, unit tests, e2e, and metrics
  • New script .buildkite/commands/run-react-doctor.sh that:
    • Runs npx -y react-doctor --no-ami --yes --fail-on error to detect React code health issues
    • Parses the score from the output and fails CI if it drops below 95/100. I chose 87 as an arbitrary threshold. We can set it to any number we consider appropriate. Currently, the score is 90.
    • Posts a Buildkite annotation (error/success styled) with full diagnostics in a collapsible block
    • Skips on non-code-only changes (docs, config, etc.) via should-skip-job.sh
  • Reports as a GitHub commit status check ("React Doctor")
  • Add apps/studio/react-doctor.config.json to exclude Electron entry points from being omitted because they are not dead code, and omits the jsx-a11y/no-autofocus rule.
  • Remove unused files and export that was not caught before to bump the score to 90.
  • The job takes around 1 minute 34 seconds.
Screenshot 2026-02-25 at 10 36 41

Testing Instructions

Screenshot 2026-02-24 at 20 58 16 Screenshot 2026-02-24 at 20 46 35

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors? (Tests pass, no errors)

Runs in parallel with lint and tests. Posts a Buildkite annotation with
the full diagnostics and fails if the score drops below 95 or if
error-level issues are found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sejas sejas self-assigned this Feb 24, 2026
sejas and others added 6 commits February 24, 2026 20:32
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ANSI escape codes embedded in the output were preventing the grep
pattern from matching the score. Strip them before parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sejas sejas marked this pull request as ready for review February 24, 2026 21:05
@sejas sejas requested a review from a team February 24, 2026 21:05
@sejas sejas changed the title Add React Doctor CI step Add React Doctor CI Buildkite job Feb 24, 2026
# Run react-doctor and capture output
# Don't use --offline so score gets calculated
# Use --fail-on error to catch error-level issues
OUTPUT=$(npx -y react-doctor --no-ami --yes --fail-on error 2>&1) || DOCTOR_EXIT=$?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this always runs the latest version, right? I am wondering if we should use specific version instead? The main reason why I am thinking that is if the latest version has some breaking changes, the CI build could potentially break. But it is not a strong opinion, mostly something to consider in my opinion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes! it uses the latest version. I had a similar concern where the CI fails because new rules are added or the score algorithm is updated, but in that case we could change the threshold if necessary. Running the latest version allows us to benefit from new best practices and bugfixes.

Copy link
Contributor

@katinthehatsite katinthehatsite left a comment

Choose a reason for hiding this comment

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

the changes look good to me. I am not sure if we need React doctor in CI so I will let others share their opinions. I left one small comment for consideration

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Feb 25, 2026

📊 Performance Test Results

Comparing d59f6e0 vs trunk

site-editor

Metric trunk d59f6e0 Diff Change
load 1521.00 ms 1490.00 ms -31.00 ms ⚪ 0.0%

site-startup

Metric trunk d59f6e0 Diff Change
siteCreation 7081.00 ms 7080.00 ms -1.00 ms ⚪ 0.0%
siteStartup 3943.00 ms 3942.00 ms -1.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@sejas sejas requested a review from a team February 25, 2026 12:25
Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

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

This looks good to me, and I think this is a nice-to-have addition to our CI suite. The checks it runs are valuable on top of eg. eslint rules that are already applied locally. Also, as it's run in parallel with other jobs and usually completes in ~1.5m, I don't think it adds much overhead or potentially becomes a bottleneck on any CI run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants