Skip to content

gstack-diff-scope misses backend code in .mjs/.cjs/.mts/.cts files (review army skips backend reviewer) #1810

@jbetala7

Description

@jbetala7

Observed problem

bin/gstack-diff-scope categorizes changed files into scope signals (SCOPE_FRONTEND, SCOPE_BACKEND, etc.) that the Review Army uses to decide which specialist reviewers to spin up (scripts/resolvers/review-army.ts, review.ts). Backend detection only matches *.ts and *.js:

*.ts|*.js) BACKEND=true ;;  # Non-component TS/JS is backend

Modern Node projects ship backend code as ESM .mjs / CommonJS .cjs, and explicit-module TypeScript as .mts / .cts. None of these match *.ts or *.js (the glob requires the string to end in .ts/.js, and server.mjs does not). They also match no other category, so a PR touching only those files produces all-false scope flags.

Current behavior on upstream main (3bef43b)

$ printf 'y' > server.mjs   # in a feature branch
$ gstack-diff-scope main
SCOPE_FRONTEND=false
SCOPE_BACKEND=false        # <-- backend code, but no scope detected
...

Same for server.cjs, mod.mts, legacy.cts. With no scope flag set, the review army skips the backend (and security) reviewers for these changes.

Expected behavior

.mjs, .cjs, .mts, .cts are non-component code and should set SCOPE_BACKEND=true, exactly like .ts/.js.

Duplicate searches performed

  • Open/closed PRs: searched diff-scope, mjs, SCOPE_BACKEND — only match touching this file is unrelated (fix: use three-dot diff for scope drift detection in /review #221, three-dot diff). No PR adds these extensions.
  • Open issues: searched diff-scope, mjs, scope — no match for this gap.
  • git log -- bin/gstack-diff-scope — last touched by the v1.44.1.0 fix wave and the Review Army feature; extensions never added.

Candidate fix shape

Add the four extensions to the existing backend case (purely additive — no file currently classified is reclassified):

*.ts|*.mts|*.cts|*.js|*.mjs|*.cjs) BACKEND=true ;;

Plus a regression test in test/diff-scope.test.ts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions