Skip to content

Conversation

@verejoel
Copy link

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Verification

@denysvitali denysvitali requested a review from Copilot June 27, 2025 15:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isConflict to unwrap errors, check root causes, and handle MultiError chains.
  • Updated isNotReady and isUnavailable to use errors.Is and inspect wrapped causes.
  • Added TestIsConflictWrappedErrors and TestReplicationErrorsWithWrappedConflicts to 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 ||
Copy link

Copilot AI Jun 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) ||

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants