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

temporalio / sdk-java / #388

16 Sep 2026 08:01PM UTC coverage: 68.255% (-0.2%) from 68.408%
#388

push

github

web-flow
Add Google Cloud Run CloudRunIdPlugin (#3028)

* Add Google Cloud Run worker identity/deployment helper

Adds an experimental Google Cloud Run helper, mirroring the existing AWS
Lambda module's worker-ID behavior. Because Cloud Run runs a long-lived
container (unlike Lambda's per-invocation model), this is a metadata
helper rather than a worker wrapper: it reads the Cloud Run instance
metadata -- the instance id from the metadata server, plus the worker
pool/service name and revision from CLOUD_RUN_WORKER_POOL / CLOUD_RUN_REVISION
(worker pools) or K_SERVICE / K_REVISION (services) -- and derives a worker
identity and a WorkerDeploymentVersion to apply to a normal long-lived
worker. Covers both Cloud Run worker pools and services.

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

* Set worker versioning behavior to PINNED in the Cloud Run worker apply

The worker-side apply helper enabled versioning and set the deployment
version but left the default versioning behavior unset, so a versioned
worker with a plain (un-annotated) workflow failed to register. Default it
to PINNED; a per-workflow versioning behavior still takes precedence.

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

* Add unit tests for GoogleCloudRunMetadata

Cover the Cloud Run metadata helper: environment-variable precedence
(CLOUD_RUN_WORKER_POOL over K_SERVICE, CLOUD_RUN_REVISION over
K_REVISION), worker identity fallbacks, WorkerDeploymentVersion mapping
and its empty name/revision error, the metadata HTTP request
(Metadata-Flavor: Google header, body trimming, non-200 and unreachable
errors), and the applyTo(...) methods (client identity, and PINNED
worker deployment versioning).

The metadata request is served by an in-process com.sun.net.httpserver
HttpServer and the environment lookup is injected through a new
package-private fetch(String, Duration, Function) test seam, so the
tests touch neither the network nor the real process environment. The
seam is not p... (continued)

7836 of 13628 branches covered (57.5%)

Branch coverage included in aggregate %.

0 of 71 new or added lines in 2 files covered. (0.0%)

17 existing lines in 7 files now uncovered.

31829 of 44485 relevant lines covered (71.55%)

0.72 hits per line

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

56.1
/temporal-sdk/src/main/java/io/temporal/client/ActivityCompletionException.java
1
package io.temporal.client;
2

3
import io.temporal.activity.ActivityInfo;
4
import io.temporal.failure.TemporalException;
5
import java.util.Optional;
6

7
/** Base exception for all failures returned by an activity completion client. Do not extend! */
8
public class ActivityCompletionException extends TemporalException {
9

10
  private final String workflowId;
11

12
  private final String runId;
13

14
  private final String activityType;
15

16
  private final String activityId;
17

18
  protected ActivityCompletionException(ActivityInfo info) {
19
    this(info, null);
1✔
20
  }
1✔
21

22
  protected ActivityCompletionException(ActivityInfo info, Throwable cause) {
23
    super(
1✔
24
        info != null
1!
25
            ? "WorkflowId="
26
                + info.getWorkflowId()
1✔
27
                + ", RunId="
28
                + info.getWorkflowRunId()
1✔
29
                + ", ActivityType="
30
                + info.getActivityType()
1✔
31
                + ", ActivityId="
32
                + info.getActivityId()
1✔
33
            : null,
1✔
34
        cause);
35
    if (info != null) {
1!
36
      workflowId = info.getWorkflowId();
1✔
37
      runId = info.getWorkflowRunId();
1✔
38
      activityType = info.getActivityType();
1✔
39
      activityId = info.getActivityId();
1✔
40
    } else {
41
      this.workflowId = null;
×
42
      this.runId = null;
×
43
      activityType = null;
×
44
      activityId = null;
×
45
    }
46
  }
1✔
47

48
  protected ActivityCompletionException(String activityId, Throwable cause) {
49
    super("ActivityId=" + activityId, cause);
1✔
50
    this.workflowId = null;
1✔
51
    this.runId = null;
1✔
52
    this.activityType = null;
1✔
53
    this.activityId = activityId;
1✔
54
  }
1✔
55

56
  protected ActivityCompletionException(Throwable cause) {
57
    this((ActivityInfo) null, cause);
×
58
  }
×
59

60
  protected ActivityCompletionException() {
UNCOV
61
    super(null, null);
×
UNCOV
62
    workflowId = null;
×
UNCOV
63
    runId = null;
×
UNCOV
64
    activityType = null;
×
UNCOV
65
    activityId = null;
×
UNCOV
66
  }
×
67

68
  /** Optional as it might be not known to the exception source. */
69
  public Optional<String> getWorkflowId() {
70
    return Optional.ofNullable(workflowId);
×
71
  }
72

73
  /** Optional as it might be not known to the exception source. */
74
  public Optional<String> getRunId() {
75
    return Optional.ofNullable(runId);
×
76
  }
77

78
  /** Optional as it might be not known to the exception source. */
79
  public Optional<String> getActivityType() {
80
    return Optional.ofNullable(activityType);
×
81
  }
82

83
  /** Optional as it might be not known to the exception source. */
84
  public Optional<String> getActivityId() {
85
    return Optional.ofNullable(activityId);
×
86
  }
87
}
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