fix: Handle missing segments from ImpactedFileComparison response#3961
fix: Handle missing segments from ImpactedFileComparison response#3961calvin-codecov wants to merge 2 commits intomainfrom
Conversation
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Prevent Tests Dashboard |
❌ 5 Tests Failed:
View the top 3 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| </span> | ||
| </p> | ||
| ) | ||
| } |
There was a problem hiding this comment.
Identical component duplicated across multiple files
Low Severity
The UnknownPathErrorDisplayMessage component is defined identically in two separate PullFileDiff.tsx files in this PR. The same component also already exists in the CommitFileDiff files, resulting in four total copies of identical code. This increases maintenance burden and risks inconsistent bug fixes if the error message or styling needs to change. While this follows an existing pattern in the codebase (similar to ErrorDisplayMessage), extracting it to a shared location would reduce duplication.
Related to problem happening in: https://sentry.zendesk.com/agent/tickets/171579 where the customer's pull request has coverage data showing but displays a 400 error on the page with no useful information.
Our query ImpactedFileComparison is getting a 404 when trying to request the source code from the git provider for a specific file when expanding in the UI. This PR is adding better handling of the response from the query when it does not return segments of type SegmentComparisons (what we need to display the snippets with coverage) but instead UnknownPath or ProviderError. We are getting UnknownPath in this customer's case. These changes add UI components that mirror what we show for CommitDiff that get UnknownPath/ProviderError responses. Other files change include newly checking the
segmentspart of the GQL response data to dictate behavior as opposed to moving straightsegments?.resultsand dealing withundefineds.Note
Improves robustness of impacted-file diff rendering when GraphQL
segmentsisn’tSegmentComparisons.segments(SegmentComparisons | UnknownPath | ProviderError) inservices/pull/fragmentsand preserves fullsegmentsin transform utilssegments.__typename === 'SegmentComparisons'before using.resultsPullFileDifffor FilesChanged/IndirectChanges) now handleUnknownPathwith a user-facing message andProviderErrorwith a generic error; similar handling added/confirmed for commit viewsuseSingularImpactedFileComparisonreturns rawimpactedFile(no early transform); consumers calltransformImpactedPullFileToDiffUnknownPathand new data shape expectationsWritten by Cursor Bugbot for commit 3eb024f. This will update automatically on new commits. Configure here.