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

Author: jasonkuhrtCreated Sep 12, 2026Updated Sep 12, 2026

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.

Requested behavior

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.

Verified locally

A one-file React project in a real temporary Git repository, using 0.9.13, serial lint, --no-score --no-supply-chain --no-dead-code, and Git's native GIT_TRACE2_EVENT tracing:

Invocation Repository-wide git status Cache files created
Default, first and second run Once per run scan, per-file, sidecar
Granular opt-out, first and second run None per-file, sidecar

All four scans completed and analyzed the fixture file. A local patch implements one early-return condition at buildScanResultCacheKey; it does not change any per-file or sidecar cache code.