Skip to content

fix: treat ambiguous paths like /tools/ and /migrations/ as production inside source roots - #1727

Draft
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1724-371d
Draft

fix: treat ambiguous paths like /tools/ and /migrations/ as production inside source roots#1727
skoshx wants to merge 2 commits into
mainfrom
cursor/triage-1724-371d

Conversation

@skoshx

@skoshx skoshx commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #1724

Rules tagged test-noise (332 of 884 rules) were silently skipping files in paths containing /tools/, /migrations/, /scripts/, /cli/, /bin/, /generators/, /devtools/, etc., even when nested inside application source roots like src/components/tools/. This caused false negatives where legitimate production code was not being scanned.

Root Cause

The isTestlikeFilename heuristic treated these directory names as universally non-production. While this is correct at the repo root (where tools/ is typically build tooling), it's incorrect inside application source roots where src/components/tools/ is often a feature area (e.g., an admin tools section).

The Fix

The heuristic now distinguishes between two categories of path segments:

Unambiguous non-production (always skipped)

Test/fixture/story/benchmark/demo/examples directories that are never shipped code, regardless of depth:

  • /test/, /tests/, /__tests__/, /fixtures/, /stories/, etc.
  • /demo/, /demos/, /examples/, /example/
  • /playground/, /benchmarks/, /e2e/, etc.

Component library demos (/demo/, /examples/) remain unambiguous because even when nested in component source (e.g., components/Button/demos/), they're demonstration code, not production.

Ambiguous build tooling (only skipped at repo root)

Directories that mark build tooling at the repo root but can be feature areas inside source roots:

  • /tools/, /scripts/, /cli/, /bin/, /tooling/
  • /migrations/, /migration/, /generators/, /generator/
  • /codemods/, /codemod/, /runbooks/, /devtools/
  • /seeds/, /seed/, /dev-seeder/, /internal-tools/

These are now only skipped when the file is NOT within a source root (/src/, /app/, /components/, /pages/, /lib/, etc.).

Examples

Before this fix:

  • src/components/tools/widget.tsx → skipped (false negative)
  • src/admin/migrations/history.tsx → skipped (false negative)
  • tools/build-script.ts → skipped ✅

After this fix:

  • src/components/tools/widget.tsx → scanned ✅
  • src/admin/migrations/history.tsx → scanned ✅
  • tools/build-script.ts → skipped ✅
  • components/Button/demos/demo1.tsx → skipped ✅ (component library demo)

Testing

  • ✅ Reproduced the reported issue with byte-identical files in src/components/chat/ (scanned) vs src/components/tools/ (skipped before, now scanned)
  • ✅ Added comprehensive unit tests covering all ambiguous and unambiguous segments
  • ✅ All existing tests pass
  • ✅ Validated that component library demos remain correctly skipped

Validation

Running parity check with react-doctor-evals to ensure no unexpected regressions across the OSS corpus. Will update with results.

Open in Web Open in Cursor 

cursoragent and others added 2 commits August 30, 2026 22:43
…de source roots

Fixes #1724

Rules tagged test-noise were silently skipping files in paths containing
/tools/, /migrations/, /scripts/, /cli/, /bin/, etc., even when nested
inside application source roots like src/components/tools/.

The heuristic now distinguishes between:
- Unambiguous non-production (test/fixture/story/benchmark/demo/examples):
  always skipped regardless of depth
- Ambiguous build tooling (/tools/, /migrations/, /scripts/, etc.):
  only skipped at repo root, not inside source roots

This lets test-noise rules correctly fire on production feature areas
like src/components/tools/ while still skipping top-level build tooling
like <repo>/tools/.

Component library demos (/demo/, /examples/) remain unambiguous and are
skipped everywhere, as they're genuinely non-production even when nested
in component source (e.g., components/Button/demos/).

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

pkg-pr-new Bot commented Aug 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: d16a367

@github-actions

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

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

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.

test-noise rules are silently skipped in any path containing tools/, demo/, migrations/, …

2 participants