Conversation
…rvice REST stubs have no sibling Service constant, so const_defined? with the default inherit: true walks up to Object. An application-level ::Service is then treated as a gRPC Service and service_name is called on it, raising NoMethodError during client construction. Look up Service and Rest with inherit: false so only locally defined constants are considered. Fixes googleapis#70
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Author
|
CLA is signed and green now. The CI workflow run is sitting in Ran the suite locally in the meantime (Ruby 3.3.10, macOS):
Happy to adjust anything. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
toys ciin the gem subdirectory.closes: #70
Summary
Gapic::LoggingConcerns.normalize_servicelooks up theServiceconstant withconst_defined?'s defaultinherit: true. Generated REST stubs have no siblingService, so the lookup walks up toObject. If the application defines a top-level::Service, it is treated as a gRPCServiceandservice_nameis called on it, raisingNoMethodErrorduring client construction.gRPC transports are unaffected because they do define a local
Service.Change
Look up
ServiceandRestwithinherit: falseso only constants defined on the enclosing module are considered.Tests
On starship (Ruby 3.4.10):
toys test: 316 runs, 948 assertions, 0 failures, 0 errorsbundle exec rubocop lib: 42 files, no offensesbundle exec ruby -Ilib:test test/gapic/logging_concerns_test.rb: 10 runs, 12 assertions, 0 failures