Skip to content

Include inherited fields in service stub options toString - #3070

Open
sdjcse wants to merge 2 commits into
temporalio:mainfrom
sdjcse:issue-2148-stub-options-tostring
Open

Include inherited fields in service stub options toString#3070
sdjcse wants to merge 2 commits into
temporalio:mainfrom
sdjcse:issue-2148-stub-options-tostring

Conversation

@sdjcse

@sdjcse sdjcse commented Sep 12, 2026

Copy link
Copy Markdown

What was changed

ServiceStubsOptions.toString now renders its fields through a package-private toStringFields()
that each subclass inlines alongside its own fields.

  • WorkflowServiceStubsOptions rendered only the five fields declared on the subclass, dropping
    every inherited one — target, TLS, timeouts, headers.
  • OperatorServiceStubsOptions and CloudServiceStubsOptions had no toString and logged as an
    identity hash.
  • Added apiKeyProvided, already in equals/hashCode but missing from toString.
  • Headers render as names only. io.grpc.Metadata#toString prints values in the clear, so
    inheriting the field as-is would have exposed credentials set through setHeaders.
  • Fixed a missing , before congestionInitialInterval in RpcRetryOptions.toString.

Why?

This output is what lands in logs when diagnosing a client. Two of the three option types rendered
nothing usable; the third omitted every inherited field.

Breaking changes?

None to public API. ServiceStubsOptions.toString now emits headerNames=[...] where it used to
emit headers= with values — deliberate, so the fix does not leak credentials.

Server PR

N/A.

Checklist

  1. Closes Better toString representations on service stub options #2148

  2. How was this tested:

    Five new tests covering each subclass's toString, asserting no API key or header value appears
    in the output, plus a regression test for the separator.

    ./gradlew --offline :temporal-serviceclient:spotlessCheck
    ./gradlew --offline :temporal-serviceclient:test
    
  3. Any docs updates needed?

    No.

🤖 Generated with Claude Code

sdjcse and others added 2 commits August 29, 2026 08:02
WorkflowServiceStubsOptions.toString rendered only the five fields
declared on the subclass, silently dropping every field inherited from
ServiceStubsOptions. Target, TLS settings, timeouts, and headers were
absent from the output, which is exactly the connection information
wanted when diagnosing a client from logs.

OperatorServiceStubsOptions and CloudServiceStubsOptions had no
toString at all and fell back to Object.toString, logging as an
unreadable identity hash.

Extract the field rendering on ServiceStubsOptions into a
package-private toStringFields helper and have each subclass inline it
alongside its own fields. The helper is package-private because all
four classes live in io.temporal.serviceclient, so this adds no public
API surface.

Also include apiKeyProvided, which already participates in equals and
hashCode but was omitted from toString. The API key itself is held by a
metadata provider and is still never rendered.

Fixes temporalio#2148.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Metadata.toString renders header values in the clear. The previous
commit propagated the inherited headers field into
WorkflowServiceStubsOptions, OperatorServiceStubsOptions, and
CloudServiceStubsOptions, which would have newly exposed any credential
supplied through setHeaders, such as a static Authorization header.

Render the header names only. This keeps the diagnostic signal that
matters when reading the output, whether a header is configured and
which ones, without printing what they contain.

Also add a regression test for the missing separator before
congestionInitialInterval in RpcRetryOptions.toString.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sdjcse
sdjcse requested a review from a team as a code owner September 12, 2026 07:13
@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.

Better toString representations on service stub options

2 participants