Skip to content

Samples(Storage): Add sample and test for ListBuckets With Partial Success#19

Open
mahendra-google wants to merge 1 commit intomainfrom
list-bucket-partials-support
Open

Samples(Storage): Add sample and test for ListBuckets With Partial Success#19
mahendra-google wants to merge 1 commit intomainfrom
list-bucket-partials-support

Conversation

@mahendra-google
Copy link
Copy Markdown
Owner

@mahendra-google mahendra-google commented Nov 13, 2025

This PR adds a new code sample for the ListBuckets operation using the ReturnPartialSuccess parameter in ListBucketOptions.

The ReturnPartialSuccess flag allows the API to return a list of buckets even if specific regions are temporarily unavailable, rather than failing the entire request. This sample demonstrates how to consume the resulting Reachable and Unreachable collections. Please see b/459649174.

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @mahendra-google, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a new C# sample for the Google Cloud Storage client library, focusing on the ListBuckets operation with the ReturnPartialSuccess feature. This enhancement provides developers with a clear example of how to handle scenarios where some buckets might be unreachable during a listing operation, ensuring a more robust and informative bucket retrieval process. A dedicated test case is also included to validate the sample's correctness and functionality.

Highlights

  • New Sample for Listing Buckets: A new C# sample has been added to demonstrate how to list Google Cloud Storage buckets, specifically utilizing the ReturnPartialSuccess option.
  • Handling Partial Success: The sample illustrates how to retrieve and differentiate between reachable and unreachable buckets when the ReturnPartialSuccess option is enabled during a bucket listing operation.
  • Dedicated Test Case: A corresponding Xunit test has been introduced to validate the functionality of the new ListBucketsWithPartialSuccess sample, ensuring it correctly identifies both reachable and potentially unreachable buckets.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

Code Review

The pull request adds a new sample and corresponding test for listing storage buckets with returnPartialSuccess. My review focuses on improving the efficiency and clarity of both the sample code and the test. The current implementation in both files leads to redundant API calls by enumerating the paged results multiple times. I've provided suggestions to refactor the code to fetch and process the API responses efficiently in a single pass. This involves changing the sample method to return the processed lists of reachable and unreachable buckets, and updating the test to use this new, more efficient interface. These changes will ensure the sample demonstrates best practices and the test is both correct and performant.

Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs Outdated
@mahendra-google mahendra-google changed the title samples(Storage): Add sample and test to list buckets with return partial success samples(Storage): Add sample and test to list buckets with partial success Nov 13, 2025
@mahendra-google mahendra-google changed the title samples(Storage): Add sample and test to list buckets with partial success samples(Storage): Add sample and test for ListBucketsWithPartialSuccess Nov 21, 2025
@mahendra-google
Copy link
Copy Markdown
Owner Author

/Gemini review

Copy link
Copy Markdown

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

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 a new sample and test for listing buckets with partial success, which is a useful feature for handling transient regional outages. The changes are well-structured, with a new sample, a corresponding test, and necessary modifications to the test fixture and project dependencies. My review includes one suggestion to improve the efficiency of the new sample code by optimizing how paged results are processed.

Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs Outdated
@mahendra-google
Copy link
Copy Markdown
Owner Author

/Gemini review

@mahendra-google mahendra-google changed the title samples(Storage): Add sample and test for ListBucketsWithPartialSuccess Samples(Storage): Add sample and test for ListBucketsWithPartialSuccess Nov 24, 2025
Copy link
Copy Markdown

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

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 a new code sample and a corresponding test for listing buckets with partial success, which is a useful feature. The implementation is correct and the test validates the primary success path. I've added a few suggestions to improve code conciseness and efficiency in both the sample and the test file by making better use of LINQ and avoiding unnecessary collection copying. Overall, this is a good addition.

Comment thread storage/api/Storage.Samples.Tests/ListBucketsWithPartialSuccessTest.cs Outdated
Comment thread storage/api/Storage.Samples.Tests/ListBucketsWithPartialSuccessTest.cs Outdated
Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs
@mahendra-google mahendra-google changed the title Samples(Storage): Add sample and test for ListBucketsWithPartialSuccess Samples(Storage): Add sample for ListBuckets With Partial Success Nov 25, 2025
@mahendra-google
Copy link
Copy Markdown
Owner Author

/Gemini review

Copy link
Copy Markdown

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

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 a new code sample demonstrating the ReturnPartialSuccess option for listing buckets, which is a valuable addition. The implementation is straightforward and effectively shows how to handle both reachable and unreachable buckets. My review includes a suggestion to make the sample more intuitive for users by adjusting a default parameter. I've also highlighted the need for unit tests to ensure the new sample's functionality is covered. The package version update is appropriate for the new feature.

Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs
Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs Outdated
@mahendra-google
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

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

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 a new code sample demonstrating the ReturnPartialSuccess option for listing buckets in Google Cloud Storage. The changes are well-structured, including the sample itself, a unit test to verify its functionality, and necessary updates to the test fixture and project dependencies. The code is correct and effectively illustrates how to handle partially successful responses. I've provided one minor suggestion to improve the code documentation for better clarity and to fix a potential compiler warning.

Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs Outdated
@mahendra-google
Copy link
Copy Markdown
Owner Author

/gemini review

@mahendra-google mahendra-google changed the title Samples(Storage): Add sample for ListBuckets With Partial Success Samples(Storage): Add sample and test for ListBuckets With Partial Success Nov 25, 2025
Copy link
Copy Markdown

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

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 a new code sample demonstrating the ReturnPartialSuccess option for listing buckets in Google Cloud Storage. The changes include the sample code itself, a corresponding test, a minor modification to the test fixture, and a necessary dependency update. The code is clear and effectively illustrates the feature. I've provided a couple of minor suggestions to enhance code style and documentation consistency.

Comment thread storage/api/Storage.Samples/ListBucketsWithPartialSuccess.cs Outdated
@mahendra-google
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

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

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 a new code sample and corresponding test for listing buckets with partial success, using the ReturnPartialSuccess option. The changes are well-implemented: the sample code in ListBucketsWithPartialSuccess.cs is clear and demonstrates how to handle both reachable and unreachable buckets. The accompanying test in ListBucketsWithPartialSuccessTest.cs effectively validates the sample's functionality. The necessary modifications to StorageFixture.cs and the project file to support the new sample are also correct. I have one minor suggestion to improve code conciseness in the test file.

Comment thread storage/api/Storage.Samples.Tests/ListBucketsWithPartialSuccessTest.cs Outdated
@mahendra-google
Copy link
Copy Markdown
Owner Author

/gemini review

Copy link
Copy Markdown

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

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 a new code sample and a corresponding test to demonstrate listing buckets with partial success using the ReturnPartialSuccess option. The implementation is clear and effectively showcases the feature. The test correctly verifies the happy path while prudently avoiding flakiness from potential real-world partial failures. I have one minor suggestion to improve code style consistency.

@mahendra-google mahendra-google force-pushed the list-bucket-partials-support branch from ef03f67 to 7c0bb19 Compare December 9, 2025 11:20
@mahendra-google mahendra-google force-pushed the list-bucket-partials-support branch from 7b10968 to 2c982dc Compare January 28, 2026 12:28
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