Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
3d3b077
Add sig/ to gemspec to ship RBS types with the gem
chris-olszewski Apr 1, 2026
00888be
Add tapioca baseline for RBI drift detection
chris-olszewski Apr 1, 2026
40d07d4
Add enriched RBI types for Sorbet users
chris-olszewski Apr 1, 2026
baf3b58
Fix RBI issues found during Sorbet validation
chris-olszewski Apr 2, 2026
7546739
Fix Workflow::Mutex/Queue/SizedQueue missing parent classes in RBI
chris-olszewski Apr 2, 2026
bb7c479
Add Api::Common::V1::Payload/Payloads stubs to RBI
chris-olszewski Apr 2, 2026
1d3a1ec
Add CI Sorbet type check for enriched RBI
chris-olszewski Apr 2, 2026
d718d5b
Document RBI maintenance workflow for SDK developers
chris-olszewski Apr 2, 2026
bf62128
fixup rbi
chris-olszewski Apr 2, 2026
7bbcba2
strip comments
chris-olszewski Apr 2, 2026
fa50b46
feat: add sorbet runtime check to tests
chris-olszewski Apr 6, 2026
48bdd9c
fixup type errors
chris-olszewski Apr 6, 2026
a27965f
test: run sorbet runtime typecheck in ci
chris-olszewski Apr 6, 2026
20a7d1c
chore: fix interceptor type errors
chris-olszewski Apr 6, 2026
8736675
fix(test): fix activity info test to avoid type error
chris-olszewski Apr 6, 2026
200d362
attempt to remove non-determism in type checking
chris-olszewski Apr 7, 2026
d5700fd
self review
chris-olszewski Apr 7, 2026
d03bb7b
include sig globally, support anon blocks
chris-olszewski Apr 8, 2026
65dac73
chore: add test to limit amount of untyped uses
chris-olszewski Apr 8, 2026
87d0601
first pass at removing untyped
chris-olszewski Apr 8, 2026
06ad883
type envconfig
chris-olszewski Apr 8, 2026
45a8824
split out grpc service rbi
chris-olszewski Apr 9, 2026
4cdb6df
fail on uninstrumented methods
chris-olszewski Apr 9, 2026
afdafd2
increase coverage
chris-olszewski Apr 9, 2026
e730ecc
remove sorbet_check
chris-olszewski May 28, 2026
b7eecf8
update rbi with new API surface
chris-olszewski May 29, 2026
108380e
intial rewrite to use sorbet internals
chris-olszewski May 29, 2026
cd3758a
add tests for method cleanup
chris-olszewski May 29, 2026
33e59cd
no longer apply sig to inherited methods
chris-olszewski Jun 1, 2026
1f6bc8b
ci: only run sorbet checks on ubuntu
chris-olszewski Jun 1, 2026
ef93e06
add rbi signatures for protobuf types
chris-olszewski Jun 1, 2026
f507ecf
prep for splitting up rbi file
chris-olszewski Jun 1, 2026
5c9e671
split out massive rbi
chris-olszewski Jun 1, 2026
40aabdb
add additional rbi types
chris-olszewski Jun 1, 2026
78b87ec
add missing rbi files
chris-olszewski Jun 1, 2026
c26ead9
add support for attr_reader/writer/accessor
chris-olszewski Jun 2, 2026
e1d834e
isolate sig applicator tests
chris-olszewski Jun 2, 2026
90a1391
remove skip prefix
chris-olszewski Jun 2, 2026
66d47d6
clean up comments wrt future
chris-olszewski Jun 2, 2026
d306567
use accessors
chris-olszewski Jun 2, 2026
452877b
leverage after run hook to fail tests
chris-olszewski Jun 2, 2026
2242240
add typing for testing env blocks
chris-olszewski Jun 2, 2026
99f74ad
fix lint
chris-olszewski Jun 2, 2026
c197698
fix steep error
chris-olszewski Jun 2, 2026
32bba4e
fully type support dir
chris-olszewski Jun 2, 2026
15d4777
remove mutex in sigapplicator
chris-olszewski Jun 2, 2026
82694cf
tighten sig applicator rbs
chris-olszewski Jun 2, 2026
d2f2db7
switch to use T.anything where applicable
chris-olszewski Jun 2, 2026
a5c73e5
use Object for vals in to_h
chris-olszewski Jun 3, 2026
097ff77
fix from_h to use object
chris-olszewski Jun 3, 2026
db4afac
rbs fixups
chris-olszewski Jun 3, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ jobs:
with:
go-version: stable

- name: Install protoc-gen-rbi
shell: bash
run: |
go install "github.com/coinbase/protoc-gen-rbi@$(tr -d '\n' < .protoc-gen-rbi-version)"
echo "$(go env GOPATH)/bin" >> "$GITHUB_PATH"

- name: Install protoc
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
Expand Down Expand Up @@ -104,6 +110,35 @@ jobs:

run: bundle exec rake TESTOPTS="--verbose"

- name: Test Ruby with Sorbet runtime assertions
if: ${{ matrix.os == 'ubuntu-latest' }}
working-directory: ./temporalio
# Timeout just in case there's a hanging part in rake
timeout-minutes: 10
# Set env vars for cloud tests. If secrets aren't present, tests will be skipped.
env:
# For mTLS tests
TEMPORAL_CLOUD_MTLS_TEST_TARGET_HOST: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}.tmprl.cloud:7233
TEMPORAL_CLOUD_MTLS_TEST_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
TEMPORAL_CLOUD_MTLS_TEST_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLOUD_MTLS_TEST_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}

# For API key tests
TEMPORAL_CLOUD_API_KEY_TEST_TARGET_HOST: us-east-1.aws.api.temporal.io:7233
TEMPORAL_CLOUD_API_KEY_TEST_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
TEMPORAL_CLOUD_API_KEY_TEST_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}

# For cloud ops tests
TEMPORAL_CLOUD_OPS_TEST_TARGET_HOST: saas-api.tmprl.cloud:443
TEMPORAL_CLOUD_OPS_TEST_NAMESPACE: ${{ vars.TEMPORAL_CLIENT_NAMESPACE }}
TEMPORAL_CLOUD_OPS_TEST_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLOUD_OPS_TEST_API_VERSION: 2024-05-13-00

# Enable Sorbet runtime type checking to verify RBI accuracy.
TEMPORAL_SORBET_RUNTIME_CHECK: "1"

run: bundle exec rake test TESTOPTS="--verbose"

- name: Deploy docs
# Only deploy on main merge, not in PRs
if: ${{ github.ref == 'refs/heads/main' && matrix.docsTarget }}
Expand Down
1 change: 1 addition & 0 deletions .protoc-gen-rbi-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v0.1.1
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1412,6 +1412,21 @@ Now can run `steep`:

bundle exec rake steep

### Type Signatures (Experimental)

The SDK ships two sets of type signatures:

* **RBS**: Maintained throughout development of the SDK, but only recently made public.
* **RBI**: Sorbet types maintained in parallel with the RBS signatures. Must be
updated manually when the RBS changes (see below).
* **Generated protobuf RBI** (`rbi/temporalio/api/`) -- Sorbet types generated from protobuf files in parallel with
generated protobuf RBS.

The RBI signatures are validated at runtime by running the test suite, which applies every RBI
signature to the real implementation at runtime via `SigApplicator`. This catches drift between the RBI and actual code.

This is yet another reason to ensure any changes you make have test coverage.

### Proto Generation

Run:
Expand All @@ -1420,3 +1435,9 @@ Run:

`proto:generate` now requires `protoc >= 34.0` because we generate RBS alongside the generated Ruby
protobuf files.

We use `protoc-gen-rbi` to generated protobuf RBI.

It can be installed via `go install`:

go install github.com/coinbase/protoc-gen-rbi@$(cat ../.protoc-gen-rbi-version)
2 changes: 2 additions & 0 deletions temporalio/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ group :development do
gem 'opentelemetry-sdk'
gem 'rake'
gem 'rake-compiler'
gem 'rbi'
gem 'rbs', '~> 3.10'
gem 'rb_sys', '~> 0.9'
gem 'rdoc'
gem 'rubocop'
gem 'sorbet-runtime'
gem 'sqlite3'
gem 'steep', '~> 1.10'
gem 'yard'
Expand Down
66 changes: 66 additions & 0 deletions temporalio/extra/payload_visitor_gen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,72 @@ def google_protobuf_any: (untyped value) -> void
TEXT
end

# Generate file Sorbet signature.
#
# @return [String] File signature.
def gen_rbi_code
method_defs = payload_methods.filter_map do |_, method_hash|
next if method_hash[:fields].empty?

<<~TEXT
sig { params(value: Object).void }
def #{method_name_from_desc(method_hash[:desc])}(value); end
TEXT
end.sort

<<~TEXT
# typed: true

# Generated code. DO NOT EDIT!

class Temporalio::Api::PayloadVisitor
extend T::Sig

sig do
params(
on_enter: T.nilable(T.proc.params(value: Object).returns(Object)),
on_exit: T.nilable(T.proc.params(value: Object).returns(Object)),
skip_search_attributes: T::Boolean,
traverse_any: T::Boolean,
block: T.proc.params(value: Object).returns(Object)
).void
end
def initialize(
on_enter: T.unsafe(nil),
on_exit: T.unsafe(nil),
skip_search_attributes: T.unsafe(false),
traverse_any: T.unsafe(false),
&block
); end

sig { params(value: Object).returns(NilClass) }
def run(value); end

sig { params(value: Object).void }
def _run_activation(value); end

sig { params(value: Object).void }
def _run_activation_completion(value); end

private

sig { params(name: String).returns(String) }
def method_name_from_proto_name(name); end

sig { params(value: Object).returns(Object) }
def api_common_v1_payload(value); end

sig { params(value: Object).returns(Object) }
def api_common_v1_payload_repeated(value); end

sig { params(value: Object).void }
def google_protobuf_any(value); end

#{method_defs.join("\n").gsub("\n", "\n ")}
end
TEXT
end

private

def payload_methods
Expand Down
Loading
Loading