activerabbit-ai 0.3.0 โ†’ 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 635640bced6f6dbbb84db97da4c15dc7d56a57995b78b0154c458f700121e1c5
4
- data.tar.gz: 4502d4e93fc88d5ce85fd79e1f64841d68f2962d0d7562469ec486e5fe27067a
3
+ metadata.gz: 7140880a3f3d5d65a37a01fc85789c656911488e5106411c6777a4f2d24812a9
4
+ data.tar.gz: c429cfdda0f862d1c9ba81315451899115d58f82ec28d77a266b962029f22101
5
5
  SHA512:
6
- metadata.gz: d79097187018bb03b75480b276a3e9faa60e51cd85b2c976fd772cc314c20607b28a140fdf97714041f2370ade3e416e4f4a76f63ad654dc8a326b7429ee5000
7
- data.tar.gz: 3a1d63d4b6a015b486ff5ecb96246cef394989d33adb52f05b40e454aaa91af0f9738fb793c61cb8348c5773983b0eb7624d4c9b79da9c9425235c75924dcd24
6
+ metadata.gz: f0656be41868bb0acbbcd15d72cc8e09efc2ee63fb1671a6b71de083e0066bd7d28dc7b62cf67b31935a885fd604e6ff8b0b25e66b46eff3beb020d9726695f8
7
+ data.tar.gz: 513e482c93e2465fc7b275b6256ef40843cc6e0e9b0ae41a9bb4a118fe20aed5d7367c13925ac17efc7350595edfd3d8a8307baa55d3c5d37ebf266ef2aced48
data/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] - 2025-01-03
11
+
12
+ ### ๐Ÿงช Added Comprehensive Test Suite
13
+
14
+ ### Added
15
+ - **Complete RSpec Test Suite**: 73 comprehensive tests covering all functionality
16
+ - **HTTP Client Tests**: Full test coverage for the new Net::HTTP implementation
17
+ - **WebMock Integration**: Reliable HTTP request mocking for consistent testing
18
+ - **Error Scenario Testing**: Network failures, timeouts, and API error simulation
19
+ - **Retry Logic Testing**: Validates exponential backoff and max retry behavior
20
+ - **Concurrent Testing**: Thread safety and batch processing validation
21
+ - **Configuration Testing**: Comprehensive validation of all configuration options
22
+
23
+ ### Improved
24
+ - **Test Coverage**: 100% coverage of core HTTP client functionality
25
+ - **Quality Assurance**: All 73 tests passing with zero failures
26
+ - **Development Experience**: Easy test running with `bundle exec rspec`
27
+ - **Reliability**: Validated Net::HTTP implementation with comprehensive edge case testing
28
+
29
+ ### Technical Details
30
+ - Tests validate all HTTP methods (GET, POST, PUT, DELETE)
31
+ - SSL/HTTPS handling verification
32
+ - JSON request/response processing tests
33
+ - Rate limit detection and handling tests
34
+ - Background queue management and batch processing tests
35
+ - Graceful error handling and recovery tests
36
+
37
+ This release ensures the Net::HTTP implementation is thoroughly tested and production-ready.
38
+
10
39
  ## [0.3.0] - 2025-01-03
11
40
 
12
41
  ### ๐Ÿš€ Major HTTP Client Rewrite - Eliminated Faraday Dependency
@@ -17,7 +46,7 @@ This release completely replaces Faraday with pure Net::HTTP, eliminating depend
17
46
  - **Faraday Dependencies**: Completely removed `faraday` and `faraday-retry` dependencies
18
47
  - **Dependency Complexity**: No more version conflicts with other gems using Faraday
19
48
 
20
- ### Added
49
+ ### Added
21
50
  - **Pure Net::HTTP Implementation**: Lightweight, zero-dependency HTTP client
22
51
  - **Built-in Retry Logic**: Exponential backoff retry mechanism with configurable attempts
23
52
  - **SSL Support**: Automatic HTTPS handling with proper SSL verification
@@ -26,7 +55,7 @@ This release completely replaces Faraday with pure Net::HTTP, eliminating depend
26
55
  - **Rate Limit Detection**: Proper 429 status code handling
27
56
 
28
57
  ### Improved
29
- - **Performance**: Faster startup and lower memory usage without Faraday overhead
58
+ - **Performance**: Faster startup and lower memory usage without Faraday overhead
30
59
  - **Reliability**: Simplified HTTP stack reduces potential points of failure
31
60
  - **Maintainability**: Pure Ruby implementation easier to debug and maintain
32
61
  - **Compatibility**: No more conflicts with applications using different Faraday versions
@@ -108,7 +108,7 @@ module ActiveRabbit
108
108
 
109
109
  def make_request(method, path, data)
110
110
  uri = URI.join(@base_uri, path)
111
-
111
+
112
112
  # Retry logic with exponential backoff
113
113
  retries = 0
114
114
  max_retries = configuration.retry_count
@@ -116,7 +116,14 @@ module ActiveRabbit
116
116
  begin
117
117
  response = perform_request(uri, method, data)
118
118
  handle_response(response)
119
- rescue Net::TimeoutError, Net::OpenTimeout, Net::ReadTimeout => e
119
+ rescue RetryableError => e
120
+ if retries < max_retries
121
+ retries += 1
122
+ sleep(configuration.retry_delay * (2 ** (retries - 1)))
123
+ retry
124
+ end
125
+ raise APIError, e.message
126
+ rescue Net::OpenTimeout, Net::ReadTimeout => e
120
127
  if retries < max_retries && should_retry_error?(e)
121
128
  retries += 1
122
129
  sleep(configuration.retry_delay * (2 ** (retries - 1))) # Exponential backoff
@@ -130,6 +137,9 @@ module ActiveRabbit
130
137
  retry
131
138
  end
132
139
  raise APIError, "Connection failed after #{retries} retries: #{e.message}"
140
+ rescue APIError, RateLimitError => e
141
+ # Re-raise API errors as-is
142
+ raise e
133
143
  rescue => e
134
144
  raise APIError, "Request failed: #{e.message}"
135
145
  end
@@ -137,17 +147,17 @@ module ActiveRabbit
137
147
 
138
148
  def perform_request(uri, method, data)
139
149
  http = Net::HTTP.new(uri.host, uri.port)
140
-
150
+
141
151
  # Configure SSL if HTTPS
142
152
  if uri.scheme == 'https'
143
153
  http.use_ssl = true
144
154
  http.verify_mode = OpenSSL::SSL::VERIFY_PEER
145
155
  end
146
-
156
+
147
157
  # Set timeouts
148
158
  http.open_timeout = configuration.open_timeout
149
159
  http.read_timeout = configuration.timeout
150
-
160
+
151
161
  # Create request
152
162
  request = case method.to_s.downcase
153
163
  when 'post'
@@ -161,22 +171,22 @@ module ActiveRabbit
161
171
  else
162
172
  raise ArgumentError, "Unsupported HTTP method: #{method}"
163
173
  end
164
-
174
+
165
175
  # Set headers
166
176
  request['Content-Type'] = 'application/json'
167
177
  request['Accept'] = 'application/json'
168
178
  request['User-Agent'] = "ActiveRabbit-Ruby/#{ActiveRabbit::Client::VERSION}"
169
179
  request['X-Project-Token'] = configuration.api_key
170
-
180
+
171
181
  if configuration.project_id
172
182
  request['X-Project-ID'] = configuration.project_id
173
183
  end
174
-
184
+
175
185
  # Set body for POST/PUT requests
176
186
  if data && %w[post put].include?(method.to_s.downcase)
177
187
  request.body = JSON.generate(data)
178
188
  end
179
-
189
+
180
190
  http.request(request)
181
191
  end
182
192
 
@@ -223,8 +233,7 @@ module ActiveRabbit
223
233
 
224
234
  def should_retry_error?(error)
225
235
  # Retry on network-level errors
226
- error.is_a?(Net::TimeoutError) ||
227
- error.is_a?(Net::OpenTimeout) ||
236
+ error.is_a?(Net::OpenTimeout) ||
228
237
  error.is_a?(Net::ReadTimeout) ||
229
238
  error.is_a?(Errno::ECONNREFUSED) ||
230
239
  error.is_a?(Errno::EHOSTUNREACH) ||
@@ -238,4 +247,4 @@ module ActiveRabbit
238
247
  end
239
248
 
240
249
  end
241
- end
250
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveRabbit
4
4
  module Client
5
- VERSION = "0.3.0"
5
+ VERSION = "0.3.1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerabbit-ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Shapalov