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

Fix query.go to avoid invalid protobuf assumptions #967

Merged
merged 1 commit into from Jul 8, 2019

Conversation

Projects
None yet
3 participants
@dsnet
Copy link
Contributor

commented Jul 8, 2019

The golang/protobuf compatibility agreement reserves the right add/remove
XXX fields and methods.

Fix this code to avoid assuming:

  • that XXX_WellKnownType always exists (it won't in the future).
    Instead, it should determine whether a message is a well-known type
    based on its full name.
  • that Go struct field indexes are stable (they aren't).
    An internal field may be added to the front of the message,
    causing the current assumptions to be invalidated.
    Instead, access the struct field by name, which will not change.
Fix query.go to avoid invalid protobuf assumptions
The golang/protobuf compatibility agreement reserves the right add/remove
XXX fields and methods.

Fix this code to avoid assuming:
* that XXX_WellKnownType always exists (it won't in the future).
Instead, it should determine whether a message is a well-known type
based on its full name.
* that Go struct field indexes are stable (they aren't).
An internal field may be added to the front of the message,
causing the current assumptions to be invalidated.
Instead, access the struct field by name, which will not change.

@googlebot googlebot added the cla: yes label Jul 8, 2019

@johanbrandhorst
Copy link
Collaborator

left a comment

Hi Joe, thanks for this, looks great.

@johanbrandhorst

This comment has been minimized.

Copy link
Collaborator

commented Jul 8, 2019

I've triggered a rerun of the flaky test.

@johanbrandhorst johanbrandhorst merged commit e911301 into grpc-ecosystem:master Jul 8, 2019

7 checks passed

ci/circleci: bazel Your tests passed on CircleCI!
Details
ci/circleci: build Your tests passed on CircleCI!
Details
ci/circleci: generate Your tests passed on CircleCI!
Details
ci/circleci: lint Your tests passed on CircleCI!
Details
ci/circleci: node_test Your tests passed on CircleCI!
Details
ci/circleci: test Your tests passed on CircleCI!
Details
cla/google All necessary CLAs are signed
@johanbrandhorst

This comment has been minimized.

Copy link
Collaborator

commented Jul 8, 2019

Thanks for your contribution! When will these changes be breaking? I.e. what version of golang/protobuf will require this commit to work?

@dsnet

This comment has been minimized.

Copy link
Contributor Author

commented Jul 8, 2019

When will these changes be breaking?

When google.golang.org/protobuf is released, we will also tag a github.com/golang/protobuf@v1.4.0 that depends on the new implementation. We're targeting a release at the end of July, but it's likely that the date will slip, unfortunately.

what version of golang/protobuf will require this commit to work?

Thus, anything that depends on the new implementation or v1.4.0+ will be broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.