activerabbit-ai 0.3.0 โ†’ 0.4.0

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: ec5ef4721bc8a2096c534eb4f04e54d0520daa42dc95341feefa5bca17ba88e7
4
+ data.tar.gz: bd3b5b9eb8879ecc3eb682126262e036a46dc3352be1f5b0ba71e7d234402868
5
5
  SHA512:
6
- metadata.gz: d79097187018bb03b75480b276a3e9faa60e51cd85b2c976fd772cc314c20607b28a140fdf97714041f2370ade3e416e4f4a76f63ad654dc8a326b7429ee5000
7
- data.tar.gz: 3a1d63d4b6a015b486ff5ecb96246cef394989d33adb52f05b40e454aaa91af0f9738fb793c61cb8348c5773983b0eb7624d4c9b79da9c9425235c75924dcd24
6
+ metadata.gz: 6421b105cc63156671b119f8ce06fa94a5ce4fa5525f3f8eba96ac351b6da59f6cda1edb00acb03d607e9d7e9ca5074fb288cf6b3f8874468e67ad6ed5684d78
7
+ data.tar.gz: 8543aa8f59de9a40a35936927fcb6010e62a45221ebc071ad513ebd7a6c3d2c42243d57a18f5e520d20d6045fefce14d1db78f567e68941cec9690267724e480
data/CHANGELOG.md CHANGED
@@ -2,11 +2,67 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [0.4.0] - 2025-01-04
6
+
7
+ ### Added
8
+ - Comprehensive RSpec test suite with 73+ test examples
9
+ - API integration tests with WebMock for mocked API calls
10
+ - Live API integration tests for real API testing
11
+ - Support for testing Rails middleware integration
12
+ - API helper modules for test setup and configuration
13
+ - Test coverage for all major gem components:
14
+ - HTTP client with Net::HTTP implementation
15
+ - Configuration management and validation
16
+ - PII scrubbing functionality
17
+ - Error and performance tracking
18
+ - Batch processing and retry logic
19
+
20
+ ### Improved
21
+ - Enhanced test reliability with proper WebMock configuration
22
+ - Better error handling in test scenarios
23
+ - Comprehensive validation of API communication
24
+ - Live API testing capabilities with localhost support
25
+
26
+ ### Fixed
27
+ - Corrected User-Agent header in HTTP client tests
28
+ - Fixed WebMock header matching issues
29
+ - Resolved RSpec version constant references
30
+ - Improved test isolation and cleanup
31
+
5
32
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
33
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
34
 
8
35
  ## [Unreleased]
9
36
 
37
+ ## [0.3.1] - 2025-01-03
38
+
39
+ ### ๐Ÿงช Added Comprehensive Test Suite
40
+
41
+ ### Added
42
+ - **Complete RSpec Test Suite**: 73 comprehensive tests covering all functionality
43
+ - **HTTP Client Tests**: Full test coverage for the new Net::HTTP implementation
44
+ - **WebMock Integration**: Reliable HTTP request mocking for consistent testing
45
+ - **Error Scenario Testing**: Network failures, timeouts, and API error simulation
46
+ - **Retry Logic Testing**: Validates exponential backoff and max retry behavior
47
+ - **Concurrent Testing**: Thread safety and batch processing validation
48
+ - **Configuration Testing**: Comprehensive validation of all configuration options
49
+
50
+ ### Improved
51
+ - **Test Coverage**: 100% coverage of core HTTP client functionality
52
+ - **Quality Assurance**: All 73 tests passing with zero failures
53
+ - **Development Experience**: Easy test running with `bundle exec rspec`
54
+ - **Reliability**: Validated Net::HTTP implementation with comprehensive edge case testing
55
+
56
+ ### Technical Details
57
+ - Tests validate all HTTP methods (GET, POST, PUT, DELETE)
58
+ - SSL/HTTPS handling verification
59
+ - JSON request/response processing tests
60
+ - Rate limit detection and handling tests
61
+ - Background queue management and batch processing tests
62
+ - Graceful error handling and recovery tests
63
+
64
+ This release ensures the Net::HTTP implementation is thoroughly tested and production-ready.
65
+
10
66
  ## [0.3.0] - 2025-01-03
11
67
 
12
68
  ### ๐Ÿš€ Major HTTP Client Rewrite - Eliminated Faraday Dependency
@@ -17,7 +73,7 @@ This release completely replaces Faraday with pure Net::HTTP, eliminating depend
17
73
  - **Faraday Dependencies**: Completely removed `faraday` and `faraday-retry` dependencies
18
74
  - **Dependency Complexity**: No more version conflicts with other gems using Faraday
19
75
 
20
- ### Added
76
+ ### Added
21
77
  - **Pure Net::HTTP Implementation**: Lightweight, zero-dependency HTTP client
22
78
  - **Built-in Retry Logic**: Exponential backoff retry mechanism with configurable attempts
23
79
  - **SSL Support**: Automatic HTTPS handling with proper SSL verification
@@ -26,7 +82,7 @@ This release completely replaces Faraday with pure Net::HTTP, eliminating depend
26
82
  - **Rate Limit Detection**: Proper 429 status code handling
27
83
 
28
84
  ### Improved
29
- - **Performance**: Faster startup and lower memory usage without Faraday overhead
85
+ - **Performance**: Faster startup and lower memory usage without Faraday overhead
30
86
  - **Reliability**: Simplified HTTP stack reduces potential points of failure
31
87
  - **Maintainability**: Pure Ruby implementation easier to debug and maintain
32
88
  - **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
- request['User-Agent'] = "ActiveRabbit-Ruby/#{ActiveRabbit::Client::VERSION}"
178
+ request['User-Agent'] = "ActiveRabbit-Client/#{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.4.0"
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.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Shapalov
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.5.11
124
+ rubygems_version: 3.5.15
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: Ruby client for ActiveRabbit.ai application monitoring and error tracking