Skip to content

feat: add fixed-key metadata support in AAOW#16817

Draft
nidhiii-27 wants to merge 1 commit intomainfrom
add-fixed-key-metadata-aaow-11384837182247010380
Draft

feat: add fixed-key metadata support in AAOW#16817
nidhiii-27 wants to merge 1 commit intomainfrom
add-fixed-key-metadata-aaow-11384837182247010380

Conversation

@nidhiii-27
Copy link
Copy Markdown
Contributor

Add fixed-key metadata support in AAOW by updating blob_to_proto conversion logic.

  • Updated _grpc_conversions.py with simple and complex field mappings.
  • Added unit tests in tests/unit/test__grpc_conversions.py.
  • Updated system tests in tests/system/test_zonal.py.
  • Fixed regression in tests/unit/asyncio/test_async_write_object_stream.py.

PR created automatically by Jules for task 11384837182247010380 started by @nidhiii-27

This change extends `blob_to_proto` in `_grpc_conversions.py` to support
additional fixed-key metadata fields when creating an object via the
gRPC-based AsyncAppendableObjectWriter.

Supported fields added:
- Simple mappings: cache_control, content_disposition, content_encoding,
  content_language, temporary_hold, event_based_hold.
- Complex mappings: custom_time (datetime), acl (ObjectAccessControl),
  contexts (ObjectContexts), and retention (Object.Retention).

Also updated unit tests and system tests to verify these new fields.

Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link
Copy Markdown
Contributor

@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 expands the gRPC conversion logic for Blob objects to include additional metadata fields such as cache_control, custom_time, acl, and retention, supported by new unit and system tests. The review feedback identifies that the check for the loaded attribute on ACLs is too restrictive for upload operations and recommends a more concise implementation using a list comprehension.

Comment on lines +56 to +66
if acl is not None and getattr(acl, "loaded", False):
acl_entries = []
for entry in acl:
acl_entries.append(
_storage_v2.ObjectAccessControl(
role=entry["role"],
entity=entry["entity"],
)
)
if acl_entries:
resource_params["acl"] = acl_entries
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 check getattr(acl, "loaded", False) is too restrictive for an upload/write operation. In the google-cloud-storage library, a Blob's ACL object may have locally-added entries even if it hasn't been "loaded" from the server (which is always the case for a new blob). Checking if acl: is sufficient to determine if there are entries to be sent, and using a list comprehension makes the conversion more concise.

Suggested change
if acl is not None and getattr(acl, "loaded", False):
acl_entries = []
for entry in acl:
acl_entries.append(
_storage_v2.ObjectAccessControl(
role=entry["role"],
entity=entry["entity"],
)
)
if acl_entries:
resource_params["acl"] = acl_entries
if acl:
acl_entries = [
_storage_v2.ObjectAccessControl(
role=entry["role"],
entity=entry["entity"],
)
for entry in acl
]
if acl_entries:
resource_params["acl"] = acl_entries

@nidhiii-27 nidhiii-27 changed the title Add fixed-key metadata support in AAOW feat: add fixed-key metadata support in AAOW Apr 27, 2026
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