Skip to content

feat: baseline mode + touched-line enforcement#288

Closed
aidenybai wants to merge 1 commit into
cursor/config-foundation-675bfrom
cursor/baseline-and-touched-lines-675b
Closed

feat: baseline mode + touched-line enforcement#288
aidenybai wants to merge 1 commit into
cursor/config-foundation-675bfrom
cursor/baseline-and-touched-lines-675b

Conversation

@aidenybai
Copy link
Copy Markdown
Member

Second of a three-PR split of #286. Stacked on #287 (cursor/config-foundation-675b) — review and merge that one first.

Both features in this PR are scan-time filters that combine with diff mode. They share enough infrastructure (InspectResult/JsonReport extensions, inspect.ts, action.yml inputs, the validate-config-types schema additions) that splitting them further would create awkward dependencies.

Baseline mode — --baseline / --update-baseline

react-doctor . --update-baseline               # snapshot current diagnostics
react-doctor . --baseline                      # only new violations count
react-doctor . --baseline=./qa-baseline.json   # custom path
  • Stable per-diagnostic fingerprint: plugin + rule + filepath + message. Line/column intentionally excluded so unrelated edits don't break the baseline.
  • Baseline counts surface in InspectResult.baselineDiagnostics, JsonReport.summary.baselineDiagnosticCount, and PR comment framing ("9 baseline issues — no new violations introduced by this PR").
  • Empty-string path falls through to DEFAULT_BASELINE_FILENAME (regression test included).

Touched-line enforcement — --touched-lines

react-doctor . --diff main --touched-lines     # gate PR-time on touched lines only
react-doctor . --staged --touched-lines        # pre-commit hook variant
  • Parses git diff --unified=0 to filter diagnostics by line.
  • DiffInfo.diffBaseRef exposes the right git ref for each diff shape; current-changes mode uses HEAD (not null) so staged-only changes aren't silently dropped by the touched-lines filter.
  • Hidden-by-touched-lines counts surface in JsonReportProjectEntry.diagnosticsHiddenByTouchedLines.
  • Robust against unified-diff content lines that begin with "-- " (e.g. SQL comments) — FILE_HEADER_RESET_PATTERN only resets on real --- a/<path> or --- /dev/null headers.

action.yml

Adds the baseline and touched-lines inputs alongside main's annotations input. Preserves the existing PIPESTATUS / set +e exit-code preservation around the scan pipeline.

Stats

  • 25 new tests across the baseline and get-touched-lines suites, plus the build-json-report summary contract.
  • All 1217 tests passing; lint / typecheck / format clean.

What's NOT in this PR

  • PR comment markdown / sticky comment integration — in stacked PR 3.

Originally landed as part of #286.

Open in Web Open in Cursor 

@reactreview
Copy link
Copy Markdown

reactreview Bot commented May 17, 2026

🔴 No new issues

0/100 (unchanged)

Reviewed by react-review for commit dd93a69. Configure here.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 17, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
react-doctor-website Ready Ready Preview, Comment May 17, 2026 0:15am

Comment thread packages/react-doctor/src/cli/commands/inspect.ts
@cursor cursor Bot force-pushed the cursor/config-foundation-675b branch from 3fdd119 to 9287d69 Compare May 17, 2026 08:53
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from d702581 to 53c60c5 Compare May 17, 2026 08:56
cursor Bot pushed a commit that referenced this pull request May 17, 2026
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Comment thread packages/react-doctor/src/cli/commands/inspect.ts
@cursor cursor Bot force-pushed the cursor/config-foundation-675b branch from 9287d69 to a6a1db3 Compare May 17, 2026 09:21
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 53c60c5 to 4db24e7 Compare May 17, 2026 09:23
cursor Bot pushed a commit that referenced this pull request May 17, 2026
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/config-foundation-675b branch from a6a1db3 to 7abb104 Compare May 17, 2026 09:51
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 4db24e7 to a9c3e64 Compare May 17, 2026 09:52
cursor Bot pushed a commit that referenced this pull request May 17, 2026
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 and found 1 potential issue.

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 a9c3e64. Configure here.

Comment thread packages/core/src/baseline.ts
@cursor cursor Bot force-pushed the cursor/config-foundation-675b branch from 7abb104 to e42aee0 Compare May 17, 2026 10:57
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from a9c3e64 to 62eba8e Compare May 17, 2026 11:00
cursor Bot pushed a commit that referenced this pull request May 17, 2026
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/config-foundation-675b branch from e42aee0 to ebb1c04 Compare May 17, 2026 12:13
Second of a three-PR split of #286. Stacked on cursor/config-foundation-675b
(PR #287). Both features are scan-time filters that combine with diff mode,
both extend InspectResult / JsonReport, both touch action.yml inputs.

- Baseline mode: --baseline [path] / --update-baseline. Stable
  per-diagnostic fingerprint (plugin + rule + filepath + message;
  line / column intentionally excluded so unrelated edits don't break
  the baseline). Baseline counts surface in
  InspectResult.baselineDiagnostics, JsonReport.summary.baselineDiagnosticCount,
  and the PR comment header ("9 baseline issues, no new violations").
- Touched-line enforcement: --touched-lines. In diff or staged mode,
  restricts diagnostics to lines actually touched by the active diff
  (git diff --unified=0). DiffInfo.diffBaseRef + a HEAD baseRef for
  current-changes mode so staged-only edits aren't silently dropped.
  Hidden-by-touched-lines counts surface in the JSON report.
- action.yml: baseline + touched-lines inputs alongside the existing
  annotations input.
- 25 new tests across baseline + get-touched-lines suites.

1217 tests passing; lint / typecheck / format clean.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@cursor cursor Bot force-pushed the cursor/baseline-and-touched-lines-675b branch from 62eba8e to dd93a69 Compare May 17, 2026 12:14
cursor Bot pushed a commit that referenced this pull request May 17, 2026
Third and final PR of the #286 split. Stacked on
cursor/baseline-and-touched-lines-675b (#288).

- New `--pr-comment-output <path>` CLI flag writes a sticky-PR-comment-
  ready markdown document to a side file. Compose with --pr-comment so
  one scan produces both the build-log plaintext (stdout) and the
  structured markdown (file) without re-invoking the scanner.
- buildPrCommentMarkdown: `<!-- react-doctor -->` marker, per-rule
  `<details>` groups with severity icons + file:line refs +
  suppression snippets, per-package summary block for monorepos
  (worst-scored project drives the headline), baseline-aware framing
  ("no new violations introduced by this PR"), touched-lines
  footnote when filtering removed diagnostics.
- action.yml: single-scan dual-output integration. The github-script
  step now prefers the markdown file when available and falls back
  to the legacy plaintext-in-fence layout when running against older
  react-doctor versions.
- 6 new tests in build-pr-comment-markdown plus updated github-action
  contract tests for the single-scan + PIPESTATUS preservation.

1223 tests passing.

Co-authored-by: Aiden Bai <aidenybai@users.noreply.github.com>
@NisargIO NisargIO closed this May 20, 2026
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.

3 participants