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

Do not call has_presence? on Protobuf::FieldDescriptor unless method exists #1840

Merged
merged 2 commits into from
Mar 26, 2024

Conversation

egiurleo
Copy link
Contributor

@egiurleo egiurleo commented Mar 25, 2024

Motivation

#1835 introduced a bug in the Google Protobuf compiler -- on versions of the google-protobuf gem older than 3.26, the has_presence? method does not exist on the FieldDescriptor class. Calling it during DSL RBI compilation will result in an error.

Implementation

If the has_presence? method is not defined on FieldDescriptor, call has? instead.

Tests

Added an automated test.

@egiurleo egiurleo added the bug Something isn't working label Mar 25, 2024
@egiurleo egiurleo force-pushed the emily/fix-protobuf-compiler branch from 6094e12 to 79dc271 Compare March 25, 2024 21:59
@egiurleo egiurleo added bugfix and removed bug Something isn't working labels Mar 25, 2024
@egiurleo egiurleo force-pushed the emily/fix-protobuf-compiler branch from 68513a1 to c7cb116 Compare March 26, 2024 20:07
@egiurleo egiurleo marked this pull request as ready for review March 26, 2024 20:08
@egiurleo egiurleo requested a review from a team as a code owner March 26, 2024 20:08
…hod exists

`FieldDescriptor#has_presence?` was defined in `google-protobuf` version 3.26,
so any application using an older version would have run into an error when
compiling Protobuf DSLs.

Co-authored-by: Ufuk Kayserilioglu <ufuk.kayserilioglu@shopify.com>
@egiurleo egiurleo force-pushed the emily/fix-protobuf-compiler branch from c7cb116 to 76a3018 Compare March 26, 2024 20:44
spec/tapioca/cli/dsl_spec.rb Outdated Show resolved Hide resolved
spec/tapioca/cli/dsl_spec.rb Outdated Show resolved Hide resolved
spec/tapioca/cli/dsl_spec.rb Show resolved Hide resolved
@egiurleo egiurleo self-assigned this Mar 26, 2024
Co-authored-by: Alexandre Terrasa <alexandre.terrasa@shopify.com>
@egiurleo egiurleo merged commit cc008be into main Mar 26, 2024
34 checks passed
@egiurleo egiurleo deleted the emily/fix-protobuf-compiler branch March 26, 2024 21:26
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

3 participants