Skip to content

Commit c0221cc

Browse files
authored
Merge branch 'main' into fix-resource-leak-token
2 parents 4a594df + bb4d9e4 commit c0221cc

9,502 files changed

Lines changed: 3442217 additions & 123832 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: api-lifecycle
3+
description: Guidelines and playbooks for managing the API lifecycle (BetaApi, GA, ObsoleteApi, Deprecated, and Removal) in the Google Cloud Java SDK. Use this skill when modifying, deprecating, or introducing new public API surfaces.
4+
---
5+
6+
# API Lifecycle & Stability Guide
7+
8+
This guide defines the lifecycle phases and stability annotations of public APIs inside the Google Cloud Java SDK. Use this to ensure all public methods, classes, and fields correctly adhere to Semantic Versioning (Semver) and safely transition through deprecation phases.
9+
10+
> [!IMPORTANT]
11+
> **Scope & Visibility Rule**
12+
> This guideline applies **ONLY to public API surfaces** (e.g., `public` classes, interfaces, methods, and fields) that are exposed to external/downstream consumers. It does **NOT** apply to private, package-private, or internal implementation details.
13+
14+
---
15+
16+
## Design Principle: Minimize Public API Surface
17+
18+
To reduce maintenance overhead and ensure long-term flexibility, developers should actively avoid creating public APIs unless absolutely necessary.
19+
20+
* **Default to Restrictive Visibility**: Always default to the most restrictive access modifier (`private`, `package-private`, or `@InternalApi`) for new classes, methods, and fields. Only expose an API as `public` if there is a clear, justified requirement for external consumers.
21+
* **Exposing Public APIs Commits Us**: Every public class, method, or field represents a strict compatibility contract under Semantic Versioning. Once public, modifying or removing it requires a long, multi-phase deprecation cycle.
22+
* Prefer Internal Utilities: If functionality is only needed within the same package or module, keep it private or package-private. Do not make it public "just in case".
23+
24+
---
25+
26+
## The API Lifecycle Flow
27+
28+
An API does **not** have to start with `@BetaApi`. Stable, well-designed features can be introduced directly as General Availability (GA). The `@BetaApi` annotation is reserved for experimental, preview, or unstable APIs.
29+
30+
Below is the transition flow for public APIs:
31+
32+
**Standard Lifecycle (Direct to GA):**
33+
`General Availability (GA) ──> @ObsoleteApi (Staged Deprecation) ──> @Deprecated (Official) ──> Removed`
34+
35+
**Experimental Lifecycle (Beta first):**
36+
`@BetaApi (Experimental) ──> General Availability (GA) ──> @ObsoleteApi (Staged Deprecation) ──> @Deprecated (Official) ──> Removed`
37+
38+
---
39+
40+
## API Lifecycle Stages
41+
42+
### 1. `@BetaApi` (Experimental Phase)
43+
* **Purpose**: Used for experimental, preview, or unstable API surfaces.
44+
* **Semver Policy**: Treated as a **"0.x" feature inside a "1.x" library**. Subject to incompatible changes or removal between minor and patch releases at any time.
45+
* **Graduation Policy**: Not all APIs start here. Many APIs go directly to GA. If an API does start as `@BetaApi`, it is intended to eventually graduate to a GA feature by removing the `@BetaApi` annotation.
46+
* **Usage Rule**: Do **NOT** depend on `@BetaApi` features inside a public library `B` that has downstream consumers, *unless* the consuming components of library `B` are also marked with `@BetaApi`.
47+
* **Exception**: `google-cloud-java` is allowed to depend on `@BetaApi` features in `gax-java` without declaring the consuming code `@BetaApi`, as they move in lockstep.
48+
49+
### 2. General Availability (GA)
50+
* **Purpose**: Stable API surfaces intended for production use.
51+
* Policy: Deprecation or breaking changes to GA APIs are considered breaking changes and should generally not be performed under a minor version release using standard @Deprecated.
52+
53+
### 3. `@ObsoleteApi` (Staged Deprecation)
54+
* **Purpose**: Signals to users that an API will be deprecated in a future version, allowing them to transition to alternative methods before official deprecation.
55+
* **Policy**: Used during minor version releases.
56+
* **Usage Guidelines**:
57+
* **Annotation**: Apply `@ObsoleteApi("Reason or alternative instructions")`. A descriptive reason is required.
58+
* **Javadoc**: Detail the replacement or migration path, referencing alternative methods via `{@link}`.
59+
* **IDE Impact**: Does not trigger IDE compilation/strike-through warnings, keeping downstream builds warning-free.
60+
61+
### 4. `@Deprecated` (Official Deprecation)
62+
* **Purpose**: Officially deprecates the API in the editor/IDE, producing compiler warnings and strike-throughs.
63+
* **Policy**: Strongly recommended to be applied during **Major Version Releases** (e.g., `v2.0.0`), or in rare emergency cases to fix critical security vulnerabilities. However, it can be acceptable in minor version releases if the library owners explicitly review and determine that the deprecation is low-risk for downstream consumers.
64+
* **Usage Guidelines**:
65+
* **Annotation**: Apply Java's standard `@Deprecated` annotation to the code element.
66+
* **Javadoc**: Add the standard `@deprecated` Javadoc tag describing alternative APIs or transition steps.
67+
68+
### 5. Removal
69+
* **Purpose**: Complete removal of the API from the codebase.
70+
* **Policy**: Performed in a subsequent major version release following official deprecation.
71+
* **Usage Guidelines**:
72+
* **Action**: Completely delete the class, interface, method, or field, along with its Javadoc and annotations.
73+
* **Validation**: Verify that all internal usages, references, and tests within the monorepo are fully cleaned up or migrated.
74+
75+
---
76+
77+
## API Stability & Visibility Annotations
78+
79+
While the standard **API Lifecycle Stages** section above defines how public APIs transition over time, the SDK also utilizes specialized stability annotations. These annotations serve as "exceptions" or "special contracts" that dictate how Semantic Versioning applies to public elements:
80+
81+
### 1. `@InternalApi`
82+
* **Definition**: Technically `public` because of Java's access modifier limitations, but intended **only** for internal use.
83+
* **Semver Policy**: For the purposes of semver, these are considered **private**. They can be modified or deleted in any minor or patch release without breaking compatibility.
84+
85+
### 2. `@InternalExtensionOnly`
86+
* **Definition**: A `public` interface that is only intended to be implemented by internal SDK classes, though it can be consumed publicly.
87+
* **Semver Policy**: We reserve the right to add new methods to these interfaces without providing default implementations in minor/patch releases. Downstream consumers should **not** write custom implementations of these interfaces.
88+
89+
*(Note: For experimental public APIs, see the `@BetaApi` stage in the Lifecycle Stages section above.)*
90+
91+
---
92+
93+
## Checklist for API Modifiers & Code Reviewers
94+
95+
- [ ] **Is the API GA?** If so, do **NOT** apply `@Deprecated` directly in a minor release. Apply `@ObsoleteApi` first.
96+
- [ ] **Is it intended only for internal use?** If so, mark it `@InternalApi` so downstream users don't rely on it.
97+
- [ ] **Is it an interface meant only for internal implementation?** Mark it `@InternalExtensionOnly` to protect future extensions.
98+
- [ ] **Does `@ObsoleteApi` or `@Deprecated` have a `value` parameter?** The string must explain *why* and *what* the user should do instead.
99+
- [ ] **Does the Javadoc link to alternatives?** Use `{@link #alternativeMethod()}` so the user can easily navigate in their IDE.

.agents/skills/java-development/SKILL.md

Lines changed: 0 additions & 67 deletions
This file was deleted.

.github/CODEOWNERS

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33
# For syntax help see:
44
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
55

6-
* @googleapis/cloud-sdk-java-team
6+
* @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
77

88
# java-vertexai has maintainers
9-
/java-vertexai/ @googleapis/vertexai-team @googleapis/cloud-sdk-java-team
10-
/java-bigquerystorage/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team
11-
/java-bigquery/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team
12-
/java-spanner/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team
13-
/java-spanner-jdbc/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team
14-
/google-auth-library-java/ @googleapis/cloud-sdk-auth-team @googleapis/cloud-sdk-java-team @googleapis/aion-team
15-
/java-storage/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team
16-
/java-storage-nio/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team
9+
/java-vertexai/ @googleapis/vertexai-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
10+
/java-bigquerystorage/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
11+
/java-bigquery/ @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
12+
/java-bigquery-jdbc/ @googleapis/bigquery-developer-tools-team @googleapis/bigquery-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
13+
/grpc-gcp-java/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
14+
/java-spanner/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
15+
/java-spanner-jdbc/ @googleapis/spanner-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
16+
/google-auth-library-java/ @googleapis/cloud-sdk-auth-team @googleapis/cloud-sdk-java-team @googleapis/aion-team @googleapis/cloud-sdk-librarian-team
17+
/java-storage/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
18+
/java-storage-nio/ @googleapis/gcs-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
19+
/java-pubsub/ @googleapis/pubsub-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
20+
/java-bigtable/ @googleapis/bigtable-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
21+
/java-firestore/ @googleapis/firestore-team @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team
22+
/librarian.yaml @googleapis/cloud-sdk-java-team @googleapis/cloud-sdk-librarian-team

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 95 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,119 @@ about: Create a report to help us improve
66

77
Thanks for stopping by to let us know something could be better!
88

9-
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.
9+
**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response. We try to review GitHub issues on a regular basis, however we cannot guarantee an SLO.
1010

11-
Please run down the following list and make sure you've tried the usual "quick fixes":
11+
Before creating this issue, please run down the following list and make sure you've tried the usual "quick fixes":
1212

1313
- Search the issues already opened: https://github.com/googleapis/google-cloud-java/issues
1414
- Check for answers on StackOverflow: http://stackoverflow.com/questions/tagged/google-cloud-platform
15+
- Refer to the [Google Cloud Java Getting Started guides](https://docs.cloud.google.com/java/getting-started) for common usage patterns and troubleshooting.
16+
- Verify you are using the latest versions of the Java SDK. If not, is it possible to upgrade? We recommend using the [Libraries-Bom](https://cloud.google.com/java/docs/bom) to manage dependency versions.
1517

16-
If you are still having issues, please include as much information as possible:
18+
To help expedite the resolution of the issue, please fill out as much information as possible. If unable to provide information, please note down why the information is unable to be provided.
1719

18-
#### Environment details
20+
## Issue Details
1921

20-
1. Specify the API at the beginning of the title. For example, "[vision]: ...").
21-
General, Core, and Other are also allowed as types
22-
2. OS type and version:
23-
3. Java version:
24-
4. Version(s):
22+
Required: Provide a detailed description of the issue. Any additional information helps with figuring out the issue.
2523

26-
#### Steps to reproduce
24+
### Example
25+
I am seeing {ISSUE} when running X, Y... after doing Z. This behavior started after the X library upgrade a few weeks ago ...
2726

28-
1. ?
29-
2. ?
27+
## Environment
3028

31-
#### Code example
29+
Required: Provide details about your environment. If relevant, please also provide details about your GCP environment. The environment details MUST be filled out.
3230

33-
```java
34-
// example
31+
Provide the relevant details about your environment:
32+
33+
- OS Type and Version:
34+
- Java Version and JDK Vendor:
35+
- (If using GraalVM) GraalVM Version:
36+
37+
(Optional) If deployed on GCP, provide the relevant details about your GCP deployment environment:
38+
39+
- Project ID:
40+
- Cloud Services:
41+
- Deployment Environment (Compute, GKE, Run, etc):
42+
43+
## Dependencies
44+
45+
Required: Provide a list of the dependencies that are being used. If unable to provide the list, please list the relevant libraries shown below. One of the two sections below MUST be filled out.
46+
47+
1. List your application’s dependency versions. Please provide the output of `mvn dependency:tree`, `gradle dependencies`, or your build system.
48+
49+
### Example `mvn dependency:tree` output
3550
```
51+
maven-dependency-plugin:tree
52+
53+
- com.google.cloud:{X}:{Y}
54+
55+
- com.google.auth:{X}:{Y}
56+
57+
...
58+
```
59+
60+
2. Provide the versions of the relevant libraries:
61+
- Libraries-Bom ([com.google.cloud:libraries-bom](https://central.sonatype.com/artifact/com.google.cloud/libraries-bom)):
62+
- (If not using Libraries-Bom) Client Libraries:
63+
- Gax (gax / gax-grpc / gax-httpjson):
64+
- Auth (google-auth-library-oauth2-http / google-auth-library-credentials):
65+
- Any other relevant Java SDK dependencies:
66+
- Google-Http-Java-Client ([com.google.http-client:google-http-client](https://central.sonatype.com/artifact/com.google.http-client/google-http-client)):
67+
68+
## Reproducer
69+
70+
Required: Provide a reproducer and the steps needed to reproduce this issue locally. If unable to provide a reproducer, please provide code snippets to help reproduce the issue. One of the two sections below MUST be filled out.
3671

37-
#### Stack trace
72+
1. A reproducer is the quickest method to resolve this issue. It could be a test case or a sample application. It is easier for us to troubleshoot the problem and to verify the solution.
73+
74+
Steps to reproduce:
75+
76+
### Example
77+
1. Enable Speech API
78+
2. Upload a .mp4 file to GCS
79+
3. ...
80+
4. See {ERROR}
81+
82+
If unable to provide a reproducer, please provide a reason: ...
83+
84+
2. Provide as many code snippets as possible:
85+
86+
### Example
87+
```java
88+
try (InstancesClient instancesClient = InstancesClient.create()) {
89+
...
90+
}
3891
```
39-
Any relevant stacktrace here.
92+
93+
## Logs and Stack Trace
94+
95+
Required: Provide logs that showcase the error. This will help show the flow of the application and help narrow down the cause. Additionally, provide a stack trace of the error if possible.
96+
97+
The Java SDK has a troubleshooting [guide](https://github.com/googleapis/google-cloud-java/blob/main/TROUBLESHOOTING.md) for enabling logs. This contains information regarding client-server communication, request and response details, and logging in dependency libraries. If using this guide, please obfuscate any private information (bearer tokens, request and response params, etc).
98+
99+
Additionally, please provide a stack trace of the error seen:
100+
101+
### Example
40102
```
103+
TransportContext.java:347|Fatal (CERTIFICATE_UNKNOWN): PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target (
104+
105+
"throwable" : {
41106
42-
#### External references such as API reference guides
107+
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
43108
44-
- ?
109+
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:456)
110+
111+
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:323)
112+
113+
...
114+
```
45115

46-
#### Any additional information below
116+
## Behavior
47117

118+
Optional: Any additional information about the behavior of the error is helpful to debug.
48119

49-
Following these steps guarantees the quickest resolution possible.
120+
Behavioral Questions:
50121

51-
Thanks!
122+
- When did the issue begin? Is this behavior related to any dependency version upgrade?
123+
- Is this behavior flaky? Or is this consistently seen in production?
124+
- Is this behavior related to the volume of data?

.github/release-please.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,8 @@ branches:
4646
onDemand: true
4747
local: true
4848
localCloneDepth: 200
49+
- branch: datastore-2.x
50+
releaseType: java-backport
51+
onDemand: true
52+
local: true
53+
localCloneDepth: 200

0 commit comments

Comments
 (0)