• 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

33.33
/temporal-testing/src/main/java/io/temporal/internal/sync/DummySyncWorkflowContext.java
1
package io.temporal.internal.sync;
2

3
import com.uber.m3.tally.NoopScope;
4
import com.uber.m3.tally.Scope;
5
import io.temporal.api.command.v1.SignalExternalWorkflowExecutionCommandAttributes;
6
import io.temporal.api.common.v1.*;
7
import io.temporal.api.failure.v1.Failure;
8
import io.temporal.api.sdk.v1.EventGroupMarker;
9
import io.temporal.api.sdk.v1.UserMetadata;
10
import io.temporal.common.RetryOptions;
11
import io.temporal.common.SuggestContinueAsNewReason;
12
import io.temporal.common.converter.DefaultDataConverter;
13
import io.temporal.failure.CanceledFailure;
14
import io.temporal.internal.common.SdkFlag;
15
import io.temporal.internal.logging.PrefixedMdc;
16
import io.temporal.internal.replay.ReplayWorkflowContext;
17
import io.temporal.internal.statemachines.*;
18
import io.temporal.workflow.Functions;
19
import java.time.Duration;
20
import java.util.*;
21
import javax.annotation.Nonnull;
22
import javax.annotation.Nullable;
23

24
public class DummySyncWorkflowContext {
×
25
  public static SyncWorkflowContext newDummySyncWorkflowContext() {
26
    SyncWorkflowContext context =
1 ✔
27
        new SyncWorkflowContext(
28
            "dummy",
29
            WorkflowExecution.newBuilder().setWorkflowId("dummy").setRunId("dummy").build(),
1 ✔
30
            null,
31
            new SignalDispatcher(DefaultDataConverter.STANDARD_INSTANCE),
32
            new QueryDispatcher(DefaultDataConverter.STANDARD_INSTANCE),
33
            new UpdateDispatcher(DefaultDataConverter.STANDARD_INSTANCE),
34
            null,
35
            DefaultDataConverter.STANDARD_INSTANCE,
36
            null);
37
    context.setReplayContext(new DummyReplayWorkflowContext());
1 ✔
38
    context.initHeadOutboundCallsInterceptor(context);
1 ✔
39
    context.initHeadInboundCallsInterceptor(
1 ✔
40
        new BaseRootWorkflowInboundCallsInterceptor(context) {
1 ✔
41
          @Override
42
          public WorkflowOutput execute(WorkflowInput input) {
43
            throw new UnsupportedOperationException(
×
44
                "#execute is not implemented or needed for low level DeterministicRunner tests");
45
          }
46
        });
47
    return context;
1 ✔
48
  }
49

50
  private static final class DummyReplayWorkflowContext implements ReplayWorkflowContext {
1 ✔
51

52
    private final Timer timer = new Timer();
1 ✔
53
    private final PrefixedMdc loggerMdc = new PrefixedMdc(null);
1 ✔
54

55
    @Override
56
    public WorkflowExecution getWorkflowExecution() {
57
      throw new UnsupportedOperationException("not implemented");
×
58
    }
59

60
    @Override
61
    public WorkflowExecution getParentWorkflowExecution() {
62
      throw new UnsupportedOperationException("not implemented");
×
63
    }
64

65
    @Override
66
    public WorkflowExecution getRootWorkflowExecution() {
67
      throw new UnsupportedOperationException("not implemented");
×
68
    }
69

70
    @Override
71
    public WorkflowType getWorkflowType() {
72
      return WorkflowType.newBuilder().setName("dummy-workflow").build();
1 ✔
73
    }
74

75
    @Override
76
    public boolean isCancelRequested() {
77
      throw new UnsupportedOperationException("not implemented");
×
78
    }
79

80
    @Override
81
    public void setCancelRequested() {
82
      throw new UnsupportedOperationException("not implemented");
×
83
    }
84

85
    @Override
86
    public boolean isWorkflowMethodCompleted() {
87
      throw new UnsupportedOperationException("not implemented");
×
88
    }
89

90
    @Override
91
    public void setWorkflowMethodCompleted() {
92
      throw new UnsupportedOperationException("not implemented");
×
93
    }
94

95
    @Override
96
    public ContinueAsNewWorkflowParameters getContinueAsNewOnCompletion() {
97
      throw new UnsupportedOperationException("not implemented");
×
98
    }
99

100
    @Override
101
    public String getTaskQueue() {
102
      return "dummy-task-queue";
1 ✔
103
    }
104

105
    @Nullable
106
    @Override
107
    public RetryOptions getRetryOptions() {
108
      return null;
×
109
    }
110

111
    @Override
112
    public String getNamespace() {
113
      return "dummy-namespace";
1 ✔
114
    }
115

116
    @Override
117
    public String getWorkflowId() {
118
      return "dummy-workflow-id";
1 ✔
119
    }
120

121
    @Nonnull
122
    @Override
123
    public String getRunId() {
124
      return "dummy-run-id";
1 ✔
125
    }
126

127
    @Nonnull
128
    @Override
129
    public String getFirstExecutionRunId() {
130
      throw new UnsupportedOperationException("not implemented");
×
131
    }
132

133
    @Override
134
    public Optional<String> getContinuedExecutionRunId() {
135
      throw new UnsupportedOperationException("not implemented");
×
136
    }
137

138
    @Nonnull
139
    @Override
140
    public String getOriginalExecutionRunId() {
141
      throw new UnsupportedOperationException("not implemented");
×
142
    }
143

144
    @Override
145
    public Duration getWorkflowRunTimeout() {
146
      throw new UnsupportedOperationException("not implemented");
×
147
    }
148

149
    @Override
150
    public Duration getWorkflowExecutionTimeout() {
151
      return Duration.ZERO;
×
152
    }
153

154
    @Override
155
    public long getRunStartedTimestampMillis() {
156
      return 0;
×
157
    }
158

159
    @Nonnull
160
    @Override
161
    public Duration getWorkflowTaskTimeout() {
162
      throw new UnsupportedOperationException("not implemented");
×
163
    }
164

165
    @Override
166
    public Payload getMemo(String key) {
167
      throw new UnsupportedOperationException("not implemented");
×
168
    }
169

170
    @Override
171
    @Nullable
172
    public SearchAttributes getSearchAttributes() {
173
      throw new UnsupportedOperationException("not implemented");
×
174
    }
175

176
    @Override
177
    public ScheduleActivityTaskOutput scheduleActivityTask(
178
        ExecuteActivityParameters parameters,
179
        Functions.Proc2<Optional<Payloads>, Failure> callback) {
180
      throw new UnsupportedOperationException("not implemented");
×
181
    }
182

183
    @Override
184
    public Functions.Proc scheduleLocalActivityTask(
185
        ExecuteLocalActivityParameters parameters, LocalActivityCallback callback) {
186
      throw new UnsupportedOperationException("not implemented");
×
187
    }
188

189
    @Override
190
    public Functions.Proc1<Exception> startChildWorkflow(
191
        StartChildWorkflowExecutionParameters parameters,
192
        Functions.Proc2<WorkflowExecution, Exception> executionCallback,
193
        Functions.Proc2<Optional<Payloads>, Exception> callback) {
194
      throw new UnsupportedOperationException("not implemented");
×
195
    }
196

197
    @Override
198
    public Functions.Proc1<Exception> startNexusOperation(
199
        StartNexusOperationParameters parameters,
200
        Functions.Proc2<Optional<String>, Failure> startedCallback,
201
        Functions.Proc2<Optional<Payload>, Failure> completionCallback) {
202
      throw new UnsupportedOperationException("not implemented");
×
203
    }
204

205
    @Override
206
    public Functions.Proc1<Exception> signalExternalWorkflowExecution(
207
        SignalExternalWorkflowExecutionCommandAttributes.Builder attributes,
208
        List<EventGroupMarker> eventGroupMarkers,
209
        Functions.Proc2<Void, Failure> callback) {
UNCOV
210
      throw new UnsupportedOperationException("not implemented");
×
211
    }
212

213
    @Override
214
    public void requestCancelExternalWorkflowExecution(
215
        WorkflowExecution execution,
216
        @Nullable String reason,
217
        List<EventGroupMarker> eventGroupMarkers,
218
        Functions.Proc2<Void, RuntimeException> callback) {
UNCOV
219
      throw new UnsupportedOperationException("not implemented");
×
220
    }
221

222
    @Override
223
    public void continueAsNewOnCompletion(ContinueAsNewWorkflowParameters parameters) {
UNCOV
224
      throw new UnsupportedOperationException("not implemented");
×
225
    }
226

227
    @Override
228
    public Throwable getWorkflowTaskFailure() {
UNCOV
229
      throw new UnsupportedOperationException("not implemented");
×
230
    }
231

232
    @Override
233
    public void failWorkflowTask(Throwable failure) {
UNCOV
234
      throw new UnsupportedOperationException("not implemented");
×
235
    }
236

237
    @Override
238
    public long currentTimeMillis() {
UNCOV
239
      return System.currentTimeMillis();
×
240
    }
241

242
    @Override
243
    public Functions.Proc1<RuntimeException> newTimer(
244
        Duration delay,
245
        UserMetadata metadata,
246
        List<EventGroupMarker> eventGroupMarkers,
247
        Functions.Proc1<RuntimeException> callback) {
248
      timer.schedule(
1 ✔
249
          new TimerTask() {
1 ✔
250
            @Override
251
            public void run() {
252
              callback.apply(null);
1 ✔
253
            }
1 ✔
254
          },
255
          delay.toMillis());
1 ✔
256
      return (e) -> {
1 ✔
257
        callback.apply(new CanceledFailure(null));
1 ✔
258
      };
1 ✔
259
    }
260

261
    @Override
262
    public void sideEffect(
263
        Functions.Func<Optional<Payloads>> func,
264
        UserMetadata userMetadata,
265
        List<EventGroupMarker> eventGroupMarkers,
266
        Functions.Proc1<Optional<Payloads>> callback) {
UNCOV
267
      callback.apply(func.apply());
×
UNCOV
268
    }
×
269

270
    @Override
271
    public void mutableSideEffect(
272
        String id,
273
        UserMetadata userMetadata,
274
        List<EventGroupMarker> eventGroupMarkers,
275
        Functions.Func1<Optional<Payloads>, Optional<Payloads>> func,
276
        Functions.Proc1<Optional<Payloads>> callback) {
UNCOV
277
      callback.apply(func.apply(Optional.empty()));
×
UNCOV
278
    }
×
279

280
    @Override
281
    public boolean isReplaying() {
282
      return false;
1 ✔
283
    }
284

285
    @Override
286
    public Integer getVersion(
287
        String changeId,
288
        int minSupported,
289
        int maxSupported,
290
        List<EventGroupMarker> eventGroupMarkers,
291
        Functions.Proc2<Integer, RuntimeException> callback) {
UNCOV
292
      throw new UnsupportedOperationException("not implemented");
×
293
    }
294

295
    @Override
296
    public Random newRandom() {
UNCOV
297
      throw new UnsupportedOperationException("not implemented");
×
298
    }
299

300
    @Override
301
    public Scope getMetricsScope() {
UNCOV
302
      return new NoopScope();
×
303
    }
304

305
    @Override
306
    public boolean getEnableLoggingInReplay() {
UNCOV
307
      return false;
×
308
    }
309

310
    @Override
311
    public UUID randomUUID() {
UNCOV
312
      return UUID.randomUUID();
×
313
    }
314

315
    @Override
316
    public void upsertSearchAttributes(
317
        @Nonnull SearchAttributes searchAttributes, List<EventGroupMarker> eventGroupMarkers) {
UNCOV
318
      throw new UnsupportedOperationException("not implemented");
×
319
    }
320

321
    @Override
322
    public void upsertMemo(@Nonnull Memo memo, List<EventGroupMarker> eventGroupMarkers) {
UNCOV
323
      throw new UnsupportedOperationException("not implemented");
×
324
    }
325

326
    @Override
327
    public boolean tryUseSdkFlag(SdkFlag flag) {
328
      return false;
1 ✔
329
    }
330

331
    @Override
332
    public boolean checkSdkFlag(SdkFlag flag) {
333
      return false;
1 ✔
334
    }
335

336
    @Override
337
    public Optional<String> getCurrentBuildId() {
UNCOV
338
      return Optional.empty();
×
339
    }
340

341
    @Override
342
    public Priority getPriority() {
UNCOV
343
      return null;
×
344
    }
345

346
    @Override
347
    public int getAttempt() {
UNCOV
348
      return 1;
×
349
    }
350

351
    @Override
352
    public String getCronSchedule() {
UNCOV
353
      return "dummy-cron-schedule";
×
354
    }
355

356
    @Nullable
357
    @Override
358
    public Payloads getLastCompletionResult() {
UNCOV
359
      return null;
×
360
    }
361

362
    @Nullable
363
    @Override
364
    public Failure getPreviousRunFailure() {
UNCOV
365
      return null;
×
366
    }
367

368
    @Nullable
369
    @Override
370
    public String getFullReplayDirectQueryName() {
UNCOV
371
      return null;
×
372
    }
373

374
    @Override
375
    public Map<String, Payload> getHeader() {
UNCOV
376
      return null;
×
377
    }
378

379
    @Override
380
    public long getLastWorkflowTaskStartedEventId() {
UNCOV
381
      return 0;
×
382
    }
383

384
    @Override
385
    public long getHistorySize() {
UNCOV
386
      return 0;
×
387
    }
388

389
    @Override
390
    public boolean isContinueAsNewSuggested() {
UNCOV
391
      return false;
×
392
    }
393

394
    @Override
395
    public List<SuggestContinueAsNewReason> getSuggestContinueAsNewReasons() {
UNCOV
396
      return Collections.emptyList();
×
397
    }
398

399
    @Override
400
    public boolean isTargetWorkerDeploymentVersionChanged() {
UNCOV
401
      return false;
×
402
    }
403

404
    @Override
405
    @Nonnull
406
    public PrefixedMdc getLoggerMdc() {
407
      return loggerMdc;
1 ✔
408
    }
409
  }
410
}
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