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);