standard_id-void_which_binds 0.1.0 → 0.2.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: 7c4ca3cfd0bcc41671df6b1b7111c11809b980b38a2727373eed9aa513fb1f03
4
- data.tar.gz: 609865c1ec30ded67ab01965edb5e925fe5c50df750a6826c2ea2207fa31a6e2
3
+ metadata.gz: e27ba930c915026efe4c34a5302de5a67e7c3f5172eb7044789ee34a2046ae4b
4
+ data.tar.gz: 7f63e072d8ce643c3a1c70f50ae9103f668b867eb69d1c340c30abd8b6877805
5
5
  SHA512:
6
- metadata.gz: 00f4d1d658c20414416cd2f20f3613215da6d2e8995ec112275c936fcfcbe10f2b864a2d54113cd6ff926aa57a75ca72a713271adcccc996b5fbf1038db930ea
7
- data.tar.gz: c8a3c613b8b0fc5110f68fc6bf4b1368156e40b9f285ee9a01ca994507bf3165ffca6d139d425fbb4d343836f07b8cab2143e4b2fbb741025af7ebeb0383915e
6
+ metadata.gz: ee38b915665f0c775ac6ba3518f4ba66607a96efd97b0a1cec7944b1791deefe7ca643d0e5ee9360ac1f53c7de42251e8bc3262bf7c5d71307397b9e2997d7b8
7
+ data.tar.gz: b8544f61a59c408f104afef4ce8823b0a1aed820ec0b4762c8b0cfbaf525502f2e5ca107cbb18117cc68c49dccd8210ed501e3cb784be1fc248e2a549adc6b7a
data/CHANGELOG.md CHANGED
@@ -7,6 +7,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.2.0] - 2026-11-25
11
+
12
+ ### Fixed
13
+
14
+ - **A refusal by the host's `network_wrapper` (an open circuit) no longer turns sign-in into a
15
+ 500.** On a standard_id with `StandardId::NetworkWrapper` (rarebit-one/standard_id#480), broker
16
+ requests run through it, so a refusal by the wrapper itself comes back as core's
17
+ `StandardId::ProviderUnavailableError`. `Http.perform` lets it through, renamed "Void-Which-Binds
18
+ is temporarily unavailable" (the refusal as `cause`), instead of wrapping it in
19
+ `BrokerUnavailable`. Sign-in (web only for this provider) then takes core's path: back to the
20
+ login page with that message. The SET endpoint answers it with 500 (which
21
+ moneta retries), logged as an outage and not reported as an error. Transport errors still
22
+ become `BrokerUnavailable`, and programming errors in the wrapper pass through unchanged. On
23
+ older standard_id releases the wrapper is still called directly and its own error propagates
24
+ as is; the `~> 0.46` requirement is unchanged. The mapping is feature-detected and takes effect
25
+ with standard_id >= 0.63.0.
26
+
10
27
  ## [0.1.0] - 2026-11-23
11
28
 
12
29
  ### Added
@@ -127,6 +127,11 @@ module StandardId
127
127
  http.open_timeout = OPEN_TIMEOUT
128
128
  http.read_timeout = READ_TIMEOUT
129
129
  with_network_wrapper { http.start { |h| h.request(request) } }
130
+ rescue *provider_unavailable_errors => e
131
+ # The host's wrapper refused the request (an open circuit): core's own
132
+ # error, so sign-in takes core's "temporarily unavailable" path.
133
+ # Re-raised under this provider's name, the refusal as `cause`.
134
+ raise e.class.new("Void-Which-Binds is temporarily unavailable", provider: PROVIDER)
130
135
  rescue Timeout::Error, SystemCallError, SocketError, IOError, OpenSSL::SSL::SSLError, Net::HTTPBadResponse,
131
136
  Net::ProtocolError => e
132
137
  raise BrokerUnavailable, "#{uri.host} is unreachable (#{e.class})"
@@ -134,17 +139,30 @@ module StandardId
134
139
 
135
140
  # Runs the request through the host's `StandardId.config.network_wrapper`
136
141
  # (standard_id releases after 0.60.0; e.g. a circuit breaker), given
137
- # `provider: :void_which_binds`, or directly when there is none. On an
138
- # older standard_id the setting does not exist and reading it returns
139
- # nil. A transport error raised inside the wrapper still becomes
140
- # BrokerUnavailable; an error the wrapper raises itself is the host's
141
- # and propagates as is.
142
+ # `provider: :void_which_binds`, or directly when there is none. A
143
+ # transport error raised inside the wrapper still becomes
144
+ # BrokerUnavailable.
145
+ #
146
+ # standard_id releases with StandardId::NetworkWrapper run it there, and
147
+ # a refusal by the wrapper itself (an open circuit) comes back as
148
+ # StandardId::ProviderUnavailableError, which `perform` lets through.
149
+ # Older releases with the setting call the wrapper here, and its own
150
+ # error propagates as is; before 0.61 the setting does not exist and
151
+ # reading it returns nil.
142
152
  def with_network_wrapper(&block)
153
+ return StandardId::NetworkWrapper.run(provider: PROVIDER, &block) if defined?(StandardId::NetworkWrapper)
154
+
143
155
  wrapper = StandardId.config.network_wrapper
144
156
  return yield unless wrapper.respond_to?(:call)
145
157
 
146
158
  wrapper.call(**StandardId::Utils::CallableParameterFilter.filter(wrapper, { provider: PROVIDER }), &block)
147
159
  end
160
+
161
+ # StandardId::ProviderUnavailableError where standard_id has it, else
162
+ # nothing (a `rescue *[]` matches nothing).
163
+ def provider_unavailable_errors
164
+ defined?(StandardId::ProviderUnavailableError) ? [StandardId::ProviderUnavailableError] : []
165
+ end
148
166
  end
149
167
 
150
168
  # The provider's view of moneta: its endpoints (configured, or from
@@ -52,6 +52,11 @@ module StandardId
52
52
  rescue ConfigurationError => e
53
53
  log(:error, "misconfigured: #{e.message}")
54
54
  [500, {}, []]
55
+ rescue *Http.provider_unavailable_errors => e
56
+ # The host's network_wrapper refused the JWKS fetch (an open circuit):
57
+ # an outage, not a bug, and moneta retries the 500.
58
+ log(:error, "moneta is unavailable: #{e.message}")
59
+ [500, {}, []]
55
60
  rescue ActiveRecord::ActiveRecordError => e
56
61
  # Nothing was committed (the event is applied in one transaction), so
57
62
  # moneta's retry of this 500 applies it in full.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module StandardId
4
4
  module VoidWhichBinds
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: standard_id-void_which_binds
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rarebit One