fix: add diagnostic logging for baseline degradation causes - #1769
Draft
skoshx wants to merge 3 commits into
Draft
fix: add diagnostic logging for baseline degradation causes#1769skoshx wants to merge 3 commits into
skoshx wants to merge 3 commits into
Conversation
- 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>
commit: |
Contributor
|
React Doctor found no new issues. 🎉 Reviewed by React Doctor for commit |
Contributor
Interactive terminal E2ETerminal Control verified the built CLI at
|
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: 0is already set. The actual cause of degradation was impossible to diagnose becauserunBaselineComparisonreturnsnullin 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 startdeadline-listing-aborted: aborted during maintainability file listingmaterialization-failed: git operations to materialize baseline tree failedsnapshot-incomplete: some base files couldn't be materialized (includes list of files)dead-code-copy-failed: copying unchanged sources for dead code analysis failedexpected-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
baselineDegradationReasonto 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 suggestingfetch-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:
Closes #1768