feat: publish RBS and RBI types with Gem#410
Conversation
5e70a0f to
68ce2da
Compare
jazev-stripe
left a comment
There was a problem hiding this comment.
This looks really promising, and I think would already be pretty useful to us. The approach of applying the runtime checks during tests is new to me--seems quite cool!
I left a few comments; we also have a thread in the shared Stripe <> Temporal Slack channel (#support-stripe-temporal) about this.
jez
left a comment
There was a problem hiding this comment.
@jazev-stripe mentioned that you might want some feedback on this approach, don't mean to intrude, very excited to see this in any form it takes, it's extremely cool!
68ce2da to
76e1c77
Compare
76e1c77 to
cd3758a
Compare
db4afac to
e6cc2f5
Compare
|
|
||
| # @see ActivityExecutor.initialize_activity | ||
| def execute_activity(_defn, &) | ||
| def execute_activity(defn, &) # rubocop:disable Lint/UnusedMethodArgument |
There was a problem hiding this comment.
Sorbet cares about argument names so it is better to suppress the unused method lint explicitly instead of using _
|
|
||
| # @see ActivityExecutor.execute_activity | ||
| def execute_activity(_defn, &) | ||
| def execute_activity(defn, &) # rubocop:disable Lint/UnusedMethodArgument |
There was a problem hiding this comment.
Sorbet cares about argument names so it is better to suppress the unused method lint explicitly instead of using _
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Generated via `tapioca gem temporalio` against SDK v1.3.0. This file is used by CI to detect when the public API surface changes and the enriched RBI needs updating. It is not shipped to users. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Hand-maintained RBI file with typed sig blocks covering the full public API surface (~8,250 lines). Types are derived from the existing RBS signatures in sig/. Internal APIs are excluded. Also adds rbi/temporalio.rbi to the gemspec so it ships with the gem. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Move tapioca baseline from rbi/ to extra/ to prevent Sorbet from loading it alongside the enriched RBI via path: gem references - Fix parameter ordering in list_workflow_page sig - Fix Future Elem type_member variance (remove :out since result= uses it as input) - Replace T.nilable(T.untyped) with T.untyped - Fix unresolved bare Worker:: references to use full qualification Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
These classes inherit from ::Mutex, ::Queue, ::SizedQueue respectively. Without the inheritance, methods like `synchronize` are not available to Sorbet users. Found while porting message_passing_simple sample to Sorbet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Custom PayloadCodec implementations reference these protobuf types directly. Without stubs, Sorbet cannot resolve them. Found while porting encryption sample to Sorbet. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds extra/sorbet_check/ — a self-contained Sorbet project that validates the enriched RBI against realistic SDK usage patterns (activities, workflows, client, worker, codecs, errors, cancellation, search attributes, mutex). Runs `srb tc` on the checkTarget CI matrix. Also removes the tapioca baseline (extra/tapioca_baseline/) — the Sorbet type check provides better validation than diffing tapioca output, which is fragile across tapioca versions. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds a "Maintaining Type Signatures" section under Development with instructions on keeping RBS and RBI in sync, type mapping reference, and guidance on what to include/exclude from the RBI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
5f0f624 to
4c21098
Compare
What was changed
Include RBS types in published Gem along with newly added RBI types.
RBS
The codebase is already type checked with RBS, we just never included these type definitions as part of the gem. We now include these in the gem with experimental support.
RBI
These are net new, initially generated with Tapioca, narrowed via Claude/myself, and validated using
srb tcand enablingsobet-runtimein our tests.SigApplicator
To better verify that the RBI is correct, we run our tests with each method with
sorbet-runtimesignatures generated from our RBI files. Currently this added check is only enabled on for theubuntu-latesttest runs. These will also be released as experimental.We cannot apply this to every class as some:
Temporalio::Workflow::FutureUsing
SigApplicatoris controlled by theTEMPORAL_SORBET_RUNTIME_CHECKenvironment variable.We did have to update some tests where we intentionally pass in mistyped data.
Review Guidelines
I would focus highly on the
SigApplicatormodule as this is our primary tool for verifying our RBI file. Any changes to Ruby files should be reviewed as these are the more impactful.Looking at the RBI definitions for Workflow and Activities are worthwhile, but we rely on the tests to validate correctness for the majority of these new type signatures.
Why?
Community ask
Checklist
Closes [Feature Request] Publish RBI types #412
How was this tested:
See RBI section above.
Any docs updates needed?
Updated README, further docs will be updated as we move this out of experimental.