awslabs / amazon-kinesis-client

Client library for Amazon Kinesis
Apache License 2.0
641 stars 463 forks source link

Add a backwards compatibility check for .proto files #1362

Closed nakulj closed 1 month ago

nakulj commented 1 month ago

Issue #, if available:

Description of changes: In # 1361 we skip backwards compatibility tests for proto files because they were too brittle. By using protolock through this maven plugin we can instead test the proto files directly instead of inspecting the generated Java code, which is better because:

  1. It lets us ignore implementation specific details such as inheriting methods vs implementing them in the wrapper class directly
  2. It lets us catch problems like reassigning field numbers or forgetting to reserve deleted field numbers, which would be missed by simply inspecting the generated code.

To verify that this works locally, I made a basic incompatible change and verified that the check failed:

$ perl -pi -e 's,key = 1,key = 8,g' amazon-kinesis-client/src/main/proto/messages.proto
$ mvn proto-backwards-compatibility:backwards-compatibility-check -pl amazon-kinesis-client

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.