Skip to content

Conversation

@kevwan
Copy link
Contributor

@kevwan kevwan commented Dec 25, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 25, 2025 13:11
Copy link
Contributor

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 fixes circuit breaker behavior in the HTTP client by preventing context cancellation errors from triggering the breaker. The main change introduces a new acceptable function that distinguishes between different error types to determine whether a request should be considered a failure for circuit breaker purposes.

Key changes:

  • Added intelligent error classification in acceptable function to treat context cancellation as acceptable (user-initiated) while treating timeouts and network errors as failures
  • Comprehensive test coverage for all error scenarios including wrapped errors, network errors, and various HTTP status codes
  • Updated GitHub Copilot instructions with issue management guidelines (documentation update)

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

File Description
rest/httpc/service.go Introduces acceptable function to classify HTTP responses and errors for circuit breaker, distinguishing context cancellation from actual failures
rest/httpc/service_test.go Adds comprehensive table-driven tests for the acceptable function covering status codes, context errors, network errors, and edge cases
.github/copilot-instructions.md Adds GitHub issue management section with guidelines for handling issues, translations, and best practices

@kevwan kevwan force-pushed the fix/httpc-breaker branch 3 times, most recently from 7e52414 to 0c3229f Compare December 25, 2025 13:22
@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: kevin <wanjunfeng@gmail.com>
@kevwan kevwan merged commit fcec494 into zeromicro:master Dec 25, 2025
6 checks passed
@kevwan kevwan deleted the fix/httpc-breaker branch December 25, 2025 13:39
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.

1 participant