mirror of
https://github.com/garrytan/gstack.git
synced 2026-06-17 07:10:12 +02:00
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) <noreply@anthropic.com>
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user