buf
buf copied to clipboard
Line and character are incorrectly reported in breaking change detection for rule FIELD_SAME_TYPE
Specifically, it seems to only affect the transition between a scalar type and a message type:
Setup:
dkichler➜~/sbt-buf-test» buf --version
1.1.0
dkichler➜~/sbt-buf-test» cat buf.work.yaml
directories:
- src/main/protobuf
- target/protobuf_external
version: v1
dkichler➜~/sbt-buf-test» tree src/main/protobuf target/protobuf_external
src/main/protobuf
├── buf.yaml
└── pkg
└── test.proto
target/protobuf_external
├── buf.yaml
├── google
│ └── protobuf
│ ├── any.proto
│ ├── api.proto
│ ├── compiler
│ │ └── plugin.proto
│ ├── descriptor.proto
│ ├── duration.proto
│ ├── empty.proto
│ ├── field_mask.proto
│ ├── source_context.proto
│ ├── struct.proto
│ ├── timestamp.proto
│ ├── type.proto
│ └── wrappers.proto
├── scalapb
│ ├── scalapb.proto
│ ├── validate-options.proto
│ └── validate.proto
└── validate
├── scalapb-options.proto
└── validate.proto
5 directories, 18 files
Test (changes in each case can be inferred from the error message):
dkichler➜~/sbt-buf-test» buf build ./ -o original.json
dkichler➜~/sbt-buf-test» atom src/main/protobuf/pkg/test.proto
dkichler➜~/sbt-buf-test» buf build ./ -o changed.json
dkichler➜~/sbt-buf-test» buf breaking --against original.json changed.json
pkg/test.proto:26:3:Field "1" on message "AnotherType" changed type from "message" to "string".
< change and rebuild >
dkichler➜~/sbt-buf-test» buf breaking --against original.json changed.json
pkg/test.proto:1:1:Field "1" on message "AnotherType" changed type from "string" to "message".
^^^^^ incorrect line/character report on string -> message
< change and rebuild >
dkichler➜~/sbt-buf-test» buf breaking --against original.json changed.json
pkg/test.proto:26:3:Field "1" on message "AnotherType" changed type from "string" to "int32".
< change and rebuild >
dkichler➜~/sbt-buf-test» buf breaking --against original.json changed.json
pkg/test.proto:26:3:Field "1" on message "AnotherType" changed type from "int32" to "string".
dkichler➜~/sbt-buf-test» buf breaking --against original.json changed.json < change and rebuild >
pkg/test.proto:1:1:Field "1" on message "AnotherType" changed type from "int32" to "message".
^^^^^ incorrect line/character report on int32 -> message
I'm on macOS
Can confirm with this minimal reproduction:
// cat int32/test.proto
syntax = "proto3";
message Foooo {
int32 foo = 1;
}
// int64/test.proto
syntax = "proto3";
message Foooo {
int64 foo = 1;
}
// message/test.proto
syntax = "proto3";
message Foooo {
Foooo foo = 1;
}
The comparisions output:
$ buf breaking --against ./int32 ./message
message/test.proto:1:1:Field "1" on message "Foooo" changed type from "int32" to "message".
$ buf breaking --against ./int32 ./int64
int64/test.proto:6:9:Field "1" on message "Foooo" changed type from "int32" to "int64".
$ buf breaking --against ./int64 ./message
message/test.proto:1:1:Field "1" on message "Foooo" changed type from "int64" to "message".