Skip to content

feat(storage): Set CRC32C as the default checksum option#9107

Merged
cpriti-os merged 4 commits intogoogleapis:mainfrom
salilg-eng:feat/default-crc32c
Apr 29, 2026
Merged

feat(storage): Set CRC32C as the default checksum option#9107
cpriti-os merged 4 commits intogoogleapis:mainfrom
salilg-eng:feat/default-crc32c

Conversation

@salilg-eng
Copy link
Copy Markdown
Contributor

This PR introduces a change to the insertObject method in the Storage client to set CRC32C as the default checksum for all object uploads.

Why this change is needed
Previously, if a user didn't explicitly specify a validation option, no checksum was calculated or sent to the server. By defaulting to CRC32C, we can ensure a higher level of data integrity during uploads without requiring an extra configuration step from the user. This aligns the library with best practices for interacting with Google Cloud Storage and provides a better out-of-the-box experience.

Implementation details

  • The resolveUploadOptions method was updated to check for the presence of the validate key. If it's missing and the user hasn't provided their own checksum in the metadata, validate is now set to crc32c.
  • A new test case was added to verify that the library correctly falls back to the default CRC32C validation when no other options are provided.
  • An "Undefined array key" error in chooseValidationMethod was also fixed to ensure it handles cases where the validate key is not present.

This change is non-breaking and improves the robustness of the client library.

@salilg-eng salilg-eng requested review from a team as code owners April 14, 2026 06:44
@product-auto-label product-auto-label Bot added the api: storage Issues related to the Cloud Storage API. label Apr 14, 2026
@google-cla
Copy link
Copy Markdown

google-cla Bot commented Apr 14, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Copy Markdown
Contributor

@bshaffer bshaffer left a comment

Choose a reason for hiding this comment

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

This seems to be a duplicate of #8539, which was closed due to concerns regarding backwards compatibility, as noted in #8539 (review).

I would suggest not making this change until those concerns are addressed, or you can release a new major version of Storage (e.g. v2.0.0) to protect existing users from breaking when they update their google/cloud-storage dependency (I can help with the new major version release, if that's what you choose to do).

At the end of the day, the Storage team maintains this library, not Cloud SDK (my team), so you don't require my approval to merge this change. This is simply my recommendation, and I will withhold approval until the concerns have been addressed.

@salilg-eng
Copy link
Copy Markdown
Contributor Author

Following my discussion with @cpriti-os , we have decided to move forward with a major version release. @bshaffer , you are clear to merge now; this will mark the start of our work on the new version.

@cpriti-os cpriti-os merged commit a0adbb7 into googleapis:main Apr 29, 2026
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants