barkibu-kb 0.31.0 → 1.0.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: 35bd731195eab428b21d95b6a7e8c84a78017d67089a90e99175eaaf3bfe9df8
4
- data.tar.gz: 7ee5422696a8e15488c30d93a1c26d853b151201cb3b85225a7f3f48c8d2baff
3
+ metadata.gz: 5eb3a704f422c511e2e30d584cd6a80a7d91a090cfa5452dd197e65496b52eee
4
+ data.tar.gz: 05d766aeca3b869601193bd1a6310ced1c07f96d6f24cd5424c290a33b1edaf9
5
5
  SHA512:
6
- metadata.gz: 239cf144f088a79e7b86b8f58f7429bc8021a2e4fcc011b8f54f3198d93f5bf4fe51c76bd1bed148c0ba6e915873becf7aa6ecaa0fd1a7a7e66e1a7d388f6a3b
7
- data.tar.gz: b8c68768c1a88591c7d3bcc372c283e920c6e609f3fef228d605375ddec05ed0cd5fdd52aa44a650d94518029cc629610b5cafb3b9ecd831740ee4eeda8c9be3
6
+ metadata.gz: 994f4d86e1c2d1aa40a173ed0b77a2fcff39cbfe1e0390c728f92887be3817e3851610f85796c24a61919c05789a718c3939ee965866a1fda2f72ed2e68492b1
7
+ data.tar.gz: c9de80ede2701f7e58bde7f803b473980383d6ec9ac3d8509f2fe0e74ff15a200e48025ecc2535bc7102b82f1199228806d1e1999de32745ae07123123cb7edd
@@ -15,7 +15,7 @@ jobs:
15
15
  git config user.name 'Barkibot'
16
16
  git config user.email 'dev+bot@barkibu.com'
17
17
  - name: Release Gem
18
- uses: discourse/publish-rubygems-action@v2
18
+ uses: discourse/publish-rubygems-action@v3
19
19
  env:
20
20
  GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
21
21
  RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
data/.gitignore CHANGED
@@ -20,3 +20,5 @@
20
20
  /.idea
21
21
  .env
22
22
  .claude/worktrees/
23
+
24
+ vendor/
data/CHANGELOG.md CHANGED
@@ -6,7 +6,20 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
8
  ## [unreleased]
9
- - See diff: https://github.com/barkibu/kb-ruby/compare/v0.31.0...HEAD
9
+ - See diff: https://github.com/barkibu/kb-ruby/compare/v1.0.0...HEAD
10
+
11
+ ## [1.0.0]
12
+ - [Breaking changes] Split the single global request timeout into per-phase budgets: `KB.config.request.connect_timeout` (default 1s, bounds TCP connect + TLS handshake), `write_timeout` (default 3s), `read_timeout` (default 5s). `KB.config.request.timeout` is removed — assigning it now raises `NoMethodError` at boot. Migration: a previous global `timeout` maps to `read_timeout` (e.g. `KB_REQUEST_TIMEOUT_SECONDS=12` → `read_timeout = 12`).
13
+ - [Breaking changes] Switch the HTTP adapter from http.rb (`faraday-http`) to Net::HTTP (`faraday-net_http`) — the stock adapter honours all three phase timeouts, aligns the KB client with the rest of our outbound HTTP, and opens a one-line upgrade path to `faraday-net_http_persistent` for connection reuse. Raw error classes change accordingly (`Net::OpenTimeout`/`Net::ReadTimeout`/`Net::WriteTimeout`/`Errno::*` instead of `HTTP::*`) — relevant to APM span queries on `error.type`.
14
+ - Faraday-level wrapping keeps the same three classes (`Faraday::TimeoutError`/`ConnectionFailed`/`SSLError`) with one movement between them: a connect/TLS-phase expiry now surfaces as `Faraday::ConnectionFailed` (was `Faraday::TimeoutError`), making `ConnectionFailed` cleanly mean "the request never got through the pipe".
15
+ - Net::HTTP's idempotent auto-retry stays disabled (`max_retries = 0`, enforced by the adapter and pinned by a spec) — no behaviour change vs. the previous no-retry client.
16
+ - There is no total request budget anymore; worst-case wall clock is the sum of the phase budgets rather than a single number.
17
+ - barkibu-kb-fake: disable Sinatra's host authorization (`set :host_authorization, permitted_hosts: []`). Sinatra >= 4.1 authorizes the Host header and, when it infers a development environment, only permits localhost-style hosts — rejecting requests to the stubbed KB host with `403 Host not permitted`. Permitting the host on the consumer side stops working with the net_http adapter, because WebMock intercepts before Net::HTTP adds the Host header, so the header is absent and can never match a permitted list. Consumers can drop their own `set :host_authorization` workarounds.
18
+
19
+ ## [0.32.0]
20
+ - Allow Ruby 3.3/3.4: raise `required_ruby_version` ceiling to `< 3.6` (floor stays `>= 2.6`)
21
+ - No runtime dependency changes — safe to take with a scoped conservative update (`bundle lock --update barkibu-kb barkibu-kb-fake --conservative`)
22
+ - Test-env only: add `base64`/`bigdecimal` dev dependencies and an `activesupport >= 7.1` floor (suite now also validated against ActiveSupport 8). Runtime constraints for consumers unchanged.
10
23
 
11
24
  ## [0.31.0]
12
25
  - Add `KB::Pet#pet_parent`, a memoized lookup via `PetParent.find`
data/Gemfile CHANGED
@@ -5,3 +5,5 @@ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in kb.gemspec
6
6
  gemspec name: 'barkibu-kb'
7
7
  gemspec name: 'barkibu-kb-fake', development_group: :fake
8
+
9
+ gem 'activesupport', '>= 7.1'
data/Gemfile.lock CHANGED
@@ -1,17 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- barkibu-kb (0.31.0)
4
+ barkibu-kb (1.0.0)
5
5
  activemodel (>= 4.0.2)
6
6
  activerecord
7
7
  activesupport (>= 3.0.0)
8
8
  dry-configurable (~> 0.9)
9
9
  faraday
10
- faraday-http
10
+ faraday-net_http (~> 1.0)
11
11
  faraday_middleware
12
12
  i18n
13
- barkibu-kb-fake (0.31.0)
14
- barkibu-kb (= 0.31.0)
13
+ barkibu-kb-fake (1.0.0)
14
+ barkibu-kb (= 1.0.0)
15
15
  countries
16
16
  sinatra
17
17
  webmock
@@ -19,29 +19,40 @@ PATH
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- activemodel (7.0.4.2)
23
- activesupport (= 7.0.4.2)
24
- activerecord (7.0.4.2)
25
- activemodel (= 7.0.4.2)
26
- activesupport (= 7.0.4.2)
27
- activesupport (7.0.4.2)
28
- concurrent-ruby (~> 1.0, >= 1.0.2)
22
+ activemodel (8.1.3)
23
+ activesupport (= 8.1.3)
24
+ activerecord (8.1.3)
25
+ activemodel (= 8.1.3)
26
+ activesupport (= 8.1.3)
27
+ timeout (>= 0.4.0)
28
+ activesupport (8.1.3)
29
+ base64
30
+ bigdecimal
31
+ concurrent-ruby (~> 1.0, >= 1.3.1)
32
+ connection_pool (>= 2.2.5)
33
+ drb
29
34
  i18n (>= 1.6, < 2)
35
+ json
36
+ logger (>= 1.4.2)
30
37
  minitest (>= 5.1)
31
- tzinfo (~> 2.0)
38
+ securerandom (>= 0.3)
39
+ tzinfo (~> 2.0, >= 2.0.5)
40
+ uri (>= 0.13.1)
32
41
  addressable (2.8.0)
33
42
  public_suffix (>= 2.0.2, < 5.0)
34
43
  ast (2.4.2)
44
+ base64 (0.3.0)
45
+ bigdecimal (4.1.2)
35
46
  byebug (11.1.3)
36
- concurrent-ruby (1.2.2)
47
+ concurrent-ruby (1.3.7)
48
+ connection_pool (3.0.2)
37
49
  countries (5.3.1)
38
50
  unaccent (~> 0.3)
39
51
  crack (0.4.5)
40
52
  rexml
41
53
  diff-lcs (1.4.4)
42
54
  docile (1.4.0)
43
- domain_name (0.5.20190701)
44
- unf (>= 0.0.5, < 1.0.0)
55
+ drb (2.2.3)
45
56
  dry-configurable (0.16.1)
46
57
  dry-core (~> 0.6)
47
58
  zeitwerk (~> 2.6)
@@ -63,9 +74,6 @@ GEM
63
74
  faraday-em_http (1.0.0)
64
75
  faraday-em_synchrony (1.0.0)
65
76
  faraday-excon (1.1.0)
66
- faraday-http (1.1.0)
67
- faraday (~> 1.0)
68
- http (>= 4.0, < 6)
69
77
  faraday-httpclient (1.0.1)
70
78
  faraday-multipart (1.0.4)
71
79
  multipart-post (~> 2)
@@ -76,25 +84,14 @@ GEM
76
84
  faraday-retry (1.0.3)
77
85
  faraday_middleware (1.2.0)
78
86
  faraday (~> 1.0)
79
- ffi (1.15.5)
80
- ffi-compiler (1.0.1)
81
- ffi (>= 1.0.0)
82
- rake
83
87
  hashdiff (1.0.1)
84
- http (5.1.1)
85
- addressable (~> 2.8)
86
- http-cookie (~> 1.0)
87
- http-form_data (~> 2.2)
88
- llhttp-ffi (~> 0.4.0)
89
- http-cookie (1.0.5)
90
- domain_name (~> 0.5)
91
- http-form_data (2.3.0)
92
- i18n (1.12.0)
88
+ i18n (1.15.2)
93
89
  concurrent-ruby (~> 1.0)
94
- llhttp-ffi (0.4.0)
95
- ffi-compiler (~> 1.0)
96
- rake (~> 13.0)
97
- minitest (5.18.0)
90
+ json (2.20.0)
91
+ logger (1.7.0)
92
+ minitest (6.0.6)
93
+ drb (~> 2.0)
94
+ prism (~> 1.5)
98
95
  multipart-post (2.3.0)
99
96
  mustermann (3.0.0)
100
97
  ruby2_keywords (~> 0.0.1)
@@ -102,6 +99,7 @@ GEM
102
99
  parser (3.3.0.5)
103
100
  ast (~> 2.4.1)
104
101
  racc
102
+ prism (1.9.0)
105
103
  public_suffix (4.0.7)
106
104
  racc (1.7.3)
107
105
  rack (2.2.6.3)
@@ -139,6 +137,7 @@ GEM
139
137
  rubocop (~> 1.19)
140
138
  ruby-progressbar (1.13.0)
141
139
  ruby2_keywords (0.0.5)
140
+ securerandom (0.4.1)
142
141
  simplecov (0.21.2)
143
142
  docile (~> 1.1)
144
143
  simplecov-html (~> 0.11)
@@ -151,13 +150,12 @@ GEM
151
150
  rack-protection (= 3.0.5)
152
151
  tilt (~> 2.0)
153
152
  tilt (2.1.0)
153
+ timeout (0.6.1)
154
154
  tzinfo (2.0.6)
155
155
  concurrent-ruby (~> 1.0)
156
156
  unaccent (0.4.0)
157
- unf (0.1.4)
158
- unf_ext
159
- unf_ext (0.0.8.2)
160
157
  unicode-display_width (2.5.0)
158
+ uri (1.1.1)
161
159
  webmock (3.14.0)
162
160
  addressable (>= 2.8.0)
163
161
  crack (>= 0.3.2)
@@ -168,8 +166,11 @@ PLATFORMS
168
166
  ruby
169
167
 
170
168
  DEPENDENCIES
169
+ activesupport (>= 7.1)
171
170
  barkibu-kb!
172
171
  barkibu-kb-fake!
172
+ base64
173
+ bigdecimal
173
174
  bundler
174
175
  byebug
175
176
  rake (>= 12.3.3)
data/README.md CHANGED
@@ -43,9 +43,18 @@ KB.config.log_level = :debugger # :info by default
43
43
  ```
44
44
 
45
45
  #### Request timeout configuration
46
+
47
+ Timeouts are per phase, and each phase fails with its own error class:
48
+ `connect_timeout` maps to Net::HTTP's `open_timeout`, bounding TCP connect plus
49
+ the TLS handshake (`Net::OpenTimeout`); `read_timeout` bounds the wait for the
50
+ response (`Net::ReadTimeout`); `write_timeout` bounds sending the request
51
+ (`Net::WriteTimeout`).
52
+
46
53
  ```ruby
47
54
  # config/initializers/kb_ruby.rb
48
- KB.config.request.timeout = 10 # 5 by default
55
+ KB.config.request.connect_timeout = 2 # 1 by default; TCP connect + TLS handshake
56
+ KB.config.request.write_timeout = 4 # 3 by default
57
+ KB.config.request.read_timeout = 10 # 5 by default
49
58
  ```
50
59
 
51
60
  ### Exposed Entities
@@ -32,7 +32,7 @@ Gem::Specification.new do |spec|
32
32
  spec.bindir = 'exe'
33
33
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
34
  spec.require_paths = ['lib']
35
- spec.required_ruby_version = '>= 2.6', '< 3.3'
35
+ spec.required_ruby_version = '>= 2.6', '< 3.6'
36
36
 
37
37
  spec.add_runtime_dependency 'barkibu-kb', KB::VERSION
38
38
  spec.add_runtime_dependency 'countries'
data/barkibu-kb.gemspec CHANGED
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.bindir = 'exe'
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ['lib']
37
- spec.required_ruby_version = '>= 2.6', '< 3.3'
37
+ spec.required_ruby_version = '>= 2.6', '< 3.6'
38
38
 
39
39
  spec.add_dependency 'dry-configurable', '~> 0.9'
40
40
  spec.add_development_dependency 'bundler'
@@ -44,12 +44,14 @@ Gem::Specification.new do |spec|
44
44
  spec.add_development_dependency 'rubocop'
45
45
  spec.add_development_dependency 'rubocop-rspec'
46
46
  spec.add_development_dependency 'simplecov'
47
+ spec.add_development_dependency 'base64'
48
+ spec.add_development_dependency 'bigdecimal'
47
49
  spec.add_development_dependency 'webmock'
48
50
  spec.add_runtime_dependency 'activemodel', '>= 4.0.2'
49
51
  spec.add_runtime_dependency 'activerecord'
50
52
  spec.add_runtime_dependency 'activesupport', '>= 3.0.0'
51
53
  spec.add_runtime_dependency 'faraday'
52
- spec.add_runtime_dependency 'faraday-http'
54
+ spec.add_runtime_dependency 'faraday-net_http', '~> 1.0'
53
55
  spec.add_runtime_dependency 'faraday_middleware'
54
56
  spec.add_runtime_dependency 'i18n'
55
57
  end
data/lib/barkibu-kb.rb CHANGED
@@ -5,7 +5,6 @@ require 'active_support'
5
5
  require 'active_support/core_ext/array'
6
6
  require 'faraday'
7
7
  require 'faraday_middleware'
8
- require 'faraday/http'
9
8
  require 'dry/configurable'
10
9
 
11
10
  module KB
@@ -19,7 +18,9 @@ module KB
19
18
  setting :log_level, default: :info
20
19
 
21
20
  setting :request do
22
- setting :timeout, default: 5
21
+ setting :connect_timeout, default: 1
22
+ setting :write_timeout, default: 3
23
+ setting :read_timeout, default: 5
23
24
  end
24
25
  end
25
26
 
data/lib/kb/client.rb CHANGED
@@ -74,9 +74,7 @@ module KB
74
74
  end
75
75
 
76
76
  def connection
77
- @connection ||= Faraday.new(url: base_url,
78
- headers: headers,
79
- request: { timeout: KB.config.request.timeout }) do |conn|
77
+ @connection ||= Faraday.new(url: base_url, headers: headers, request: request_timeouts) do |conn|
80
78
  conn.response :json
81
79
  conn.response :raise_error
82
80
  if KB.config.log_level == :debugger
@@ -84,8 +82,16 @@ module KB
84
82
  logger.filter(/(X-api-key:\s)("\w+")/, '\1[API_KEY_SCRUBBED]')
85
83
  end
86
84
  end
87
- conn.adapter :http
85
+ conn.adapter :net_http
88
86
  end
89
87
  end
88
+
89
+ def request_timeouts
90
+ {
91
+ open_timeout: KB.config.request.connect_timeout,
92
+ write_timeout: KB.config.request.write_timeout,
93
+ read_timeout: KB.config.request.read_timeout
94
+ }
95
+ end
90
96
  end
91
97
  end
data/lib/kb/fake/api.rb CHANGED
@@ -44,6 +44,16 @@ module KB
44
44
  include BoundedContext::PetFamily::PetContracts
45
45
  include BoundedContext::PetFamily::Products
46
46
 
47
+ # Sinatra >= 4.1 ships Rack::Protection::HostAuthorization, which authorizes
48
+ # on the Host header and, when it infers a development environment, only
49
+ # permits localhost-style hosts — rejecting requests addressed to the
50
+ # stubbed KB host with "403 Host not permitted". Permitting specific hosts
51
+ # on the consumer side is no fix either: with the net_http adapter WebMock
52
+ # intercepts before Net::HTTP adds the Host header, so the header is absent
53
+ # and can never match a permitted list. An empty list disables the check;
54
+ # it guards against DNS rebinding, which cannot apply to an in-process fake.
55
+ set :host_authorization, permitted_hosts: []
56
+
47
57
  set :state, ApiState.new
48
58
 
49
59
  def self.snapshot
data/lib/kb/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module KB
2
- VERSION = '0.31.0'.freeze
2
+ VERSION = '1.0.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: barkibu-kb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.31.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Léo Figea
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-07-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dry-configurable
@@ -122,6 +121,34 @@ dependencies:
122
121
  - - ">="
123
122
  - !ruby/object:Gem::Version
124
123
  version: '0'
124
+ - !ruby/object:Gem::Dependency
125
+ name: base64
126
+ requirement: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: bigdecimal
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - ">="
150
+ - !ruby/object:Gem::Version
151
+ version: '0'
125
152
  - !ruby/object:Gem::Dependency
126
153
  name: webmock
127
154
  requirement: !ruby/object:Gem::Requirement
@@ -193,19 +220,19 @@ dependencies:
193
220
  - !ruby/object:Gem::Version
194
221
  version: '0'
195
222
  - !ruby/object:Gem::Dependency
196
- name: faraday-http
223
+ name: faraday-net_http
197
224
  requirement: !ruby/object:Gem::Requirement
198
225
  requirements:
199
- - - ">="
226
+ - - "~>"
200
227
  - !ruby/object:Gem::Version
201
- version: '0'
228
+ version: '1.0'
202
229
  type: :runtime
203
230
  prerelease: false
204
231
  version_requirements: !ruby/object:Gem::Requirement
205
232
  requirements:
206
- - - ">="
233
+ - - "~>"
207
234
  - !ruby/object:Gem::Version
208
- version: '0'
235
+ version: '1.0'
209
236
  - !ruby/object:Gem::Dependency
210
237
  name: faraday_middleware
211
238
  requirement: !ruby/object:Gem::Requirement
@@ -321,7 +348,6 @@ licenses:
321
348
  - MIT
322
349
  metadata:
323
350
  homepage_uri: https://app.barkibu.com
324
- post_install_message:
325
351
  rdoc_options: []
326
352
  require_paths:
327
353
  - lib
@@ -332,15 +358,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
358
  version: '2.6'
333
359
  - - "<"
334
360
  - !ruby/object:Gem::Version
335
- version: '3.3'
361
+ version: '3.6'
336
362
  required_rubygems_version: !ruby/object:Gem::Requirement
337
363
  requirements:
338
364
  - - ">="
339
365
  - !ruby/object:Gem::Version
340
366
  version: '0'
341
367
  requirements: []
342
- rubygems_version: 3.1.6
343
- signing_key:
368
+ rubygems_version: 3.6.9
344
369
  specification_version: 4
345
370
  summary: Barkibu's Knowledge Base API sdk
346
371
  test_files: []