Skip to content

Commit 5ab5285

Browse files
committed
Merge branch 'release/v5.7.0'
2 parents b8a84bd + b458d1c commit 5ab5285

121 files changed

Lines changed: 3199 additions & 2399 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ jobs:
1717
contents: read
1818
steps:
1919
- name: Harden the runner (Audit all outbound calls)
20-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
20+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
2121
with:
2222
egress-policy: audit
2323

2424
- name: Checkout code
25-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2626
- name: Standard Ruby
2727
uses: standardrb/standard-ruby-action@eecb3f730879f5b8830705348c2961e5aa26de78 # v1.5.0
2828
with:
@@ -53,15 +53,15 @@ jobs:
5353
- 6379:6379
5454
steps:
5555
- name: Harden the runner (Audit all outbound calls)
56-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
56+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
5757
with:
5858
egress-policy: audit
5959

6060
- name: Checkout code
61-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
61+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
6262

6363
- name: Set up Ruby
64-
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
64+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
6565
with:
6666
ruby-version: 3.3.4
6767
bundler-cache: true
@@ -101,15 +101,15 @@ jobs:
101101
- 6379:6379
102102
steps:
103103
- name: Harden the runner (Audit all outbound calls)
104-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
104+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
105105
with:
106106
egress-policy: audit
107107

108108
- name: Checkout code
109-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
109+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
110110

111111
- name: Set up Ruby
112-
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
112+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
113113
with:
114114
ruby-version: ${{ matrix.ruby }}
115115
bundler-cache: true
@@ -119,7 +119,7 @@ jobs:
119119
env:
120120
STOPLIGHT_REDIS_URL: 'redis://127.0.0.1:6379/0'
121121
- name: Coveralls
122-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # v2.3.6
122+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
123123
with:
124124
github-token: ${{ secrets.GITHUB_TOKEN }}
125125
flag-name: ruby-${{ matrix.ruby }}
@@ -131,12 +131,12 @@ jobs:
131131
runs-on: ubuntu-latest
132132
steps:
133133
- name: Harden the runner (Audit all outbound calls)
134-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
134+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
135135
with:
136136
egress-policy: audit
137137

138138
- name: Coveralls Finished
139-
uses: coverallsapp/github-action@648a8eb78e6d50909eff900e4ec85cab4524a45b # master
139+
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # master
140140
with:
141141
github-token: ${{ secrets.GITHUB_TOKEN }}
142142
parallel-finished: true

.github/workflows/dependency-review.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ jobs:
1717
runs-on: ubuntu-latest
1818
steps:
1919
- name: Harden the runner (Audit all outbound calls)
20-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
20+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
2121
with:
2222
egress-policy: audit
2323

2424
- name: 'Checkout Repository'
25-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2626
- name: 'Dependency Review'
27-
uses: actions/dependency-review-action@40c09b7dc99638e5ddb0bfd91c1673effc064d8a # v4.8.1
27+
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
version: ${{ steps.version.outputs.version }}
1919
steps:
2020
- name: Harden the runner (Audit all outbound calls)
21-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
21+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
2222
with:
2323
egress-policy: audit
2424

2525
- name: Checkout code
26-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
26+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
2727

2828
- name: Set up Ruby
29-
uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0
29+
uses: ruby/setup-ruby@8aeb6ff8030dd539317f8e1769a044873b56ea71 # v1.268.0
3030
with:
3131
bundler-cache: true
3232
ruby-version: ruby
@@ -49,15 +49,15 @@ jobs:
4949
contents: read
5050
steps:
5151
- name: Harden the runner (Audit all outbound calls)
52-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
52+
uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
5353
with:
5454
egress-policy: audit
5555

5656
- name: Checkout Repository
57-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
57+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
5858
- uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
5959
- name: Checkout release
60-
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
60+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
6161
with:
6262
ref: refs/tags/${{ needs.gem.outputs.version }}
6363
- name: Login to Docker Hub

Gemfile.lock

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
PATH
22
remote: .
33
specs:
4-
stoplight (5.6.0)
4+
stoplight (5.7.0)
5+
concurrent-ruby
56
zeitwerk
67

78
GEM
@@ -49,7 +50,7 @@ GEM
4950
concurrent-ruby (1.3.5)
5051
concurrent-ruby-ext (1.3.5)
5152
concurrent-ruby (= 1.3.5)
52-
connection_pool (2.5.4)
53+
connection_pool (2.5.5)
5354
crass (1.0.6)
5455
cucumber (10.1.1)
5556
base64 (~> 0.2)
@@ -97,7 +98,7 @@ GEM
9798
pp (>= 0.6.0)
9899
rdoc (>= 4.0.0)
99100
reline (>= 0.4.2)
100-
json (2.13.2)
101+
json (2.16.0)
101102
language_server-protocol (3.17.0.5)
102103
lint_roller (1.1.0)
103104
logger (1.7.0)
@@ -117,13 +118,13 @@ GEM
117118
mini_portile2 (~> 2.8.2)
118119
racc (~> 1.4)
119120
parallel (1.27.0)
120-
parser (3.3.9.0)
121+
parser (3.3.10.0)
121122
ast (~> 2.4.1)
122123
racc
123124
pp (0.6.2)
124125
prettyprint
125126
prettyprint (0.2.0)
126-
prism (1.5.1)
127+
prism (1.6.0)
127128
psych (5.2.6)
128129
date
129130
stringio
@@ -167,7 +168,7 @@ GEM
167168
redis-client (>= 0.22.0)
168169
redis-client (0.25.1)
169170
connection_pool
170-
regexp_parser (2.11.2)
171+
regexp_parser (2.11.3)
171172
reline (0.6.1)
172173
io-console (~> 0.5)
173174
rspec (3.13.2)
@@ -191,18 +192,18 @@ GEM
191192
rspec-mocks (~> 3.13)
192193
rspec-support (~> 3.13)
193194
rspec-support (3.13.6)
194-
rubocop (1.80.2)
195+
rubocop (1.81.7)
195196
json (~> 2.3)
196197
language_server-protocol (~> 3.17.0.2)
197198
lint_roller (~> 1.1.0)
198199
parallel (~> 1.10)
199200
parser (>= 3.3.0.2)
200201
rainbow (>= 2.2.2, < 4.0)
201202
regexp_parser (>= 2.9.3, < 3.0)
202-
rubocop-ast (>= 1.46.0, < 2.0)
203+
rubocop-ast (>= 1.47.1, < 2.0)
203204
ruby-progressbar (~> 1.7)
204205
unicode-display_width (>= 2.4.0, < 4.0)
205-
rubocop-ast (1.46.0)
206+
rubocop-ast (1.48.0)
206207
parser (>= 3.3.7.2)
207208
prism (~> 1.4)
208209
rubocop-performance (1.25.0)
@@ -234,10 +235,10 @@ GEM
234235
rack-protection (= 4.2.1)
235236
sinatra (= 4.2.1)
236237
tilt (~> 2.0)
237-
standard (1.51.1)
238+
standard (1.52.0)
238239
language_server-protocol (~> 3.17.0.2)
239240
lint_roller (~> 1.0)
240-
rubocop (~> 1.80.2)
241+
rubocop (~> 1.81.7)
241242
standard-custom (~> 1.0.0)
242243
standard-performance (~> 1.8)
243244
standard-custom (1.0.2)

docs/architecture.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,26 +309,26 @@ end
309309
**Contains:**
310310
- Dependency injection container
311311
- Factory classes for creating configured objects
312-
- Fail-safe wrappers for resilience
313312
- Public API composition
314313

315314
**Rules:**
316315
- Composes domain and infrastructure components
317-
- Provides fail-safe wrappers
318316
- Handles configuration and defaults
319317
- Should not contain business logic
320318
- Bridges between layers
321319

322320
Example:
321+
323322
```ruby
323+
324324
module Stoplight
325325
module Wiring
326326
# Compose dependencies
327327
class LightFactory
328328
def build_with(name:, data_store:, notifiers:, **config)
329-
safe_data_store = FailSafeDataStore.wrap(data_store)
330-
safe_notifiers = notifiers.map { FailSafeNotifier.wrap(_1) }
331-
329+
safe_data_store = DataStoreFactory.create(data_store)
330+
safe_notifiers = notifiers.map { NotifierFactory.create(_1) }
331+
332332
# Build domain object
333333
Domain::Light.new(
334334
config: Domain::Config.new(name:, **config),

lib/stoplight.rb

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@ def configure(trust_me_im_an_engineer: false)
5555
factory_builder = Wiring::DefaultFactoryBuilder.new
5656
yield factory_builder.configuration if block_given?
5757

58+
default_light_factory = factory_builder.build
59+
default_light_factory.validate_configuration!
5860
@default_configuration = factory_builder.configuration
59-
@default_light_factory = factory_builder.build
61+
@default_light_factory = default_light_factory
6062
end
6163
end
6264

@@ -67,7 +69,7 @@ def configure(trust_me_im_an_engineer: false)
6769
# @return [Stoplight::Light]
6870
# @api private
6971
def system_light(name, **settings)
70-
Wiring::SystemLightFactory.build_with(name: "__stoplight__#{name}", **settings)
72+
Wiring::LightFactory.new.with(name: "__stoplight__#{name}", **settings).build
7173
end
7274

7375
# Create a Light with the user default configuration.
@@ -121,7 +123,6 @@ def __stoplight__default_configuration
121123
# @param settings [Hash] Optional settings to configure the circuit breaker.
122124
# @option settings [Numeric] :cool_off_time The time to wait before resetting the circuit breaker.
123125
# @option settings [Stoplight::DataStore::Base] :data_store The data store to use for storing state.
124-
# @option settings [Proc] :error_notifier A proc to handle error notifications.
125126
# @option settings [Array<Stoplight::Notifier::Base>] :notifiers A list of notifiers to use.
126127
# @option settings [Numeric] :threshold The failure threshold to trip the circuit breaker.
127128
# @option settings [Numeric] :window_size The size of the rolling window for failure tracking.
@@ -161,5 +162,19 @@ def __stoplight__default_configuration
161162
# light = Stoplight("Payment API", traffic_control: :error_rate, threshold: 0.666, window_size: 300)
162163
#
163164
def Stoplight(name, **settings) # rubocop:disable Naming/MethodName
165+
Stoplight::Common::Deprecations.deprecate(<<~MSG) if settings.include?(:error_notifier)
166+
Passing "error_notifier" to Stoplight('#{name}') is deprecated and will be removed in v6.0.0.
167+
168+
IMPORTANT: The `error_notifier` is NOT called for exceptions in your protected code.
169+
It only reports internal Stoplight failures (e.g., Redis connection errors).
170+
171+
To fix: Move `error_notifier` to global configuration:
172+
173+
Stoplight.configure do |config|
174+
config.error_notifier = ->(error) { Logger.warn(error) }
175+
end
176+
177+
See: https://github.com/bolshakov/stoplight#error-notifiers
178+
MSG
164179
Stoplight.light(name, **settings)
165180
end

lib/stoplight/admin.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# frozen_string_literal: true
22

3-
require "cgi" # Ruby 3.2 needs this
3+
require "cgi/escape"
4+
require "cgi/util" if RUBY_VERSION < "3.5"
45

56
begin
67
require "sinatra/base"

lib/stoplight/admin/dependencies.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Dependencies
88
attr_reader :data_store
99
private :data_store
1010

11-
# @param data_store [Stoplight::DataStore::Base]
11+
# @param data_store [Stoplight::Domain::DataStore]
1212
def initialize(data_store:)
1313
@data_store = data_store
1414
end

lib/stoplight/admin/helpers.rb

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,16 @@ def dependencies
1515
end
1616

1717
private def data_store
18-
settings.data_store.tap do |data_store|
19-
if data_store.is_a?(Stoplight::DataStore::Memory)
20-
raise "Stoplight Admin requires a persistent data store, but the current data store is Memory. " \
21-
"Please configure a different data store in your Stoplight configuration."
22-
end
18+
if settings.data_store.is_a?(Stoplight::DataStore::Memory)
19+
raise "Stoplight Admin requires a persistent data store, but the current data store is Memory. " \
20+
"Please configure a different data store in your Stoplight configuration."
21+
else
22+
Stoplight::Wiring::LightBuilder.new(
23+
{
24+
data_store: settings.data_store,
25+
config: Wiring::Light::DefaultConfig
26+
}
27+
).__send__(:data_store)
2328
end
2429
end
2530
end

0 commit comments

Comments
 (0)