From 4fa34727eddb5ad6a1e82f17f85538b359548556 Mon Sep 17 00:00:00 2001 From: jaso0n0818 Date: Wed, 24 Jun 2026 21:02:57 +0000 Subject: [PATCH] feat(signals): delegate isTestFile to test-evidence isTestPath Route local-branch scoring through the shared test path matcher so slop classification and branch previews never drift when test-evidence gains new conventions (#1046). Co-authored-by: Cursor --- src/signals/local-branch.ts | 10 +++------- test/unit/local-branch-file-classifiers.test.ts | 4 ++++ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/signals/local-branch.ts b/src/signals/local-branch.ts index 98c5cde15a..0b3d2de90a 100644 --- a/src/signals/local-branch.ts +++ b/src/signals/local-branch.ts @@ -26,6 +26,7 @@ import { deriveEligibilityPlan } from "../services/eligibility-plan"; import { scenarioInputFromLocalBranchMetadata } from "../scenarios/input-model"; import { renderPublicScenarioSummary, type PublicScenarioSummary, type ScenarioSummaryInput } from "../scenarios/scenario-summary"; import { simulateOpenPrPressure } from "../services/open-pr-pressure-scenarios"; +import { isTestPath } from "./test-evidence"; export type LocalBranchChangedFile = { path: string; @@ -1232,13 +1233,8 @@ function safeRepoPath(path: string): string { } export function isTestFile(file: string): boolean { - return ( - /(^|\/)(test|tests|spec|__tests__)\//i.test(file) || - /(^|\/)src\/test\//i.test(file) || - /(^|\/)[^/]+_test\.(go|py|rb)$/i.test(file) || - /(^|\/)[^/]+_spec\.rb$/i.test(file) || - /\.(test|spec)\.(ts|tsx|js|jsx|py|rb|rs)$/i.test(file) - ); + // Keep local scoring aligned with slop/test-evidence matchers (#561 / #1046). + return isTestPath(file); } export function isCodeFile(file: string): boolean { diff --git a/test/unit/local-branch-file-classifiers.test.ts b/test/unit/local-branch-file-classifiers.test.ts index 310ed41239..45c0589aa1 100644 --- a/test/unit/local-branch-file-classifiers.test.ts +++ b/test/unit/local-branch-file-classifiers.test.ts @@ -85,6 +85,10 @@ describe("isTestFile", () => { expect(isTestFile(path)).toBe(false); } }); + + it("delegates to test-evidence isTestPath so matchers stay in sync", () => { + expect(isTestFile("tests/integration/api.test.ts")).toBe(true); + }); }); describe("isCodeFile", () => {