From 2cb5c7aca67aac3760707d194aeee2b157cfaa91 Mon Sep 17 00:00:00 2001 From: luciferlive112116 <291889058+luciferlive112116@users.noreply.github.com> Date: Mon, 6 Jul 2026 01:42:42 +0800 Subject: [PATCH] fix(signals): classify Java gRPC service stubs as generated Recognize grpc-java *Grpc.java protoc output in isGeneratedFile, matching the existing Swift/Kotlin gRPC stub conventions. Co-authored-by: Cursor --- src/signals/path-matchers.ts | 4 +++- test/unit/path-matchers.test.ts | 7 +++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/signals/path-matchers.ts b/src/signals/path-matchers.ts index da30bd1e84..b22b0a89cd 100644 --- a/src/signals/path-matchers.ts +++ b/src/signals/path-matchers.ts @@ -56,11 +56,13 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { // the Elixir plugin emits `.pb.ex`, the Erlang gpb plugin emits `.pb.erl` / `.pb.hrl`, the Crystal // plugin emits `.pb.cr`, the Haskell plugin emits `.pb.hs`, and the Objective-C plugin emits // `.pbobjc.{h,m}` plus gRPC `.pbrpc.{h,m}` service stubs. Swift gRPC emits sibling `.grpc.swift` - // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs. + // service stubs; grpc-kotlin emits sibling `*GrpcKt.kt` coroutine service stubs; grpc-java emits + // sibling `*Grpc.java` service stubs. // `.pb.dart`/`.pb.kt`/`.pb.cs` (the `.pb` infix keeps hand-written sources from matching). /\.pb\.(go|ts|js|cc|h|swift|dart|kt|cs|rs|ex|erl|hrl|cr|hs)$/.test(norm) || /\.grpc\.swift$/.test(norm) || /grpckt\.kt$/.test(norm) || + /grpc\.java$/.test(norm) || /\.pbobjc\.(h|m)$/.test(norm) || /\.pbrpc\.(h|m)$/.test(norm) || // Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling diff --git a/test/unit/path-matchers.test.ts b/test/unit/path-matchers.test.ts index c4d4c3c27c..c2c013f8fb 100644 --- a/test/unit/path-matchers.test.ts +++ b/test/unit/path-matchers.test.ts @@ -144,6 +144,12 @@ describe("isGeneratedFile", () => { expect(classifyChangedFile("gen/GreeterGrpcKt.kt")).toBe("generated"); }); + it("matches Java gRPC service stubs alongside the other protoc plugins", () => { + expect(isGeneratedFile("gen/GreeterGrpc.java")).toBe(true); + expect(isGeneratedFile("src/Greeter.java")).toBe(false); + expect(classifyChangedFile("gen/GreeterGrpc.java")).toBe("generated"); + }); + it("matches Swift protobuf, Dart freezed/retrofit, C# designer/XAML, and Objective-C protoc output", () => { for (const path of [ "proto/messages.pb.swift", @@ -474,6 +480,7 @@ describe("classifyChangedFile", () => { ["gen/service_pb.nim", "generated"], ["gen/service_pb.lua", "generated"], ["gen/GreeterGrpcKt.kt", "generated"], + ["gen/GreeterGrpc.java", "generated"], ["vendor/lib.go", "vendored"], ["package-lock.json", "lockfile"], ["bun.lock", "lockfile"],