Skip to content

Commit fa7351f

Browse files
cardmagicclaude
andcommitted
fix: keep accepting an adapter without watch
The new configuration check required `watch`, but four runtime roles ask `respond_to?(:watch)` before they use it, and ADR 0011 records that an older adapter without it keeps the fast polling cadence. A supported adapter would have failed at boot. The check requires `signal` and `wait`, which every role calls without asking. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent fcddaa7 commit fa7351f

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

‎lib/solid_objects/configuration.rb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def validate_wake_up_adapter!
266266

267267
# @rbs () -> void
268268
def validate_wake_up_object!
269-
%i[signal wait watch].each do |method_name|
269+
%i[signal wait].each do |method_name|
270270
next if wake_up_adapter.respond_to?(method_name)
271271

272272
raise ArgumentError, "wake_up_adapter must respond to #{method_name}"

‎test/integration/wake_up_selection_test.rb‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,25 @@ def wait(timeout:) = false
131131
warnings.map { |payload| payload[:event].to_s }
132132
end
133133

134+
test "an adapter without watch is still accepted" do
135+
legacy = Class.new do
136+
def signal = true
137+
138+
def wait(timeout:) = false
139+
end.new
140+
SolidObjects.configuration.wake_up_adapter = legacy
141+
142+
assert_same SolidObjects.configuration, SolidObjects.configuration.validate!
143+
assert_same legacy, SolidObjects.wake_up
144+
end
145+
146+
test "an adapter that cannot signal is refused" do
147+
SolidObjects.configuration.wake_up_adapter = Object.new
148+
149+
error = assert_raises(ArgumentError) { SolidObjects.configuration.validate! }
150+
assert_match(/signal/, error.message)
151+
end
152+
134153
test "an unknown name is refused when the configuration is validated" do
135154
SolidObjects.configuration.wake_up_adapter = :carrier_pigeon
136155

0 commit comments

Comments
 (0)