• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

temporalio / sdk-java / #431

18 Nov 2026 09:28PM UTC coverage: 71.813% (+0.01%) from 71.8%
#431

push

github

web-flow
Include inherited fields in service stub options toString (#3152)

* Include inherited fields in service stub options toString

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 #2148.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* Render header names instead of header values in toString

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>

* Add changelog entry for service stub options toString

Co-Authored-By: Claude Opus 5.5 <noreply@anthro... (continued)

8779 of 14371 branches covered (61.09%)

Branch coverage included in aggregate %.

5 of 6 new or added lines in 4 files covered. (83.33%)

892 existing lines in 36 files now uncovered.

34625 of 46069 relevant lines covered (75.16%)

0.75 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/temporal-sdk/src/main/java/io/temporal/internal/replay/WorkflowMutableState.java
1
package io.temporal.internal.replay;
2

3
import io.temporal.api.common.v1.Memo;
4
import io.temporal.api.common.v1.Payload;
5
import io.temporal.api.common.v1.SearchAttributes;
6
import io.temporal.api.history.v1.WorkflowExecutionStartedEventAttributes;
7
import io.temporal.internal.statemachines.ContinueAsNewWorkflowParameters;
8
import javax.annotation.Nonnull;
9
import javax.annotation.Nullable;
10

11
class WorkflowMutableState {
12
  private boolean cancelRequested;
13
  private ContinueAsNewWorkflowParameters continueAsNewOnCompletion;
14
  private boolean workflowMethodCompleted;
15
  private Throwable workflowTaskFailureThrowable;
16
  private SearchAttributes.Builder searchAttributes;
17
  private Memo.Builder memo;
18

19
  WorkflowMutableState(WorkflowExecutionStartedEventAttributes startedAttributes) {
1 ✔
20
    if (startedAttributes.hasSearchAttributes()) {
1 ✔
21
      this.searchAttributes = startedAttributes.getSearchAttributes().toBuilder();
1 ✔
22
    }
23
    if (startedAttributes.hasMemo()) {
1 ✔
24
      this.memo = startedAttributes.getMemo().toBuilder();
1 ✔
25
    } else {
26
      this.memo = Memo.newBuilder();
1 ✔
27
    }
28
  }
1 ✔
29

30
  boolean isCancelRequested() {
31
    return cancelRequested;
1 ✔
32
  }
33

34
  void setCancelRequested() {
35
    cancelRequested = true;
1 ✔
36
  }
1 ✔
37

38
  @Nullable
39
  ContinueAsNewWorkflowParameters getContinueAsNewOnCompletion() {
40
    return continueAsNewOnCompletion;
1 ✔
41
  }
42

43
  void continueAsNewOnCompletion(ContinueAsNewWorkflowParameters parameters) {
44
    this.continueAsNewOnCompletion = parameters;
1 ✔
45
  }
1 ✔
46

47
  Throwable getWorkflowTaskFailure() {
48
    return workflowTaskFailureThrowable;
1 ✔
49
  }
50

51
  void failWorkflowTask(Throwable failure) {
52
    workflowTaskFailureThrowable = failure;
×
UNCOV
53
  }
×
54

55
  boolean isWorkflowMethodCompleted() {
56
    return workflowMethodCompleted;
1 ✔
57
  }
58

59
  void setWorkflowMethodCompleted() {
60
    this.workflowMethodCompleted = true;
1 ✔
61
  }
1 ✔
62

63
  SearchAttributes getSearchAttributes() {
64
    return searchAttributes == null || searchAttributes.getIndexedFieldsCount() == 0
1 !
65
        ? null
1 ✔
66
        : searchAttributes.build();
1 ✔
67
  }
68

69
  public Payload getMemo(String key) {
70
    return memo.build().getFieldsMap().get(key);
1 ✔
71
  }
72

73
  void upsertSearchAttributes(@Nullable SearchAttributes searchAttributes) {
74
    if (searchAttributes == null || searchAttributes.getIndexedFieldsCount() == 0) {
1 !
UNCOV
75
      return;
×
76
    }
77
    if (this.searchAttributes == null) {
1 ✔
78
      this.searchAttributes = SearchAttributes.newBuilder();
1 ✔
79
    }
80
    this.searchAttributes.putAllIndexedFields(searchAttributes.getIndexedFieldsMap());
1 ✔
81
  }
1 ✔
82

83
  public void upsertMemo(@Nonnull Memo memo) {
84
    this.memo.putAllFields(memo.getFieldsMap());
1 ✔
85
  }
1 ✔
86
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc