Skip to content

RDFPFN792026: trace hydration branches through rendered values - #1488

Merged
aidenybai merged 7 commits into
mainfrom
codex/rdfpfn792026-hydration-browser
Jul 30, 2026
Merged

RDFPFN792026: trace hydration branches through rendered values#1488
aidenybai merged 7 commits into
mainfrom
codex/rdfpfn792026-hydration-browser

Conversation

@aidenybai

@aidenybai aidenybai commented Jul 29, 2026

Copy link
Copy Markdown
Member

Why

ReactBench exposed browser-global hydration branches that the rule missed when the predicate flowed through mutable aliases, local helpers, memoized objects, hook state, or compiled createElement output.

What

  • trace browser-global predicates through render-phase helper and state flows
  • recognize rendered local factory results without treating lookalike factories as React provenance
  • require a same-file rendered consumer before reporting a browser-derived custom-hook initializer
  • keep mount-gated probes and equivalent initial output quiet
  • add ReactBench regression and fuzz coverage

ReactBench evidence

  • live-doc contract: 42 source-provable units
  • exact replay: 42/42 caught
  • excluded: six initially-false mount gates and one cross-file-only hook consumer (ivEkXud)
  • parse errors: 0
  • reconstructed-source mismatches: 0

The ivEkXud hook initializer is intentionally not reported from its standalone source file. Its rendered consumer appears only in a separate patched file, so this file-local rule cannot prove the hydration mismatch.

Test plan

  • nr test in packages/oxlint-plugin-react-doctor: 958 files, 24,819 passed, 201 skipped
  • FUZZ_RULE=no-hydration-branch-on-browser-global FUZZ_ITERATIONS=500 FUZZ_SEED=792026 nr fuzz
  • nr typecheck in the plugin and fuzz packages
  • nr lint
  • nr format:check
  • nr smoke:json-report

The root test/typecheck orchestration was also attempted. Unrelated workers exhausted the shared runner after the affected packages had passed; the isolated affected-package gates are green.

Local RDE could not start because AXIOM_DATASET is not configured.


Note

Medium Risk
Large, intricate changes to a correctness lint rule’s static analysis; behavior shifts on many edge cases, though scope is limited to the plugin and tests.

Overview
Extends no-hydration-branch-on-browser-global so browser-global predicates are tracked through render-time helpers, mutable aliases, useState/useMemo flows, custom-hook return paths, and compiled createElement output—not only direct JSX conditionals.

Predicate resolution now follows let/var writes guarded by browser checks (including nested helper invocations), useMemo object properties, lazy useState initializers, and equality/bitwise forms that still differ by runtime; reflexive or duplicated-predicate comparisons are suppressed.

Reporting gates require a same-file rendered consumer for hook-returned browser state, treat locally invoked render helpers as in-output, and distinguish real React createElement from lookalike factories via explicit runtime require/import provenance. Equivalence checks use binding-aware structural comparison so shadowed branch-local JSX and mount-gated or suppressHydrationWarning consumers stay quiet when output is effectively stable.

Adds a large ReactBench regression suite and fuzz corpus cases for true positives and false-positive retractions.

Reviewed by Cursor Bugbot for commit 9cc9aeb. Bugbot is set up for automated code reviews on this repo. Configure here.

@pkg-pr-new

pkg-pr-new Bot commented Jul 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/eslint-plugin-react-doctor@1488
npm i https://pkg.pr.new/oxlint-plugin-react-doctor@1488
npm i https://pkg.pr.new/react-doctor@1488

commit: 9cc9aeb

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

React Doctor interactive terminal recording

Recorded from the built CLI at 9cc9aeb in a real terminal. The fixture holds Git busy for three seconds, so Scanning... must appear immediately after project selection, then exercises the compact interactive report.

Download the GIF and MP4 artifact

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit f5a3f62. Configure here.

@aidenybai
aidenybai force-pushed the codex/rdfpfn792026-hydration-browser branch from f5a3f62 to 9cc9aeb Compare July 29, 2026 14:56
@aidenybai
aidenybai merged commit d6f02bb into main Jul 30, 2026
26 of 27 checks passed
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.

1 participant