Skip to content

Add idempotency token modified#9

Open
shubhangi-google wants to merge 12 commits into
mainfrom
add_idempotency_token_modified
Open

Add idempotency token modified#9
shubhangi-google wants to merge 12 commits into
mainfrom
add_idempotency_token_modified

Conversation

@shubhangi-google

Copy link
Copy Markdown
Owner

No description provided.

@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 support for an idempotency token header (X-Goog-Gcs-Idempotency-Token) in ApiCommand for Google Cloud Storage requests, controlled by a new configuration option add_idempotency_token_header. Feedback on the changes highlights a critical issue where defining INVOCATION_ID as a class-level constant causes all API requests to share the same ID, defeating its purpose; using a lazy-loaded instance variable is recommended instead. Additionally, the reviewer suggests lazy-loading the @idempotency_token to avoid unnecessary allocations, using safe navigation to prevent potential NoMethodErrors, and optimizing hash checks by avoiding .keys.any?.

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 google-apis-core/lib/google/apis/core/api_command.rb Outdated
Comment thread google-apis-core/lib/google/apis/core/api_command.rb
Comment thread google-apis-core/lib/google/apis/core/api_command.rb Outdated
Comment thread google-apis-core/lib/google/apis/core/api_command.rb Outdated
Comment thread google-apis-core/lib/google/apis/core/api_command.rb
@shubhangi-google

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 support for sending an idempotency token header (X-Goog-Gcs-Idempotency-Token) in API commands, enabled by default via the new add_idempotency_token_header option. It also caches the invocation ID (@invocation_id) to ensure consistency across retries. Feedback points out that caching the invocation ID can lead to duplicate gccl-invocation-id values in the X-Goog-Api-Client header if prepare! is called multiple times, and suggests updating set_api_client_header to filter out existing invocation IDs.

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 google-apis-core/lib/google/apis/core/api_command.rb
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