Skip to content

DRAFT feat(gapic-generator): add support for resumable uploads - #18354

Draft
parthea wants to merge 1 commit into
mainfrom
feat/resumable-transfer-gapic-generator
Draft

DRAFT feat(gapic-generator): add support for resumable uploads#18354
parthea wants to merge 1 commit into
mainfrom
feat/resumable-transfer-gapic-generator

Conversation

@parthea

@parthea parthea commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

Towards b/457416314, b/556259599

@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 introduces support for resumable upload methods in the GAPIC generator, updating schema wrappers, templates, and options to handle media upload protocols, while adding comprehensive system and unit tests. Feedback on the changes suggests avoiding potential breaking changes by generating media upload methods as standard RPCs when resumable_upload_prefix is not configured, rather than omitting them entirely. Additionally, it is recommended to deduplicate helper functions like resume_resumable_upload and make_resumable_upload across the newly added system test files by moving them to a shared utility module or conftest.py.

Comment on lines +1637 to +1638
if self._is_media_upload_proto(meth_pb) and not self.opts.resumable_upload_prefix:
continue

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.

high

Skipping the generation of media upload methods entirely when resumable_upload_prefix is not configured can introduce breaking changes for downstream users who previously relied on these methods being generated as standard RPCs. Consider allowing them to be generated as standard (non-resumable) methods instead of omitting them completely.

References
  1. Do not replace historical graceful fallback behaviors with exceptions or omit them if doing so would introduce breaking changes for downstream users and violate backwards compatibility.

Comment on lines +30 to +37
def resume_resumable_upload(
transport,
upload_url,
stream,
size=None,
config=None,
**kwargs,
):

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.

medium

The helper function resume_resumable_upload (and make_resumable_upload in other files) is duplicated across multiple test files (e.g., test_resumable_upload_basic.py, test_resumable_upload_resume.py, test_resumable_upload_errors.py, etc.). To improve maintainability and reduce code duplication, consider moving these helpers to a shared utility module or defining them in conftest.py.

References
  1. Remove duplicate lines of code, especially duplicate assertions in tests, to keep the codebase clean and avoid redundancy.

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