Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

feat(listBuckets): Add support for returning partial success#2678

Merged
chandra-siri merged 15 commits intomainfrom
feat/list-buckets-partial-success
Nov 28, 2025
Merged

feat(listBuckets): Add support for returning partial success#2678
chandra-siri merged 15 commits intomainfrom
feat/list-buckets-partial-success

Conversation

@thiyaguk09
Copy link
Contributor

Description

This change implements the returnPartialSuccess option for the getBuckets (or ListBuckets) method to handle scenarios where the external API returns a successful response but includes an unreachable list of resources.

  • New Option: The boolean parameter returnPartialSuccess is added to the GetBucketsRequest interface.
  • Behavior on true: If returnPartialSuccess is set to true and the API response contains resp.unreachable items, the method will execute the callback successfully (with err: null) and pass the array of unreachable bucket IDs as the fifth argument to the callback function.
  • Existing Behavior Preservation: If the option is false (or not set) and unreachable items are present, the function follows the existing failure flow (or implicitly returns success, depending on the previous behavior).
  • API Payload: The returnPartialSuccess parameter is correctly included in the query string (qs) sent to the API endpoint, as it is a known API parameter.

Impact

This change significantly improves the robustness of the ListBuckets operation. Users can now choose to tolerate minor, non-critical failures (like temporary unavailability of a few regions) and successfully retrieve and process the majority of available buckets, preventing a complete application failure.

Testing

  • Unit Tests: Yes, new unit tests have been added to cover the new logic.
    • New Test Cases: Added tests specifically verifying the 5-argument callback signature when returnPartialSuccess: true is set and the API returns an unreachable array.
    • Coverage: Confirmed correct behavior for full success, full failure, and the two partial success/failure modes.
  • Tests Changed: No existing tests were changed, only new ones were added.
  • Breaking Changes: No breaking changes are necessary for existing users. The fifth callback argument (unreachable) is strictly optional (?) and is only provided when explicitly enabled via the new option.

Additional Information

  • This implementation relies on the established convention of the underlying API returning unreachable resource IDs in the resp.unreachable property on a successful HTTP status code.
  • The use of a 5th argument in the callback (unreachable) was chosen to avoid modifying the primary result type (Bucket[]) and to maintain compatibility with existing consumers who expect the 4-argument signature.

Checklist

  • 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
  • Appropriate docs were updated
  • Appropriate comments were added, particularly in complex areas or places that require background
  • No new warnings or issues will be generated from this change

Fixes # 🦕

Implements the optional parameter `returnPartialSuccess`.

If set to `true` and the API response contains an `unreachable` array,
the function will return a successful callback (`err: null`) and pass
the `unreachable` array as the 5th argument.

This allows users to process the available buckets without the entire
operation failing on soft errors.
New sample for partial success in ListBuckets
(storage_list_buckets_partial_success)
@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: storage Issues related to the googleapis/nodejs-storage API. labels Nov 10, 2025
@thiyaguk09 thiyaguk09 marked this pull request as ready for review November 10, 2025 08:37
@thiyaguk09 thiyaguk09 requested a review from a team November 10, 2025 08:37
@thiyaguk09 thiyaguk09 requested a review from a team as a code owner November 10, 2025 08:37
@snippet-bot
Copy link

snippet-bot bot commented Nov 10, 2025

Here is the summary of changes.

You are about to add 1 region tag.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@generated-files-bot
Copy link

Warning: This pull request is touching the following templated files:

@thiyaguk09 thiyaguk09 force-pushed the feat/list-buckets-partial-success branch from 39babc7 to efc0453 Compare November 24, 2025 08:12
Copy link
Contributor

@ddelgrosso1 ddelgrosso1 left a comment

Choose a reason for hiding this comment

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

LGTM. Please remind me to merge and release this on December 2 after the code freeze is lifted.

@chandra-siri chandra-siri merged commit c7004da into main Nov 28, 2025
19 checks passed
@chandra-siri chandra-siri deleted the feat/list-buckets-partial-success branch November 28, 2025 06:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: storage Issues related to the googleapis/nodejs-storage API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants