-
Notifications
You must be signed in to change notification settings - Fork 280
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
Introspect message fields that change to see if the message definitions are compatible #2318
Comments
Yes, With regards to your example, this is a case where |
I see, thanks for the explanation. It looks like I had a misunderstanding of WIRE compatibility. I would have expected Whether or not this weakening is a good idea is of course subjective. I was mostly interested to find out why this happens. Feel free to close this issue if you want! :) |
Just ran into this myself. I think To be honest, it's more than a little bit frustrating, too! Messages regularly get renamed in protobuf codebases. This is a perfectly safe operation if you're not e.g. using the JSON format. But adding a new field with the new message name and removing the old field with the old message name is not a safe operation if you're e.g. persisting messages on disk, because those persisted messages will only have data for the old field.
I think this is at the heart of the problem. You exactly understood protobuf's actual wire compatibility! But what If
What about a magic comment that specifies the old name for a message? // buf:lint:old-name OldName
message NewName {
// ...
} Probably want something similar for packages, too:
Then |
…try/crypto to types (#2406) Moves the `MasterPublicKeyId` Protocol Buffers message definition, and subsequently also the contained `EcdsaCurve`, `EcdsaKeyId`, `SchnorrAlgorithm`, `SchnorrKeyId`, `VetKdCurve`, `VetKdKeyId` definitions from the `registry.crypto.v1` package to the `types.v1` package, without making any changes to the types in the process. This step is necessary so that we can later add an `optional MasterPublicKeyId key_id = 6;` field to the `types.v1.NiDkgId` message. Without the move, this would create a circular dependency between `registry/crypto/v1/crypto.proto` and `types/v1/types.proto` because `registry/crypto/v1.crypto.proto` imports `types/v1/types.proto` (so as to use `types.v1.SubnetId` in the `ChainKeySigningSubnetList`); Given that all message definitions remain unchanged and we only change the package, the _wire_ format of the messages is unchanged, which should make this change safe. However, changes like this lead to the `//pre-commit:buf-breaking` test to fail (even though `buf.yaml` is configured to use WIRE), which is a known deficiancy in the underlying `buf` compatibility-check library: bufbuild/buf#2318. Because of this, we set the `CI_OVERRIDE_BUF_BREAKING` flag to override this.
Consider two files
If I now change
foo
tobar
(renaming the directory,.proto
filename and package name), without changing the type definition,buf breaking
will report a breaking change, even though I configuredbuf.yaml
to useWIRE
.It's clear that renaming
foo
does not cause a WIRE-breaking change. Is this a known bug or limitation with buf? Or am I doing something wrong?The text was updated successfully, but these errors were encountered: