From d48494fef3aefdcdb98d72c47c3a3ca018f5758e Mon Sep 17 00:00:00 2001 From: jimcody1995 Date: Mon, 6 Jul 2026 08:22:25 +0200 Subject: [PATCH] fix(signals): classify C# and Dart gRPC service stubs as generated Recognize grpc-dotnet *Grpc.cs and Dart .pbgrpc.dart service stubs in isGeneratedFile so generated-only diffs classify correctly for slop signals and the changed-files summary classifier. Co-authored-by: Cursor --- src/signals/path-matchers.ts | 5 ++++- test/unit/path-matchers.test.ts | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/signals/path-matchers.ts b/src/signals/path-matchers.ts index b259556ed3..0130c34a3c 100644 --- a/src/signals/path-matchers.ts +++ b/src/signals/path-matchers.ts @@ -81,12 +81,15 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { // plugin emits `.pb.cr`, the Haskell plugin emits `.pb.hs`, the Scala plugin emits `.pb.scala`, 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; grpc-java emits - // sibling `*Grpc.java` service stubs. + // sibling `*Grpc.java` service stubs; grpc-dotnet emits sibling `*Grpc.cs` service stubs; the Dart + // gRPC plugin emits sibling `.pbgrpc.dart` 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|scala)$/.test(norm) || /\.grpc\.swift$/.test(norm) || /grpckt\.kt$/.test(norm) || /grpc\.java$/.test(norm) || + /grpc\.cs$/.test(norm) || + /\.pbgrpc\.dart$/.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 f574055c29..cefe1b4029 100644 --- a/test/unit/path-matchers.test.ts +++ b/test/unit/path-matchers.test.ts @@ -171,6 +171,15 @@ describe("isGeneratedFile", () => { expect(classifyChangedFile("gen/GreeterGrpcKt.kt")).toBe("generated"); }); + it("matches C# and Dart gRPC service stubs alongside the other protoc plugins", () => { + expect(isGeneratedFile("gen/GreeterGrpc.cs")).toBe(true); + expect(isGeneratedFile("lib/foo.pbgrpc.dart")).toBe(true); + expect(isGeneratedFile("src/Greeter.cs")).toBe(false); + expect(isGeneratedFile("lib/user.dart")).toBe(false); + expect(classifyChangedFile("gen/GreeterGrpc.cs")).toBe("generated"); + expect(classifyChangedFile("lib/foo.pbgrpc.dart")).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); @@ -524,6 +533,8 @@ describe("classifyChangedFile", () => { ["proto/messages.pb.scala", "generated"], ["gen/GreeterGrpcKt.kt", "generated"], ["gen/GreeterGrpc.java", "generated"], + ["gen/GreeterGrpc.cs", "generated"], + ["lib/foo.pbgrpc.dart", "generated"], ["gen/service_grpc_pb.js", "generated"], ["gen/service_pb.d.ts", "generated"], ["vendor/lib.go", "vendored"],