Skip to content

Fix anonymous block parameter in Workflow::Future RBI#494

Draft
fivetran-ryanrapp wants to merge 1 commit into
temporalio:mainfrom
fivetran-ryanrapp:fix-rbi-block
Draft

Fix anonymous block parameter in Workflow::Future RBI#494
fivetran-ryanrapp wants to merge 1 commit into
temporalio:mainfrom
fivetran-ryanrapp:fix-rbi-block

Conversation

@fivetran-ryanrapp

Copy link
Copy Markdown

What was changed

In rbi/temporalio/workflow/future.rbi, renamed the anonymous block parameter from & to &block on line 16 of Temporalio::Workflow::Future#initialize:

# before
sig { params(block: T.nilable(T.proc.returns(Elem))).void }
def initialize(&); end

# after
sig { params(block: T.nilable(T.proc.returns(Elem))).void }
def initialize(&block); end

Why?

The sig declares a parameter named block:, but the method definition used & (anonymous block forwarding). Sorbet requires the parameter name in the sig to match the name in the method definition. With the anonymous form, Sorbet raises two errors (5003):

Malformed sig. Type not specified for parameter &
Unknown parameter name block

The actual Ruby source at lib/temporalio/workflow/future.rb already uses &block — the RBI was inconsistent with the implementation.

This also fixes a secondary issue for users of [tapioca](https://github.com/Shopify/tapioca): when tapioca generates a merged gem RBI by combining runtime reflection (which produces &block) with this bundled RBI (which had &), the name mismatch caused the rbi gem to emit &&block — a parse error — in versions before 0.3.10. Consistent naming eliminates the mismatch regardless of rbi gem version.

Checklist

  1. Closes N/A — this is a one-line RBI correction with no associated issue

  2. How was this tested:

    • Confirmed srb tc no longer raises errors 5003 ("Malformed sig" / "Unknown parameter name") against this class after the change
    • Confirmed tapioca gem RBI generation no longer requires post-processing to fix the sig/method mismatch
  3. Any docs updates needed? No

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

1 similar comment
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants