From 30dc40aaa02528b90da94da5f6ac89a1368925b8 Mon Sep 17 00:00:00 2001 From: Garry Tan Date: Sun, 7 Jun 2026 22:50:47 -0700 Subject: [PATCH] fix(review): route .mjs/.cjs/.mts/.cts changes to the backend reviewer (#1810) gstack-diff-scope backend detection matched only *.ts|*.js. Modern Node ships backend code as ESM (.mjs) / CommonJS (.cjs) and explicit-module TS (.mts/.cts); none matched any category, so a PR touching only those files reported no backend scope and the Review Army skipped the backend reviewer. Add the four module extensions to the backend case. Test covers all four. Reported by @jbetala7. Co-Authored-By: Claude Opus 4.8 (1M context) --- bin/gstack-diff-scope | 5 ++++- test/diff-scope.test.ts | 9 +++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bin/gstack-diff-scope b/bin/gstack-diff-scope index 36918381c..bf1b4af84 100755 --- a/bin/gstack-diff-scope +++ b/bin/gstack-diff-scope @@ -75,7 +75,10 @@ while IFS= read -r f; do # Backend: everything else that's code (excluding views/components already matched) *.rb|*.py|*.go|*.rs|*.java|*.php|*.ex|*.exs) BACKEND=true ;; - *.ts|*.js) BACKEND=true ;; # Non-component TS/JS is backend + # Non-component TS/JS is backend. Include ESM/CJS (.mjs/.cjs) and + # explicit-module TS (.mts/.cts) — #1810: these matched no category, so an + # ESM/CJS-only PR skipped the backend reviewer entirely. + *.ts|*.js|*.mjs|*.cjs|*.mts|*.cts) BACKEND=true ;; esac done <<< "$FILES" diff --git a/test/diff-scope.test.ts b/test/diff-scope.test.ts index 2130a3e57..3e80fe451 100644 --- a/test/diff-scope.test.ts +++ b/test/diff-scope.test.ts @@ -78,6 +78,15 @@ describe('gstack-diff-scope', () => { expect(scope.SCOPE_BACKEND).toBe('true'); }); + // #1810: ESM/CJS and explicit-module TS extensions matched no category, so an + // .mjs/.cjs/.mts/.cts-only PR skipped the backend reviewer entirely. + test('detects ESM/CJS/explicit-module backend files (#1810)', () => { + for (const f of ['server.mjs', 'worker.cjs', 'config.mts', 'legacy.cts']) { + const scope = runScope(createRepo([f])); + expect(scope.SCOPE_BACKEND).toBe('true'); + } + }); + test('detects test files', () => { const dir = createRepo(['test/app.test.ts']); const scope = runScope(dir);