Skip to content

Commit d102fe6

Browse files
fix(signals): classify Java gRPC service stubs as generated
Recognize grpc-java *Grpc.java service stubs in isGeneratedFile so generated-only diffs classify correctly for slop signals and the changed-files summary path-matcher dependency. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent b98229d commit d102fe6

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

src/signals/path-matchers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,13 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean {
5656
// the Elixir plugin emits `.pb.ex`, the Erlang gpb plugin emits `.pb.erl` / `.pb.hrl`, the Crystal
5757
// plugin emits `.pb.cr`, the Haskell plugin emits `.pb.hs`, and the Objective-C plugin emits
5858
// `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs. Swift gRPC emits sibling `.grpc.swift`
59-
// service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs.
59+
// service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs; grpc-java emits
60+
// sibling `*Grpc.java` service stubs.
6061
// `.pb.dart`/`.pb.kt`/`.pb.cs` (the `.pb` infix keeps hand-written sources from matching).
6162
/\.pb\.(go|ts|js|cc|h|swift|dart|kt|cs|rs|ex|erl|hrl|cr|hs)$/.test(norm) ||
6263
/\.grpc\.swift$/.test(norm) ||
6364
/grpckt\.kt$/.test(norm) ||
65+
/grpc\.java$/.test(norm) ||
6466
/\.pbobjc\.(h|m)$/.test(norm) ||
6567
/\.pbrpc\.(h|m)$/.test(norm) ||
6668
// Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling

test/unit/path-matchers.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,12 @@ describe("isGeneratedFile", () => {
144144
expect(classifyChangedFile("gen/GreeterGrpcKt.kt")).toBe("generated");
145145
});
146146

147+
it("matches Java gRPC service stubs alongside the other protoc plugins", () => {
148+
expect(isGeneratedFile("gen/GreeterGrpc.java")).toBe(true);
149+
expect(isGeneratedFile("src/Greeter.java")).toBe(false);
150+
expect(classifyChangedFile("gen/GreeterGrpc.java")).toBe("generated");
151+
});
152+
147153
it("matches JavaScript and TypeScript grpc-node protobuf stubs alongside the other protoc plugins", () => {
148154
expect(isGeneratedFile("gen/service_pb.js")).toBe(true);
149155
expect(isGeneratedFile("gen/service_grpc_pb.js")).toBe(true);
@@ -488,6 +494,7 @@ describe("classifyChangedFile", () => {
488494
["gen/service_pb.nim", "generated"],
489495
["gen/service_pb.lua", "generated"],
490496
["gen/GreeterGrpcKt.kt", "generated"],
497+
["gen/GreeterGrpc.java", "generated"],
491498
["gen/service_grpc_pb.js", "generated"],
492499
["gen/service_pb.d.ts", "generated"],
493500
["vendor/lib.go", "vendored"],

0 commit comments

Comments
 (0)