From 10f98bc401493e430c40ddba468d2cb2e0ef0dcb Mon Sep 17 00:00:00 2001 From: jimcody1995 Date: Sun, 5 Jul 2026 08:44:22 +0200 Subject: [PATCH] fix(signals): classify Kotlin protobuf stubs as generated protoc's Kotlin plugin emits .pb.kt message stubs; slop already treated .pb.dart/.pb.swift as generated but missed .pb.kt, so machine output was miscounted as substantive source. Co-authored-by: Cursor --- src/signals/path-matchers.ts | 4 ++-- test/unit/path-matchers.test.ts | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/signals/path-matchers.ts b/src/signals/path-matchers.ts index 7629e6745f..e03567221e 100644 --- a/src/signals/path-matchers.ts +++ b/src/signals/path-matchers.ts @@ -52,8 +52,8 @@ function isGeneratedFileFrom(parts: NormalizedPath): boolean { /\.(generated|gen)\.[^/]+$/.test(norm) || // protoc output: Go/TS/JS plugins emit `.pb.{go,ts,js}`, the reference C++ plugin emits // `.pb.cc` / `.pb.h`, the Swift plugin emits `.pb.swift`, and the Dart plugin emits - // `.pb.dart` (the `.pb` infix keeps hand-written `.dart` from matching). - /\.pb\.(go|ts|js|cc|h|swift|dart)$/.test(norm) || + // `.pb.dart` (the `.pb` infix keeps hand-written `.dart`/`.kt` from matching). + /\.pb\.(go|ts|js|cc|h|swift|dart|kt)$/.test(norm) || // Python protobuf: message stubs are `*_pb2.py[i]`; the gRPC plugin emits sibling // `*_pb2_grpc.py[i]` service stubs, which are the same machine-generated output. /_pb2(_grpc)?\.pyi?$/.test(norm) || diff --git a/test/unit/path-matchers.test.ts b/test/unit/path-matchers.test.ts index bc149b2291..cac5f2dd79 100644 --- a/test/unit/path-matchers.test.ts +++ b/test/unit/path-matchers.test.ts @@ -77,6 +77,7 @@ describe("isGeneratedFile", () => { for (const path of [ "proto/messages.pb.swift", "proto/messages.pb.dart", + "proto/messages.pb.kt", "lib/user.freezed.dart", "lib/api_client.gr.dart", "ui/MainForm.Designer.cs", @@ -85,7 +86,7 @@ describe("isGeneratedFile", () => { expect(isGeneratedFile(path)).toBe(true); } // hand-written siblings must NOT match (the codegen infix is required). - for (const path of ["src/MainForm.cs", "lib/user.dart", "net/message.swift"]) { + for (const path of ["src/MainForm.cs", "lib/user.dart", "src/service.kt", "net/message.swift"]) { expect(isGeneratedFile(path)).toBe(false); } });