Skip to content

chore(CloudCommonProtos): remove orphaned AttributeContext metadata - #9533

Open
sofisl wants to merge 3 commits into
mainfrom
chore/cloud-common-protos-remove-orphaned-metadata
Open

chore(CloudCommonProtos): remove orphaned AttributeContext metadata#9533
sofisl wants to merge 3 commits into
mainfrom
chore/cloud-common-protos-remove-orphaned-metadata

Conversation

@sofisl

@sofisl sofisl commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The AttributeContext proto correctly belongs to CommonProtos (which maps to google/rpc), not CloudCommonProtos (which maps to google/cloud/audit, etc.). During the migration of common-protos to this repository in PR #7554, the metadata file was accidentally duplicated here, but the actual source classes were correctly placed in CommonProtos.

This orphaned metadata file creates a namespace collision when both packages are loaded, as shown in the test below:

<?php
require __DIR__ . '/vendor/autoload.php';

if (class_exists('\GPBMetadata\Google\Rpc\Context\AttributeContext')) {
    echo "Class exists\n";
    $reflector = new \ReflectionClass('\GPBMetadata\Google\Rpc\Context\AttributeContext');
    echo "Found in: " . $reflector->getFileName() . "\n";
} else {
    echo "Class not found\n";
}

Output on main when testing in CloudCommonProtos:

Class exists
Found in: /usr/local/google/home/sofialeon/google-cloud-php/CloudCommonProtos/metadata/Rpc/Context/AttributeContext.php

However, CloudCommonProtos lacks the src class (Google\Rpc\Context\AttributeContext), which relies entirely on CommonProtos. Removing this duplicate file ensures the metadata is correctly loaded from CommonProtos, resolving the shadow collision. Librarian correctly flagged this duplicate file for deletion.

Practically non-breaking since the users will still have the class available given the composer.json bump

For googleapis/librarian#7366

The `AttributeContext` proto correctly belongs to `CommonProtos`, not `CloudCommonProtos`. During the migration of common-protos to this repository in PR #7554, the metadata file was accidentally duplicated here, but the actual source classes were correctly placed in `CommonProtos`. This removes the useless orphaned metadata file.

@bshaffer bshaffer 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.

If we update composer.json to require google/common-protos:^4 (drop support for 3), then this change will be non-breaking. Also, this is something we probably should have done a long time ago anyway

@sofisl

sofisl commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Done! I've bumped the requirement to "google/common-protos": "^4.0" in composer.json. I modified the BREAKING_CHANGE_REASON to account for the change. Thanks for the suggestion!

@sofisl
sofisl requested a review from bshaffer August 25, 2026 22:00
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.

2 participants