Skip to content

chore: migrate java-firestore to google-cloud-java#12659

Open
suztomo wants to merge 2075 commits intogoogleapis:mainfrom
suztomo:migrate-java-firestore
Open

chore: migrate java-firestore to google-cloud-java#12659
suztomo wants to merge 2075 commits intogoogleapis:mainfrom
suztomo:migrate-java-firestore

Conversation

@suztomo
Copy link
Copy Markdown
Member

@suztomo suztomo commented Apr 2, 2026

b/477663340

renovate-bot and others added 30 commits February 17, 2025 11:20
…v to v1.30.0 (googleapis#2022)

* deps: update dependency io.opentelemetry.semconv:opentelemetry-semconv to v1.30.0

* Fix the SERVICE_NAME static import.

* Remove unnecessary test dependency.

---------

Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
Co-authored-by: Ehsan Nasiri <ehsann@google.com>
* chore(main): release 3.30.9

* chore: generate libraries at Wed Feb 26 15:28:23 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* chore(main): release 3.30.10

* chore: generate libraries at Thu Mar  6 18:28:36 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
…plugin to v3.1.4 (googleapis#2029)

Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
…is#2043)

Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
googleapis#2044)

* chore: Update generation configuration at Thu Mar 13 19:45:54 UTC 2025

* chore: generate libraries at Thu Mar 13 19:46:27 UTC 2025

* chore: Update generation configuration at Fri Mar 14 02:27:50 UTC 2025
…v3.45.1 (googleapis#2038)

Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
googleapis#2045)

* chore: Update generation configuration at Sat Mar 15 02:26:49 UTC 2025

* chore: Update generation configuration at Mon Mar 17 02:30:04 UTC 2025

* chore: Update generation configuration at Tue Mar 18 02:29:28 UTC 2025

* chore: Update generation configuration at Wed Mar 19 02:29:06 UTC 2025
* chore(main): release 3.30.11

* chore: generate libraries at Thu Mar 20 00:02:24 UTC 2025

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
… to v0.34.0 (googleapis#2046)

Co-authored-by: Tom Andersen <tom-andersen@users.noreply.github.com>
cloud-java-bot and others added 12 commits March 23, 2026 11:25
googleapis#2338)

* chore: Update generation configuration at Wed Mar 11 02:50:50 UTC 2026

* chore: Update generation configuration at Thu Mar 12 02:54:23 UTC 2026

* chore: Update generation configuration at Fri Mar 13 02:52:48 UTC 2026

* chore: Update generation configuration at Sat Mar 14 02:51:50 UTC 2026

* chore: generate libraries at Sat Mar 14 02:52:19 UTC 2026

* chore: Update generation configuration at Tue Mar 17 02:54:35 UTC 2026

* chore: Update generation configuration at Wed Mar 18 02:57:59 UTC 2026

* chore: generate libraries at Wed Mar 18 02:58:30 UTC 2026

* chore: Update generation configuration at Thu Mar 19 02:58:17 UTC 2026

* chore: Update generation configuration at Fri Mar 20 02:54:02 UTC 2026

* chore: Update generation configuration at Sat Mar 21 02:49:43 UTC 2026

* chore: Update generation configuration at Sun Mar 22 02:58:18 UTC 2026

---------

Co-authored-by: Lawrence Qiu <lawrenceqiu@google.com>
* chore(main): release 3.39.0

* chore: generate libraries at Mon Mar 23 15:27:04 UTC 2026

---------

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
* Add timestamp expressions

* chore: generate libraries at Fri Mar 20 14:34:46 UTC 2026

---------

Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
… error (googleapis#2351)

* Add support for the parent expression

* chore: generate libraries at Mon Mar 30 16:02:57 UTC 2026

* Fix integration tests error due to changes in backend implementation

* chore: generate libraries at Mon Mar 30 18:21:43 UTC 2026

* Fix nested field aggregations

---------

Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
* chore: add a simple verify skill

* feat: DML prototype

* make options and returns internal, add update stage (googleapis#2335)

* make options and returns internal, add update stage

* chore: generate libraries at Wed Mar  4 16:26:17 UTC 2026

---------

Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>

* Add pipeline DML tests and fix update verification

* Delete upsert() from Pipeline.java and tests

* Delete insert()

---------

Co-authored-by: Daniel La Rocque <dlarocque@google.com>
Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
* save work

* Fix breaking tests

* Fix testSingleLookupScalarSubquery

* Fix broken tests

* change syntax for define and return type of as function

* add documentation and overload for getField()

* change proto

* chore: generate libraries at Thu Feb 26 19:35:06 UTC 2026

* format code

* add tests for toArrayExpression

* move the subquery test to independent file

* Add tests for subcollection

* Format code

* refactor PipelineExpression

* Address feedbacks

* Improve documentation

* change the test

* Test subcollection used within Union stage

* replace mapGet with getField

* support subcollection in test

* chore: generate libraries at Wed Mar 11 18:14:28 UTC 2026

* improve error message

* chore: generate libraries at Tue Mar 24 17:04:45 UTC 2026

* add decode support

* Make the subquery test only run in nightly environment

* address feedbacks

* chore: generate libraries at Fri Mar 27 22:19:12 UTC 2026

* remove beta annotation

---------

Co-authored-by: cloud-java-bot <cloud-java-bot@google.com>
@suztomo suztomo force-pushed the migrate-java-firestore branch from 73c4357 to 2aae2ef Compare April 2, 2026 19:39
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces the Java Firestore SDK, including the core library and admin client, along with Kokoro configurations, documentation, and metadata. The implementation supports features like bulk writes, aggregate queries, and data pipelines. Feedback focuses on several potential NullPointerException vulnerabilities in FirestoreBundle, DocumentSnapshot, and PipelineResult when processing nullable timestamps or non-document results. Additionally, a security concern was raised regarding the exposure of sensitive tokens in a script's git configuration, and improvements were suggested for error handling in scripts and the replacement of deprecated Double constructors.

fi

if [ -z "${pr_num}" ]; then
git remote add remote_repo https://cloud-java-bot:"${GH_TOKEN}@github.com/${repo}.git"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-high high

Including the ${GH_TOKEN} directly in the remote URL is a security risk as it will be stored in plain text in the .git/config file. It is safer to use the token only during the push command or configure it via a header to avoid persistence in the local configuration.

Comment on lines +121 to +122
latestReadTime = documentSnapshot.getReadTime();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Potential NullPointerException when calling documentSnapshot.getReadTime().compareTo(...) because getReadTime() is @Nullable. The code should use the snapReadTime variable calculated earlier (on line 89), which correctly handles the null case by defaulting to Timestamp.MIN_VALUE.

      if (snapReadTime.compareTo(
              Timestamp.fromProto(originalDocument.getMetadata().getReadTime()))
           > 0) {
        latestReadTime = snapReadTime;
      }

Comment on lines +435 to +436
.setCreateTime(createTime.toProto())
.setUpdateTime(updateTime.toProto());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Potential NullPointerException in toDocumentPb() if createTime or updateTime are null. These fields are @Nullable and can be null if the snapshot was created from an object (e.g., via fromObject).

    if (createTime != null) {
      document.setCreateTime(createTime.toProto());
    }
    if (updateTime != null) {
      document.setUpdateTime(updateTime.toProto());
    }

Comment on lines +85 to +87
public String getId() {
return docRef.getId();
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Potential NullPointerException in getId() if docRef is null. The Javadoc states that it returns null if the result does not correspond to a document, but the current implementation will throw an exception.

  @Nullable
  @BetaApi
  public String getId() {
    return docRef != null ? docRef.getId() : null;
  }

Comment on lines +418 to +421
.putAllFields(fields)
.setCreateTime(createTime.toProto())
.setUpdateTime(updateTime.toProto());
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Potential NullPointerException in toDocumentPb() if docRef, createTime, or updateTime are null. These fields can be null for non-document results or results without timestamps (like those from aggregations).

    if (docRef != null) {
      document.setName(docRef.getName());
    }
    document.putAllFields(fields);
    if (createTime != null) {
      document.setCreateTime(createTime.toProto());
    }
    if (updateTime != null) {
      document.setUpdateTime(updateTime.toProto());
    }

Comment on lines +33 to +34
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned json from maven.org is invalid: ${json_content}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The error message uses an undefined variable ${json_content} and incorrectly refers to the response as JSON, while the URL on line 19 points to an XML file (maven-metadata.xml). It should use ${xml_content} instead.

Suggested change
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned json from maven.org is invalid: ${json_content}"
echo "The latest version of ${group_id}:${artifact_id} is empty."
echo "The returned XML from maven.org is invalid: ${xml_content}"
exit 1

/**
* Set the initial maximum number of operations per second allowed by the throttler.
*
* @param initialOpsPerSecond The initial maximum number of operations per second allowed by the
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use of deprecated new Double(double) constructor. It is recommended to use Double.valueOf(double) instead for better performance and future compatibility.

Suggested change
* @param initialOpsPerSecond The initial maximum number of operations per second allowed by the
return setInitialOpsPerSecond(Double.valueOf(initialOpsPerSecond));

/**
* Set the maximum number of operations per second allowed by the throttler.
*
* @param maxOpsPerSecond The maximum number of operations per second allowed by the throttler.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Use of deprecated new Double(double) constructor. It is recommended to use Double.valueOf(double) instead.

Suggested change
* @param maxOpsPerSecond The maximum number of operations per second allowed by the throttler.
return setMaxOpsPerSecond(Double.valueOf(maxOpsPerSecond));

@suztomo suztomo force-pushed the migrate-java-firestore branch 2 times, most recently from ff638e1 to 9d0df5d Compare April 3, 2026 02:52
@suztomo suztomo force-pushed the migrate-java-firestore branch from 9d0df5d to e8326fb Compare April 6, 2026 13:52
@suztomo suztomo marked this pull request as ready for review April 6, 2026 15:06
@suztomo suztomo requested a review from a team as a code owner April 6, 2026 15:06
@snippet-bot
Copy link
Copy Markdown

snippet-bot bot commented Apr 6, 2026

Here is the summary of changes.

You are about to add 256 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@suztomo suztomo requested review from blakeli0 and chingor13 April 6, 2026 18:09
Copy link
Copy Markdown
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hold

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.