Skip to content

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

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

feat(storage): add x-goog-gcs-idempotency-token header linked to gccl…#28
thiyaguk09 wants to merge 6 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
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.

1 participant