Skip to content

fix: Relax detection of resumable upload methods. - #922

Merged
amanda-tarafa merged 1 commit into
googleapis:mainfrom
amanda-tarafa:relax-resumable-upload
Oct 14, 2026
Merged

amanda-tarafa merged 1 commit into
googleapis:mainfrom
amanda-tarafa:relax-resumable-upload

Conversation

@amanda-tarafa

Copy link
Copy Markdown
Collaborator

See b/573617047.

@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 updates the resumable upload allowlist mechanism to support wildcard-like matching using prefixes and suffixes, avoiding the need to restrict resumable uploads to specific Google Ads API versions. The allowlist is changed from a HashSet to a Dictionary, and the lookup logic is updated to use StartsWith and EndsWith. Feedback suggests optimizing this implementation by using an array of named tuples instead of a Dictionary to avoid lookup overhead, and explicitly specifying StringComparison.Ordinal in the string comparison methods to prevent culture-sensitive comparison issues.

Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs Outdated
Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs

@viacheslav-rostovtsev viacheslav-rostovtsev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@amanda-tarafa
amanda-tarafa force-pushed the relax-resumable-upload branch from b5f0758 to 8dafbe8 Compare October 14, 2026 18:43
@amanda-tarafa

Copy link
Copy Markdown
Collaborator 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 refactors the resumable upload allowlist in RestMethod.cs from a strict HashSet<string> to an array of prefix/suffix tuples, allowing matching across different versions of the Google Ads API without explicit allowlist entries. Corresponding unit tests were added to verify this behavior. The feedback suggests using StringComparison.Ordinal instead of StringComparison.OrdinalIgnoreCase for case-sensitive protobuf names, adding a length check to prevent overlapping prefix/suffix matches, and updating the XML documentation to correctly refer to the new tuple array structure instead of a dictionary.

Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs Outdated
Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs
@amanda-tarafa
amanda-tarafa force-pushed the relax-resumable-upload branch from 8dafbe8 to 9cd0483 Compare October 14, 2026 18:55
@amanda-tarafa

Copy link
Copy Markdown
Collaborator Author

/gemini review

Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs

@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 refactors the resumable upload method allowlist to support prefix and suffix matching, which avoids having to manually add new Google Ads API versions. It also adds corresponding unit tests. The review feedback suggests replacing the LINQ Any call with a foreach loop to avoid closure allocations on every request, which would also allow removing the unused using System.Linq; directive.

Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs
Comment thread Google.Api.Gax.Grpc/Rest/RestMethod.cs
@amanda-tarafa
amanda-tarafa requested a review from efevans October 14, 2026 19:09
@amanda-tarafa
amanda-tarafa merged commit fabc8c4 into googleapis:main Oct 14, 2026
10 checks passed
@amanda-tarafa
amanda-tarafa deleted the relax-resumable-upload branch October 14, 2026 19:27
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.

3 participants