Problem: Testing Temporal Workflows with Signals in Ruby SDK Time-Skipping Environment
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Tái hiện quy trình trong Temporalio::Testing::WorkflowEnvironment.start_time_skipping bằng wait_condition, signal customer_replied và workflow_handle.result. Theo dõi cách việc phân phối signal và bỏ qua thời gian tiếp tục thực thi, sau đó so sánh hành vi của start_workflow và execute_workflow. Hoàn tất khi đã xác định được nguyên nhân và ghi lại một phương pháp kiểm thử đã được xác minh hoặc thay đổi SDK cần thiết.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem: Testing Temporal Workflows with Signals in Ruby SDK Time-Skipping Environment
Context
I'm testing a workflow in the Temporalio Ruby SDK that uses wait_condition to wait for signals. The workflow works correctly in production, but I cannot test the signal-driven continuation in the time-skipping test environment (Temporalio::Testing::WorkflowEnvironment.start_time_skipping).
Workflow Pattern (Simplified)
class PipelineExecutionWorkflow < Temporalio::Workflow
workflow_signal
def customer_replied
@customer_replied = true
end
def execute(opportunity_id, pipeline_id)
# Step 1: Send initial email
send_email_activity(opportunity_id)
# Step 2: Wait for customer reply signal
Temporalio::Workflow.timeout(48.hours) do
Temporalio::Workflow.wait_condition { @customer_replied }
end
# Step 3: Process customer reply (extract data, send AI response)
if @customer_replied
extract_and_respond(opportunity_id)
end
{ "success" => true }
end
end
What I've Tried in Tests
Temporalio::Testing::WorkflowEnvironment.start_time_skipping do |env|
worker = Temporalio::Worker.new(
client: env.client,
task_queue: "test-queue",
workflows: [PipelineExecutionWorkflow],
activities: [SendEmailActivity, ExtractActivity]
)
worker.run do
# Start workflow (doesn't wait for completion)
workflow_handle = env.client.start_workflow(
PipelineExecutionWorkflow,
opportunity_id,
pipeline_id,
id: "test-pipeline-#{opportunity_id}",
task_queue: "test-queue"
)
# Give time for initial email to be sent
sleep 0.5
# Check workflow state - shows it's waiting
state = workflow_handle.query("get_state")
# => {"waiting_for_signal" => true, "customer_replied" => false}
# Send the signal
workflow_handle.signal("customer_replied")
# Check state again - signal was received!
state_after = workflow_handle.query("get_state")
# => {"waiting_for_signal" => false, "customer_replied" => true}
# But when I try to get the result, it times out or returns nil
result = workflow_handle.result # ← TIMES OUT or returns nil
# The workflow doesn't continue executing after receiving the signal
end
end
Observed Behavior
- ✅ Workflow starts successfully
- ✅ Initial email activity executes
- ✅ Workflow enters wait state (
wait_condition) - ✅ Signal is received (verified via query -
@customer_repliedbecomestrue) - ❌ Workflow doesn't continue execution after signal received
- ❌
workflow_handle.resulttimes out or workflow appears "stuck"
Questions
With the Temporal Ruby SDK source code available:
-
Is this a known limitation of the time-skipping test environment with
wait_conditionand signals? -
What is the correct way to test workflows that use
wait_conditionwith signals in the time-skipping environment? -
Should I use a different testing approach for signal-driven workflows? (e.g., real Temporal server, different test helper methods)
-
Is there a way to manually advance time or "wake up" the workflow after sending a signal in the test environment?
-
Are there any special considerations or setup required for testing signal-driven workflows that use
wait_condition?
Additional Context
- Ruby SDK version: 1.0.0 (from Gemfile)
- The workflow works perfectly in production with real Temporal server
- Synchronous workflows (without signals/wait) test fine in time-skipping environment
- I've tried both
start_workflow(non-blocking) andexecute_workflow(blocking) - neither works for the signal continuation
- Ngôn ngữ chính
- Ruby
- Star
- 206
- Fork
- 42
- Merge trung bình
- 1 ngày 48 phút
- Pull request đã merge (30 ngày)
- 16
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của temporalio/sdk-ruby
-
[Bug] Fiber activity executor: cancelling an activity permanently strands the poller under a fiber schedulerCó thể đã có người làm @GregoryTravis đã nhận 18 ngày trước. Đang mở
temporalio/sdk-ruby#570 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feature Request] Add thread lifecycle hook to `Worker::ThreadPool`Có thể làm lại được @GregoryTravis đã nhận 32 ngày trước và không có pull request nào đang mở. Đang mởenhancement
temporalio/sdk-ruby#563 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
[Feature Request] Implement operator commands for Standalone ActivitiesCó thể làm lại được @GregoryTravis đã nhận 82 ngày trước và không có pull request nào đang mở. Đang mởenhancement
temporalio/sdk-ruby#440 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
temporalio/sdk-ruby#401 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
temporalio/sdk-ruby#393 ·
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của temporalio/sdk-ruby
Issue tương tự
-
security
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mend: dependency security vulnerability
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
homebrew warningsĐang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
bradygaster/squad#2082 ·
Maintainer thường phản hồi trong vòng 1 ngày