Skip to content

FPFNFIXAPEX fix contradictory ref guards in state updater helpers - #2157

Open
aidenybai wants to merge 3 commits into
mainfrom
fix/immediate-ref-guard-state-updater
Open

aidenybai wants to merge 3 commits into
mainfrom
fix/immediate-ref-guard-state-updater

Conversation

@aidenybai

@aidenybai aidenybai commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Why

A caller and its immediately invoked helper can test the same readonly React ref with opposite truthiness. The helper’s side-effect branch is then unreachable, including when React replays the updater, but the existing analysis still reported that branch.

What changed

Carry the bounded immediate ref-guard exclusion through supported updater entry points. Keep mutations, escapes, unsupported consumers, and conflicting entry paths reporting. Independent review preserved the proof boundaries and corrected runtime value lookup through erased TypeScript declarations, adding an erased-ref regression, a valid runtime export control, a synthetic fuzz regression, and a generator control. Published behavior has patch Changesets.

Existing author fixture and snippet literal values and order remain intact. The HostedCart CLI regression now runs its two scenarios as independent cases, retaining every comparison and assertion with the existing 30-second test budget.

Validation

  • Fresh full tests: 34,244 passed, 1,118 skipped; 12 tasks, none cached. All 55 focused rule tests and both CLI regression scenarios passed. Each CLI scenario completed all four scans with the expected selected files and findings.
  • Lint, full typecheck (10 tasks, none cached), formatting, registry generation, fresh five-package build (none cached), and JSON report smoke check passed.
  • Strict target fuzz passed once with seed 42, 500 configured iterations, and target activation required. Numeric execution and fire counts were not emitted.
  • Fresh compiled native/API/CLI comparisons covered the same 53 synthetic files on exact base and final builds: target warnings changed 134 to 125. All 125 retained target objects and all 92 unrelated default-rule objects remain exact, including complete CLI identities.
  • The author’s mixed export = and named-export sample produces TS2309 on both revisions. That diagnostic remains exact and receives no quiet-control credit. A separate valid export-assignment control remains at three target and two other warnings with no parser diagnostic.
  • A three-file type-erasure supplement changed target warnings seven to six. Default totals changed 14 to 12: the same stable ref also lost one false exhaustive-deps warning, while the six other diagnostic objects and full CLI identities remain exact. This additional removal follows the existing native useRef stability classification.
  • Every public profile analyzed every fixture without skipped checks. All 175 runtime artifacts, archived copies, source inputs, and four actual own-package resolution edges were verified.

Remote parity is blocked by missing Vercel Sandbox authentication, team/org, and project environment variables. No remote corpus, performance, or React mount result is claimed.

@pkg-pr-new

pkg-pr-new Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

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

commit: 711cc04

@github-actions

github-actions Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

Terminal Control verified the built CLI at 711cc04 in a real PTY:

  • selected a project interactively and observed Scanning... before the three-second Git delay completed
  • waited for the clean result and exercised the compact report
  • opened copy context and the GitHub Actions confirmation, then cancelled safely

Download the edited MP4 and PNG evidence

@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 711cc04.

@aidenybai
aidenybai marked this pull request as ready for review October 20, 2026 09:25

This branch has not been deployed

No deployments
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