Skip to content
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

protobuf: Handle AbstractMessage descendants #1411

Merged
merged 5 commits into from
Feb 23, 2023
Merged

protobuf: Handle AbstractMessage descendants #1411

merged 5 commits into from
Feb 23, 2023

Conversation

dirceu
Copy link
Contributor

@dirceu dirceu commented Feb 22, 2023

Motivation

This fixes the issue described in #1410.

AbstractMessage is not new and I don't quite know yet why this is causing problems now (and why it didn't seem to cause problems for other services)—ah, it looks like they only added it to the most recent minor release.

Implementation

We changed the gather_constants method of the Protobuf compiler to check if Google::Protobuf::AbstractMessage is defined:

  • if it isn't, we preserve the old behaviour
  • if it is, we skip that class but gather its descendants

This has been tested with the repository used to report this bug.

@dirceu dirceu marked this pull request as ready for review February 22, 2023 21:35
@dirceu dirceu requested a review from a team as a code owner February 22, 2023 21:35
Copy link
Member

@vinistock vinistock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it easy/possible to add a test for this so that we don't regress? I'm fine shipping the fix and figuring the test later if it's complicated.

lib/tapioca/dsl/compilers/protobuf.rb Outdated Show resolved Hide resolved
... but not Google::Protobuf::AbstractMessage itself, as the RBI for
that class is already being created by `tapioca gem`.
Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
@dirceu dirceu changed the title protobuf: Fix case where descriptor is nil protobuf: Handle AbstractMessage descendants Feb 23, 2023
Copy link
Member

@paracycle paracycle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

lib/tapioca/dsl/compilers/protobuf.rb Outdated Show resolved Hide resolved
@dirceu dirceu merged commit a51d530 into main Feb 23, 2023
@dirceu dirceu deleted the fix-1410 branch February 23, 2023 16:29
@shopify-shipit shopify-shipit bot temporarily deployed to production February 23, 2023 20:07 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants