Skip to content

fix(storage): forward client in Blob.update_storage_class - #19152

Open
abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix-storage-update-storage-class-client
Open

abhishekacharya200 wants to merge 1 commit into
googleapis:mainfrom
abhishekacharya200:fix-storage-update-storage-class-client

Conversation

@abhishekacharya200

Copy link
Copy Markdown
Contributor

Blob.update_storage_class accepts a client argument and documents it ("The client to use. If not passed, falls back to the client stored on the blob's bucket"), but it never passed it on. Both self.rewrite(...) calls in the method left client out, so rewrite always fell back to the bucket's client and the argument had no effect.

This forwards client=client in both rewrite calls (the first one and the token loop).

The existing unit tests asserted the exact rewrite call and did not include client, so I updated those expectations and added test_update_storage_class_single_pass_w_client and test_update_storage_class_multi_pass_w_client. With the source change reverted, the update_storage_class tests fail on main (25 failures); with it, all of tests/unit/test_blob.py passes (404 passed). ruff format --check reports nothing on the changed files.

  • Make sure to open an issue as a bug/issue before writing your code (no issue opened, this is a small one-argument fix)
  • Ensure the tests and linter pass
  • Code coverage does not decrease (not measured)

@abhishekacharya200
abhishekacharya200 requested review from a team as code owners November 20, 2026 08:46

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

Copy link
Copy Markdown
Contributor

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 update_storage_class method in blob.py to pass the client parameter to the underlying rewrite calls. Additionally, it updates the unit tests to verify this behavior in both single-pass and multi-pass scenarios. I have no feedback to provide as the changes are correct and well-tested.

This branch has not been deployed

No deployments
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