Skip to content

fix: add diagnostic logging for baseline degradation causes - #1769

Draft
skoshx wants to merge 3 commits into
mainfrom
cursor/triage-1768-38e6
Draft

fix: add diagnostic logging for baseline degradation causes#1769
skoshx wants to merge 3 commits into
mainfrom
cursor/triage-1768-38e6

Conversation

@skoshx

@skoshx skoshx commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Problem

Issue #1768 reports that baseline comparison degrades to plain diff mode when deleted files are in the changeset, and the error message misleadingly blames a shallow checkout even when fetch-depth: 0 is already set. The actual cause of degradation was impossible to diagnose because runBaselineComparison returns null in multiple places without any logging.

Solution

Added detailed diagnostic logging and machine-readable degradation reasons:

1. Verbose Logging

With --verbose, React Doctor now prints exactly which check failed:

  • deadline-budget-exhausted: ran out of time before baseline could start
  • deadline-listing-aborted: aborted during maintainability file listing
  • materialization-failed: git operations to materialize baseline tree failed
  • snapshot-incomplete: some base files couldn't be materialized (includes list of files)
  • dead-code-copy-failed: copying unchanged sources for dead code analysis failed
  • expected-head-files-missing: expected head files weren't analyzed (includes list of files)
  • base-lint-failed: baseline lint/dead-code analysis failed (includes specific reason)

2. JSON Report Field

Added baselineDegradationReason to the JSON report schema (schemaVersion 3) with the same reason codes. This allows the GitHub Action comment renderer to provide accurate, context-specific guidance instead of always suggesting fetch-depth: 0.

3. Improved Error Messages

Each degradation reason now includes specific details (e.g., which files failed to materialize, which expected files are missing) to help diagnose the root cause.

Testing

The fix adds diagnostic information without changing behavior:

  • Baseline comparison logic unchanged
  • Degradation conditions unchanged
  • Only adds logging and metadata to help diagnose why degradation occurred

Closes #1768

Open in Web Open in Cursor 

cursoragent and others added 2 commits September 7, 2026 22:17
- Add detailed --verbose logging for each baseline comparison failure point
- Add baselineDegradationReason to JSON report schema for programmatic access
- Improve error messages with specific details about which files failed

Addresses #1768 where baseline degradation was silent and always blamed
a shallow checkout even when the real cause was different (e.g. deleted
files, materialization failures, lint failures, etc.)

The degradation reason codes:
- deadline-budget-exhausted: ran out of time
- deadline-listing-aborted: aborted during file listing
- materialization-failed: couldn't materialize baseline tree
- snapshot-incomplete: some base files couldn't be materialized
- dead-code-copy-failed: dead code analysis copy failed
- expected-head-files-missing: expected head files weren't analyzed
- base-lint-failed: baseline lint failed

With --verbose, React Doctor now prints which check failed instead of
silently degrading. The JSON report includes the reason code so the
GitHub Action comment can provide accurate guidance instead of always
suggesting fetch-depth: 0.

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 Sep 7, 2026

Copy link
Copy Markdown

Open in StackBlitz

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

commit: bbc3435

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit bbc3435.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Interactive terminal E2E

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

…ad code

- Extract BASELINE_DEGRADATION_REASON_CODES to a shared constant in schemas.ts
- Remove duplicate filtering in expected-head-files-missing check
- Remove unused unmaterializedCount variable
- Reference shared type across schemas, types, and baseline comparison logic

Addresses findings from code review subagents.

Co-authored-by: Skosh <skoshx@users.noreply.github.com>
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.

Baseline degrades to plain diff when the change set deletes a file; action blames a shallow checkout

2 participants