Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
d09690e
Extract RBS updates
chris-olszewski Jun 3, 2026
1e29880
Remove stale generated service RBS files
chris-olszewski Jun 3, 2026
ba2fa0e
Add sig/ to gemspec to ship RBS types with the gem
chris-olszewski Apr 1, 2026
9cb95a6
Add tapioca baseline for RBI drift detection
chris-olszewski Apr 1, 2026
26e1bfa
Add enriched RBI types for Sorbet users
chris-olszewski Apr 1, 2026
5d6ae39
Fix RBI issues found during Sorbet validation
chris-olszewski Apr 2, 2026
c178808
Fix Workflow::Mutex/Queue/SizedQueue missing parent classes in RBI
chris-olszewski Apr 2, 2026
745c8e6
Add Api::Common::V1::Payload/Payloads stubs to RBI
chris-olszewski Apr 2, 2026
ccf7b6c
Add CI Sorbet type check for enriched RBI
chris-olszewski Apr 2, 2026
119d959
Document RBI maintenance workflow for SDK developers
chris-olszewski Apr 2, 2026
4f89530
fixup rbi
chris-olszewski Apr 2, 2026
4f04569
strip comments
chris-olszewski Apr 2, 2026
7a4a5f9
feat: add sorbet runtime check to tests
chris-olszewski Apr 6, 2026
dfda801
fixup type errors
chris-olszewski Apr 6, 2026
94f0935
test: run sorbet runtime typecheck in ci
chris-olszewski Apr 6, 2026
c3278cb
chore: fix interceptor type errors
chris-olszewski Apr 6, 2026
421e69a
fix(test): fix activity info test to avoid type error
chris-olszewski Apr 6, 2026
028c18a
attempt to remove non-determism in type checking
chris-olszewski Apr 7, 2026
f3569b8
self review
chris-olszewski Apr 7, 2026
de27a17
include sig globally, support anon blocks
chris-olszewski Apr 8, 2026
073cfa5
chore: add test to limit amount of untyped uses
chris-olszewski Apr 8, 2026
f28f92c
first pass at removing untyped
chris-olszewski Apr 8, 2026
2e92dd8
type envconfig
chris-olszewski Apr 8, 2026
748993c
split out grpc service rbi
chris-olszewski Apr 9, 2026
8f61965
fail on uninstrumented methods
chris-olszewski Apr 9, 2026
0754f6c
increase coverage
chris-olszewski Apr 9, 2026
347a2e9
remove sorbet_check
chris-olszewski May 28, 2026
ee4ce6a
update rbi with new API surface
chris-olszewski May 29, 2026
b65cf54
intial rewrite to use sorbet internals
chris-olszewski May 29, 2026
2194fcc
add tests for method cleanup
chris-olszewski May 29, 2026
7360e54
no longer apply sig to inherited methods
chris-olszewski Jun 1, 2026
242e0dc
ci: only run sorbet checks on ubuntu
chris-olszewski Jun 1, 2026
b484e65
add rbi signatures for protobuf types
chris-olszewski Jun 1, 2026
67a3569
prep for splitting up rbi file
chris-olszewski Jun 1, 2026
dcfe07c
split out massive rbi
chris-olszewski Jun 1, 2026
ad22865
add additional rbi types
chris-olszewski Jun 1, 2026
5a37762
add missing rbi files
chris-olszewski Jun 1, 2026
77fac4b
add support for attr_reader/writer/accessor
chris-olszewski Jun 2, 2026
9f98345
isolate sig applicator tests
chris-olszewski Jun 2, 2026
ec0bb96
remove skip prefix
chris-olszewski Jun 2, 2026
b98acaf
clean up comments wrt future
chris-olszewski Jun 2, 2026
23b7615
use accessors
chris-olszewski Jun 2, 2026
4de57c1
leverage after run hook to fail tests
chris-olszewski Jun 2, 2026
acec242
add typing for testing env blocks
chris-olszewski Jun 2, 2026
2372f01
fix lint
chris-olszewski Jun 2, 2026
9a8165d
fix steep error
chris-olszewski Jun 2, 2026
59d40ff
fully type support dir
chris-olszewski Jun 2, 2026
47f6936
remove mutex in sigapplicator
chris-olszewski Jun 2, 2026
1978f81
tighten sig applicator rbs
chris-olszewski Jun 2, 2026
a09f570
switch to use T.anything where applicable
chris-olszewski Jun 2, 2026
9c14793
use Object for vals in to_h
chris-olszewski Jun 3, 2026
8272925
fix from_h to use object
chris-olszewski Jun 3, 2026
d4d450c
Add generated service namespace RBS files
chris-olszewski Jun 3, 2026
5649fcf
clean up old comments
chris-olszewski Jun 3, 2026
934b388
fail on nested error suppression
chris-olszewski Jun 4, 2026
3e8547e
add rbi for services
chris-olszewski Jun 4, 2026
d69b717
refactor sig applicator to use accumulator instead of passing around …
chris-olszewski Jun 4, 2026
73c3aad
update rbs for sig applicator
chris-olszewski Jun 9, 2026
b908992
clean up readme
chris-olszewski Jun 9, 2026
4c21098
add rbi for SAA
chris-olszewski Jun 9, 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
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,20 @@ 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.

We leverage `protoc` and the `protoc-gen-rbi` plugin to generate RBS and RBI types for all of our Protobuf messages and services.

The RBI signatures are validated at runtime by running the test suite with `TEMPORAL_SORBET_RUNTIME_CHECK=1`, which applies every RBI
signature to the real implementation at runtime via `SigApplicator`.

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

### Proto Generation

Run:
Expand All @@ -1477,3 +1491,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