Conversation
added 2 commits
June 27, 2025 17:37
There was a problem hiding this comment.
Pull Request Overview
This PR enhances error classification in the receive handler by properly detecting nested and wrapped conflict errors, and adds corresponding unit tests.
- Expanded
isConflictto unwrap errors, check root causes, and handleMultiErrorchains. - Updated
isNotReadyandisUnavailableto useerrors.Isand inspect wrapped causes. - Added
TestIsConflictWrappedErrorsandTestReplicationErrorsWithWrappedConflictsto verify nested conflict detection.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pkg/receive/handler.go | Expanded error-checking functions to handle wrapped and multi-errors for conflict, not-ready, and unavailable cases. |
| pkg/receive/handler_test.go | Added tests covering direct, wrapped, and nested conflict errors, plus replication error behavior. |
Comments suppressed due to low confidence (1)
pkg/receive/handler.go:1161
- [nitpick] Consider adding unit tests for isNotReady (and similarly for isUnavailable) to verify wrapped errors and multi-error chains are correctly recognized by the new unwrapping logic.
func isNotReady(err error) bool {
| return err == errConflict || | ||
|
|
||
| // Check direct error matches | ||
| if err == errConflict || |
There was a problem hiding this comment.
Consider using errors.Is(err, errConflict) instead of direct equality to correctly handle wrapped instances of the sentinel errConflict.
Suggested change
| if err == errConflict || | |
| if errors.Is(err, errConflict) || |
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.
Changes
Verification