Skip to content

feat(storage): add x-goog-gcs-idempotency-token header linked to gccl… - #28

Open
thiyaguk09 wants to merge 10 commits into
mainfrom
feat/idempotency-tokens
Open

feat(storage): add x-goog-gcs-idempotency-token header linked to gccl…#28
thiyaguk09 wants to merge 10 commits into
mainfrom
feat/idempotency-tokens

Conversation

@thiyaguk09

Copy link
Copy Markdown
Owner

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea
  • Ensure the tests and linter pass
  • Code coverage does not decrease (if any source code was changed)
  • Appropriate docs were updated (if necessary)

Fixes #<issue_number_goes_here> 🦕

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

Copy link
Copy Markdown

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 adds the x-goog-gcs-idempotency-token header to outgoing requests in Service, Util, and Upload classes, ensuring it matches the gccl-invocation-id for tracking and idempotency. However, the current implementation in Service can overwrite or duplicate user-provided idempotency tokens due to case-sensitivity issues. It is recommended to check for existing user-provided tokens, respect them, and align them with the invocation ID as suggested.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/nodejs-common/service.ts Outdated
@thiyaguk09

Copy link
Copy Markdown
Owner Author

/Gemini review

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

Copy link
Copy Markdown

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 adds support for the x-goog-gcs-idempotency-token header, aligning it with the gccl-invocation-id value across the Service, Util, and Upload classes, and adds corresponding test coverage. The feedback points out a potential runtime crash in resumable-upload.ts where this.customRequestOptions is accessed directly without optional chaining; using optional chaining is recommended to prevent TypeError exceptions if the options are undefined.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/resumable-upload.ts Outdated
Comment thread handwritten/storage/src/resumable-upload.ts Outdated
Comment thread handwritten/storage/src/resumable-upload.ts Outdated
@thiyaguk09

Copy link
Copy Markdown
Owner Author

/Gemini review

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

Copy link
Copy Markdown

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 changes to align the 'x-goog-gcs-idempotency-token' header with the 'gccl-invocation-id' in the 'x-goog-api-client' header, supporting user-provided tokens case-insensitively across various request paths and resumable uploads. The review feedback highlights a critical improvement opportunity: the code should explicitly validate that the user-provided token is a string before using it, falling back to a generated UUID if it is invalid (e.g., null or undefined), to prevent type mismatches and ensure consistent header values.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/nodejs-common/service.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts Outdated
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts Outdated
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts Outdated
@thiyaguk09

Copy link
Copy Markdown
Owner Author

/Gemini review

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

Copy link
Copy Markdown

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 aligns the "x-goog-gcs-idempotency-token" header with the "gccl-invocation-id" in the "x-goog-api-client" header across service requests, utility headers, and resumable uploads, while also supporting user-provided tokens. The review feedback identifies a high-severity issue where invalid user-provided tokens with non-standard casing are not cleaned up, resulting in duplicate or conflicting headers being sent. The reviewer provides actionable code suggestions to delete the invalid casing keys when falling back to a generated token.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/nodejs-common/service.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
@thiyaguk09

Copy link
Copy Markdown
Owner Author

/Gemini review

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

Copy link
Copy Markdown

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 adds support for aligning the x-goog-gcs-idempotency-token header with the gccl-invocation-id in the x-goog-api-client header, respecting user-provided tokens case-insensitively and falling back to a generated UUID when necessary. The review feedback highlights critical issues in resumable-upload.ts where invalid or empty user-provided tokens are not properly cleaned up before merging, which could overwrite the generated UUIDs. It is recommended to delete invalid tokens directly from this.customRequestOptions.headers and to improve type safety in service.ts by explicitly checking for non-empty strings.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/resumable-upload.ts
Comment thread handwritten/storage/src/nodejs-common/service.ts
@thiyaguk09
thiyaguk09 force-pushed the feat/idempotency-tokens branch from 5a6aa6e to 46f25f7 Compare July 10, 2026 12:29
@thiyaguk09
thiyaguk09 force-pushed the feat/idempotency-tokens branch 6 times, most recently from 7f65a3e to f164923 Compare July 28, 2026 13:50
@thiyaguk09
thiyaguk09 force-pushed the feat/idempotency-tokens branch 2 times, most recently from fe91bfd to 7fd70ab Compare July 30, 2026 04:48
westarle and others added 8 commits July 30, 2026 13:28
…pis#9028)

Update pinned action version comments to match exact SemVer tags (e.g.,
# v6.0.3, # v4.3.1, # v6.4.0) to satisfy online zizmor scanner.
…typescript (googleapis#9029)

## Description

Upgrade the gapic-generator-typescript to node version 22. 

## Impact

Ensures users upgrade their runtime to Node 22 and don't encounter
problems due to legacy Node 18 issues.

## Changes

Node was upgraded to version 22 in two package.json files and then `npm
run baseline` was run.

Just the following files were updated:

core/generator/gapic-generator-typescript/templates/cjs/typescript_gapic/package.json

core/generator/gapic-generator-typescript/templates/esm/typescript_gapic/package.json

Then in core/generator/gapic-generator-typescript we ran the following
command:
`npm run baseline`


## Next steps

Next we are going to upgrade all the packages in the root `packages`
directory to separate concerns about the packages and the
gapic-typescript-generator.
@thiyaguk09
thiyaguk09 force-pushed the feat/idempotency-tokens branch from 7fd70ab to c7bf5bd Compare July 31, 2026 13:49
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.

4 participants