Skip to content

Add Ruby SDK support#41

Draft
donald-pinckney wants to merge 11 commits into
mainfrom
add-ruby-support
Draft

Add Ruby SDK support#41
donald-pinckney wants to merge 11 commits into
mainfrom
add-ruby-support

Conversation

@donald-pinckney
Copy link
Copy Markdown
Collaborator

Summary

  • Add 11 Ruby reference files (~2100 lines) covering all major Temporal SDK features: workflows, activities, signals/queries/updates, child workflows, versioning, testing, error handling, data conversion, observability, determinism protection, and advanced features
  • Update SKILL.md to include Ruby in description, overview, and getting started guide
  • Add Ruby entry to core/determinism.md SDK Protection Mechanisms section

Details

The Ruby SDK (temporalio gem, GA) uses a fundamentally different determinism approach from Python (sandbox) and TypeScript (V8 isolate):

  • Illegal Call Tracing via Ruby's TracePoint to detect forbidden method calls at runtime
  • Durable Fiber Scheduler to make fiber operations deterministic

Ruby-specific sections added that don't exist in Python/TypeScript:

  • Cancellation (Token-based) — uses Temporalio::Cancellation objects
  • ActiveModel Integration — Ruby equivalent of Pydantic
  • Converter Hints — workflow_arg_hint/workflow_result_hint for type guidance
  • Illegal Call Tracing Gotchas — third-party gems triggering NondeterminismError
  • Activity Concurrency and Executors — ThreadPool configuration
  • Rails Integration — ActiveRecord, Zeitwerk, forking considerations

Test plan

  • Verify Ruby reference files are loaded correctly by the skill
  • Test with a sample Ruby Temporal project to validate code examples
  • Review alignment with Python/TypeScript content structure

🤖 Generated with Claude Code

donald-pinckney and others added 4 commits March 16, 2026 18:23
Created complete Ruby reference documentation covering:
- ruby.md: Overview, quick start, key concepts, file organization
- patterns.md: Signals, queries, updates, child workflows, saga, cancellation, etc.
- determinism.md: Illegal call tracing, safe alternatives table
- determinism-protection.md: TracePoint, durable fiber scheduler, customization
- versioning.md: Patching API, type versioning, worker versioning
- testing.md: WorkflowEnvironment, mocking, replay, activity testing
- error-handling.md: ApplicationError, retries, timeouts, workflow failure
- data-handling.md: Data converter, ActiveModel, hints, search attributes
- observability.md: Logging, metrics, best practices
- gotchas.md: Common mistakes, illegal call tracing issues
- advanced-features.md: Schedules, async completion, worker tuning, Rails

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Self-review fixes:
- patterns.md: Remove non-existent `workflow_run` annotation; entry point
  is `def execute` (no annotation needed, unlike Python's @workflow.run)
- patterns.md: Remove conflicting manual query methods that duplicated
  workflow_query_attr_reader
- error-handling.md: Remove `await` keyword (doesn't exist in Ruby)
- gotchas.md: Replace TS-style CancellationScope with Ruby's
  Temporalio::Cancellation token-based detached cancellation
- data-handling.md: Replace homemade ActiveModel mixin with official SDK
  pattern using ActiveSupport::Concern + ActiveModel::Serializers::JSON
- data-handling.md: Fix list_workflows call signature (positional, not kw)
- ruby.md, gotchas.md: Fix require paths to use 'temporalio/activity'
  instead of 'temporalio/activity/definition'

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- patterns.md: Fix external workflow signal to use class method ref
  (TargetWorkflow.data_ready instead of TargetWorkflow, :data_ready)
- patterns.md: Add ? suffix to all_handlers_finished (Ruby boolean convention)
- ruby.md: Add 'default' namespace to Client.connect calls

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- SKILL.md: Add "Temporal Ruby" trigger phrase to description
- SKILL.md: Update Overview to list Ruby as supported language
- SKILL.md: Add Ruby entry to Getting Started guide
- core/determinism.md: Add Ruby SDK Protection Mechanism entry
  (Illegal Call Tracing via TracePoint + Durable Fiber Scheduler)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jb08
Copy link
Copy Markdown

jb08 commented Mar 27, 2026

Thank you for doing this! As a ruby sdk user, very interested in this MR. Any update on ETA?

@hughevans
Copy link
Copy Markdown

Looks good!

@donald-pinckney donald-pinckney changed the base branch from dev to main April 17, 2026 19:07
@chadxz
Copy link
Copy Markdown

chadxz commented May 7, 2026

Yes please

Copy link
Copy Markdown
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good. Just a few suggestions

Comment thread references/ruby/ruby.md Outdated
Comment thread references/ruby/gotchas.md

class ReplayTest < Minitest::Test
def test_replay_from_json
json = File.read('test/fixtures/my_workflow_history.json')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would showing how to construct this JSON file be helpful?

Comment thread references/ruby/patterns.md Outdated
Comment thread references/ruby/observability.md
Comment thread references/ruby/determinism-protection.md Outdated

## Common Issues

### Third-party gems triggering NondeterminismError
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the first fix be to attempt to move the call into an activity? We should only be suggesting these escape hatches after there has been verification that the call will not introduce non-determinism.

Copy link
Copy Markdown

@bdewater-thatch bdewater-thatch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Saw this mentioned on the Slack. Long time Ruby/Rails user, still a bit new to Temporal, so reviewing through that lens :)

Comment thread references/ruby/advanced-features.md Outdated
Comment thread references/ruby/advanced-features.md
Comment thread references/ruby/gotchas.md
Comment thread references/ruby/gotchas.md Outdated
donald-pinckney and others added 2 commits May 26, 2026 14:13
Co-authored-by: Bart de Water <118401830+bdewater-thatch@users.noreply.github.com>
Co-authored-by: Chris Olszewski <chrisdolszewski@gmail.com>
Comment thread references/ruby/gotchas.md Outdated
Co-authored-by: Bart de Water <118401830+bdewater-thatch@users.noreply.github.com>
Co-authored-by: Donald Pinckney <donald_pinckney@icloud.com>
Comment thread references/ruby/advanced-features.md Outdated
Comment thread references/ruby/advanced-features.md Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants