Skip to content

Conversation

@THardy98
Copy link
Contributor

@THardy98 THardy98 commented Dec 2, 2025

What was changed

DWISOTT

  1. Part of Assume TLS enabled if API key provided in SDKs features#687

  2. How was this tested:
    Unit tests

  3. Any docs updates needed?
    Maybe

@THardy98 THardy98 marked this pull request as ready for review December 2, 2025 18:27
@THardy98 THardy98 requested a review from a team as a code owner December 2, 2025 18:27
Comment on lines 185 to 187
# Auto-enable TLS when API key provided and tls not explicitly set
# Convert nil to appropriate boolean: true if API key provided, false otherwise
tls = !api_key.nil? if tls.nil?
Copy link
Member

Choose a reason for hiding this comment

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

Hrmm, not sure we should alter the user-visible options which represents what the user passes in or clearly-visible parameter defaults. Of if we did want to change the parameter default here, we technically could change the default of nil here (and in connect) to tls: !api_key.nil?.

So two options - we either change the parameter default where the param is, or we only make this change when we're building the bridge options and leave the user-facing options as the value passed in to the function. Not sure which is best honestly, though I kinda lean towards the latter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

moved the code change to when we construct bridge options

target_host:,
api_key: nil,
tls: false,
tls: nil,
Copy link
Member

Choose a reason for hiding this comment

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

A bit surprised/disappointed this didn't require that you change sig/temporalio/client/connection.rbs (same for client.rbs). I would have expected a bundle exec rake steep call to fail, strange. Anyways, can we update those two sig files to support nil?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@THardy98 THardy98 changed the title enable TLS if api key provided 💥 enable TLS if api key provided Dec 3, 2025
@THardy98
Copy link
Contributor Author

THardy98 commented Dec 3, 2025

removed the added test file, instead opting for the cloud test in ci, like in .NET

@THardy98 THardy98 requested a review from cretz December 3, 2025 21:11
Copy link
Member

@cretz cretz left a comment

Choose a reason for hiding this comment

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

Nothing blocking

namespace,
api_key: nil,
tls: false,
tls: nil,
Copy link
Member

Choose a reason for hiding this comment

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

Should also update the YARD docs above the method for this param (and explain the runtime default)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not seeing this diff

Copy link
Member

@cretz cretz Dec 4, 2025

Choose a reason for hiding this comment

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

Above, there is:

    # @param tls [Boolean, Connection::TLSOptions] If false, do not use TLS. If true, use system default TLS options. If
    #   TLS options are present, those TLS options will be used.

It would change to:

      # @param tls [Boolean, Connection::TLSOptions, nil] If false, do not use TLS. If true, use system default TLS options. If TLS
      #   options are present, those TLS options will be used. If nil (the default), TLS will be auto-enabled if
      #   api_key is provided.

Same as you did in the connection file. But not a big deal.

Comment on lines +290 to +293
tls = @options.tls
tls = true if tls.nil? && @options.api_key

if tls
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tls = @options.tls
tls = true if tls.nil? && @options.api_key
if tls
if @options.tls || (@options.tls.nil? && @options.api_key)

Reads a bit easier to me, but up to you

@THardy98 THardy98 merged commit c84290a into main Dec 4, 2025
10 of 11 checks passed
@THardy98 THardy98 deleted the enable-tls-if-api-key branch December 4, 2025 18:34
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.

3 participants