Skip to content

Commit 4e7f60f

Browse files
committed
CI fixes
1 parent 0f03ad4 commit 4e7f60f

33 files changed

+127
-76
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,6 @@ jobs:
7373
7474
- name: Lint, compile, test Ruby
7575
working-directory: ./temporalio
76+
# Timeout just in case there's a hanging part in rake
77+
timeout-minutes: 20
7678
run: bundle exec rake TESTOPTS="--verbose"

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<div style="overflow: hidden"><img src="https://raw.githubusercontent.com/temporalio/assets/main/files/w/ruby.png" alt="Temporal Ruby SDK" /></div>
22

3-
![Ruby 3.1 | 3.2 | 3.3 | 3.4](https://img.shields.io/badge/ruby-3.1%20%7C%203.2%20%7C%203.3-blue.svg?style=for-the-badge)
3+
![Ruby 3.1 | 3.2 | 3.3](https://img.shields.io/badge/ruby-3.1%20%7C%203.2%20%7C%203.3-blue.svg?style=for-the-badge)
44
[![MIT](https://img.shields.io/github/license/temporalio/sdk-ruby.svg?style=for-the-badge)](LICENSE)
55
[![Gem](https://img.shields.io/gem/v/temporalio?style=for-the-badge)](https://rubygems.org/gems/temporalio)
66

@@ -29,15 +29,32 @@ until the SDK is marked stable.
2929

3030
- [Quick Start](#quick-start)
3131
- [Installation](#installation)
32-
- [Implementing an Activity](#implementing-an-activity)
33-
- [Running a Workflow](#running-a-workflow)
32+
- [Implementing a Workflow and Activity](#implementing-a-workflow-and-activity)
33+
- [Running a Worker](#running-a-worker)
34+
- [Executing a Workflow](#executing-a-workflow)
3435
- [Usage](#usage)
3536
- [Client](#client)
3637
- [Cloud Client Using mTLS](#cloud-client-using-mtls)
38+
- [Cloud Client Using API Key](#cloud-client-using-api-key)
3739
- [Data Conversion](#data-conversion)
3840
- [ActiveRecord and ActiveModel](#activerecord-and-activemodel)
3941
- [Workers](#workers)
4042
- [Workflows](#workflows)
43+
- [Workflow Definition](#workflow-definition)
44+
- [Running Workflows](#running-workflows)
45+
- [Invoking Activities](#invoking-activities)
46+
- [Invoking Child Workflows](#invoking-child-workflows)
47+
- [Timers and Conditions](#timers-and-conditions)
48+
- [Workflow Task Scheduling and Cancellation](#workflow-task-scheduling-and-cancellation)
49+
- [Workflow Futures](#workflow-futures)
50+
- [Workflow Utilities](#workflow-utilities)
51+
- [Workflow Exceptions](#workflow-exceptions)
52+
- [Workflow Logic Constraints](#workflow-logic-constraints)
53+
- [Workflow Testing](#workflow-testing)
54+
- [Automatic Time Skipping](#automatic-time-skipping)
55+
- [Manual Time Skipping](#manual-time-skipping)
56+
- [Mocking Activities](#mocking-activities)
57+
- [Workflow Replay](#workflow-replay)
4158
- [Activities](#activities)
4259
- [Activity Definition](#activity-definition)
4360
- [Activity Context](#activity-context)
@@ -59,6 +76,8 @@ until the SDK is marked stable.
5976

6077
### Installation
6178

79+
The Ruby SDK works with Ruby 3.1, 3.2, and 3.3. 3.4 support will be added soon, and 3.1 support will be dropped soon.
80+
6281
Can require in a Gemfile like:
6382

6483
```

temporalio/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ group :development do
1717
gem 'rbs', '~> 3.5.3'
1818
gem 'rb_sys', '~> 0.9.63'
1919
gem 'rubocop'
20-
gem 'sqlite3', '~> 1.4'
20+
gem 'sqlite3'
2121
gem 'steep', '~> 1.7.1'
2222
gem 'yard'
2323
end

temporalio/lib/temporalio/client/schedule.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,8 @@ def initialize(raw_info)
958958

959959
State = Struct.new(
960960
:note,
961-
:paused
961+
:paused,
962+
keyword_init: true
962963
)
963964

964965
# State of a listed schedule.

temporalio/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,31 +33,45 @@ def self.frozen_validated_illegal_calls(illegal_calls)
3333
end.freeze
3434
end
3535

36-
# Illegal calls are Hash[String, Hash[Symbol, Bool]]
36+
# Illegal calls are Hash[String, :all | Hash[Symbol, Bool]]
3737
def initialize(illegal_calls)
3838
@tracepoint = TracePoint.new(:call, :c_call) do |tp|
3939
cls = tp.defined_class
4040
next unless cls.is_a?(Module)
4141

42-
# We need this to be quick so we don't do extra validations to satisfy type checker
43-
# steep:ignore:start
44-
if cls.singleton_class?
45-
cls = cls.attached_object
46-
next unless cls.is_a?(Module)
47-
end
48-
vals = illegal_calls[cls.name]
49-
if vals == :all || vals&.[](tp.callee_id)
42+
# Extract the class name from the defined class. This is more difficult than it seems because you have to
43+
# resolve the attached object of the singleton class. But in older Ruby (at least <= 3.1), the singleton
44+
# class of things like `Date` does not have `attached_object` so you have to fall back in these rare cases
45+
# to parsing the string output. Reaching the string parsing component is rare, so this should not have
46+
# significant performance impact.
47+
cls_name = if cls.singleton_class?
48+
if cls.respond_to?(:attached_object)
49+
cls = cls.attached_object # steep:ignore
50+
next unless cls.is_a?(Module)
51+
52+
cls.name.to_s
53+
else
54+
cls.to_s.delete_prefix('#<Class:').delete_suffix('>')
55+
end
56+
else
57+
cls.name.to_s
58+
end
59+
60+
# Check if the call is considered illegal
61+
vals = illegal_calls[cls_name]
62+
if vals == :all || vals&.[](tp.callee_id) # steep:ignore
5063
raise Workflow::NondeterminismError,
51-
"Cannot access #{cls.name} #{tp.callee_id} from inside a " \
64+
"Cannot access #{cls_name} #{tp.callee_id} from inside a " \
5265
'workflow. If this is known to be safe, the code can be run in ' \
5366
'a Temporalio::Workflow::Unsafe.illegal_call_tracing_disabled block.'
5467
end
55-
# steep:ignore:end
5668
end
5769
end
5870

5971
def enable(&)
60-
@tracepoint.enable(&)
72+
# Setting current thread explicitly because it wasn't until Ruby 3.2 that this
73+
# was done automatically, ref https://github.com/ruby/ruby/pull/5359
74+
@tracepoint.enable(target_thread: Thread.current, &)
6175
end
6276

6377
def disable(&)

temporalio/lib/temporalio/worker/interceptor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ def handle_update(input)
273273
SleepInput = Struct.new(
274274
:duration,
275275
:summary,
276-
:cancellation
276+
:cancellation,
277+
keyword_init: true
277278
)
278279

279280
# Input for {Outbound.start_child_workflow}.

temporalio/lib/temporalio/workflow/info.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class Info
7474
ParentInfo = Struct.new(
7575
:namespace,
7676
:run_id,
77-
:workflow_id
77+
:workflow_id,
78+
keyword_init: true
7879
)
7980
end
8081
end

temporalio/test/api/payload_visitor_test.rb

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

33
require 'temporalio/api/payload_visitor'
4-
require 'test_base'
4+
require 'test'
55

66
module Api
7-
class PayloadVisitorTest < TestBase
7+
class PayloadVisitorTest < Test
88
def test_basics
99
# Make protos that have:
1010
# * single payload

temporalio/test/cancellation_test.rb

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

33
require 'temporalio/cancellation'
4-
require 'test_base'
4+
require 'test'
55

6-
class CancellationTest < TestBase
6+
class CancellationTest < Test
77
also_run_all_tests_in_fiber
88

99
def test_simple_cancellation

temporalio/test/client_schedule_test.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
require 'temporalio/client'
55
require 'temporalio/client/schedule'
66
require 'temporalio/testing'
7-
require 'test_base'
7+
require 'test'
88

9-
class ClientScheduleTest < TestBase
9+
class ClientScheduleTest < Test
1010
also_run_all_tests_in_fiber
1111

1212
def test_basics # rubocop:disable Metrics/AbcSize,Metrics/MethodLength

0 commit comments

Comments
 (0)