Skip to content

feat: add REACT_DOCTOR_NO_SCAN_CACHE for granular cache opt-out - #1805

Open
skoshx wants to merge 1 commit into
mainfrom
cursor/triage-1804-15cc
Open

skoshx wants to merge 1 commit into
mainfrom
cursor/triage-1804-15cc

Conversation

@skoshx

@skoshx skoshx commented Sep 12, 2026

Copy link
Copy Markdown
Contributor

Problem

React Doctor 0.9.13's whole-scan result cache computes a repository identity using git status --porcelain=v1 -z --untracked-files=all and the contents of dirty files (buildScanResultCacheKeyresolveRepositoryCacheIdentitybuildWorktreeFingerprint). Vite Task automatically records child-process filesystem accesses as inputs. Running Doctor inside a cached package task therefore makes unrelated repository changes invalidate that package's verdict.

The outer task cache already replays the complete verdict. Doctor's per-file lint and sidecar caches remain useful when a changed package actually runs. REACT_DOCTOR_NO_CACHE switches all three off, so it is too broad here.

Solution

Add REACT_DOCTOR_NO_SCAN_CACHE, with the same truthy-value convention as REACT_DOCTOR_NO_CACHE, returning null from buildScanResultCacheKey before isGitIdentityTrustworthy or repository fingerprint collection. Preserve normal behavior when the flag is absent, and leave per-file and sidecar caches enabled.

Implementation

  • Added isScanCacheDisabled() function that checks both REACT_DOCTOR_NO_CACHE (global) and REACT_DOCTOR_NO_SCAN_CACHE (granular)
  • Modified buildScanResultCacheKey to use the new granular check early, before any Git operations
  • Per-file and sidecar caches remain unaffected - they continue to use their own Reference defaults
  • Updated documentation in comments to reflect the new flag

Testing

  • ✅ Added unit tests for the new environment variable behavior
  • ✅ Added test to verify git status is not called when REACT_DOCTOR_NO_SCAN_CACHE is set
  • ✅ Added test to verify REACT_DOCTOR_NO_CACHE (global) still overrides REACT_DOCTOR_NO_SCAN_CACHE=false
  • ✅ All existing scan-result-cache tests pass (31 tests)
  • ✅ Typecheck passes
  • ✅ Lint passes
  • ✅ Added patch-level changeset

Parity Analysis

Parity testing is not applicable for this change because:

  • This is a cache control feature, not a rule or diagnostic change
  • The diagnostics output is identical whether the cache is enabled or disabled
  • The feature only affects when results are cached, not what results are produced
  • When REACT_DOCTOR_NO_SCAN_CACHE is unset (the default), behavior is identical to before

Closes #1804

Open in Web Open in Cursor 

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
@pkg-pr-new

pkg-pr-new Bot commented Sep 12, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: f18001b

@github-actions

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit f18001b.

@github-actions

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

Terminal Control verified the built CLI at f18001b 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

@skoshx
skoshx marked this pull request as ready for review September 12, 2026 22:30

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.

Add a granular scan-result cache opt-out for outer task caches

2 participants