Skip to content

fix: allow Protobuf 6.x #1320

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Mar 10, 2025
Merged

fix: allow Protobuf 6.x #1320

merged 12 commits into from
Mar 10, 2025

Conversation

parthea
Copy link
Contributor

@parthea parthea commented Mar 5, 2025

See https://pypi.org/project/protobuf/6.30.0/
See googleapis/gapic-generator-python#2347 for removing dev in setup.py

Also update owlbot.py as the Owlbot post processor didn't run in #1321 so it wasn't clear that owlbot.py needed to be updated.

@parthea parthea requested review from a team as code owners March 5, 2025 11:10
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: spanner Issues related to the googleapis/python-spanner API. labels Mar 5, 2025
@parthea parthea added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 5, 2025
@parthea
Copy link
Contributor Author

parthea commented Mar 5, 2025

All pre-release tests are passing with protobuf 6.30.0 except test_iam_policy. This should be fixed before merging this PR to ensure that we have visibility of any new issues related to incremental changes of protobuf 6.x.

=================================== FAILURES ===================================
_______________________________ test_iam_policy ________________________________

not_emulator = None
shared_instance = <google.cloud.spanner_v1.instance.Instance object at 0x7fb49c02f230>
databases_to_delete = [<google.cloud.spanner_v1.database.Database object at 0x7fb49b86d040>]

    def test_iam_policy(
        not_emulator,
        shared_instance,
        databases_to_delete,
    ):
        pool = spanner_v1.BurstyPool(labels={"testcase": "iam_policy"})
        temp_db_id = _helpers.unique_id("iam_db", separator="_")
        create_table = (
            "CREATE TABLE policy (\n"
            + "    Id      STRING(36) NOT NULL,\n"
            + "    Field1  STRING(36) NOT NULL\n"
            + ") PRIMARY KEY (Id)"
        )
        create_role = "CREATE ROLE parent"
    
        temp_db = shared_instance.database(
            temp_db_id,
            ddl_statements=[create_table, create_role],
            pool=pool,
        )
        create_op = temp_db.create()
        databases_to_delete.append(temp_db)
        create_op.result(DBAPI_OPERATION_TIMEOUT)
        policy = temp_db.get_iam_policy(3)
    
        assert policy.version == 0
        assert policy.etag == b"\x00 \x01"
    
        new_binding = policy_pb2.Binding(
            role="roles/spanner.fineGrainedAccessUser",
            members=["user:asthamohta@google.com"],
            condition=expr_pb2.Expr(
                title="condition title",
                expression='resource.name.endsWith("/databaseRoles/parent")',
            ),
        )
    
        policy.version = 3
        policy.bindings.append(new_binding)
        temp_db.set_iam_policy(policy)
    
        new_policy = temp_db.get_iam_policy(3)
        assert new_policy.version == 3
>       assert new_policy.bindings == [new_binding]

tests/system/test_database_api.py:297: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = [role: "roles/spanner.fineGrainedAccessUser"
members: "user:asthamohta@google.com"
condition {
  expression: "resource.name.endsWith(\"/databaseRoles/parent\")"
  title: "condition title"
}
]
other = [role: "roles/spanner.fineGrainedAccessUser"
members: "user:asthamohta@google.com"
condition {
  expression: "resource.name.endsWith(\"/databaseRoles/parent\")"
  title: "condition title"
}
]

    def __eq__(self, other: Any) -> bool:
      """Compares the current instance with another one."""
      if self is other:
        return True
      if not isinstance(other, self.__class__):
>       raise TypeError('Can only compare repeated composite fields against '
                        'other repeated composite fields.')
E       TypeError: Can only compare repeated composite fields against other repeated composite fields.

.nox/8f8a4a6e/lib/python3.13/site-packages/google/protobuf/internal/containers.py:328: TypeError

@parthea
Copy link
Contributor Author

parthea commented Mar 5, 2025

See #1321 to update Kokoro presubmit to expose the existing issue unrelated to protobuf 6.x

@parthea
Copy link
Contributor Author

parthea commented Mar 5, 2025

Wait for #1321

@parthea parthea removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Mar 5, 2025
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 5, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 5, 2025
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 5, 2025
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Mar 5, 2025
@harshachinta
Copy link
Contributor

harshachinta commented Mar 6, 2025

@parthea
8d437e4 there are some updates from owlbot removing code in existing files in our PRs(#1318).
This PR has the exact same change.
Do you know why is owlbot removing those code and adding those commits as part of our PRs? And will merging this PR fix this issue?

@parthea
Copy link
Contributor Author

parthea commented Mar 7, 2025

@harshachinta , Owlbot Post Processor didn't run in #1321. As a result, it wasn't clear that owlbot.py needed to be updated at the time of merging #1321. The changes in this PR will resolve the issue where owlbot is removing code in other PRs. In terms of next steps, we can either merge this PR, or revert #1321

@surbhigarg92
Copy link
Contributor

@harshachinta , Owlbot Post Processor didn't run in #1321. As a result, it wasn't clear that owlbot.py needed to be updated at the time of merging #1321. The changes in this PR will resolve the issue where owlbot is removing code in other PRs. In terms of next steps, we can either merge this PR, or revert #1321

@parthea Could we merge this PR #1318 with owlbot changes. I realized that this PR needs more changes to fix the test_iam_policy tests. Meanwhile we would to merge the other PR

@parthea parthea merged commit 1faab91 into main Mar 10, 2025
15 of 16 checks passed
@parthea parthea deleted the allow-protobuf-6 branch March 10, 2025 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/python-spanner API. size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy