Skip to content

Planner: a script check is skipped when the changed file is named after a ${...} in a template literal #218

Closed

Description

@FredApps

What happens

narrowGateChecks decides whether a repository-script check (node scripts/x.mjs) can be skipped from the paths the script names (src/planner/script-reads.ts, decideScriptCheck). scanModule collects string literals, but for a template literal it keeps only node.head.text, the text before the first ${…}. Anything after a substitution is never seen.

So a script that reads

readFileSync(`${process.cwd()}/data/schema.json`, "utf8")

names no path at all, and a change to data/schema.json skips the check.

Repro

scripts: { check: "node scripts/check.mjs" }, tracked files scripts/check.mjs, data/schema.json, and scripts/check.mjs:

import { readFileSync } from "node:fs";
const schema = JSON.parse(readFileSync(`${process.cwd()}/data/schema.json`, "utf8"));
console.log(schema);

Changed: data/schema.json. On main (40aa308):

decision: SKIP   reason: "reads only its own code; no changed file there"

With a plain string, `data/${name}.json` or `${dir}/schema.json`, the same change correctly RUNs. Only text after a substitution is lost.

Impact

The check is skipped although the change is exactly the input it validates. That is the unsafe direction for a narrowing decision. `${root}/…` and `${process.cwd()}/…` are common ways to build paths in repository scripts.

Failing test

Added to tests/planner/script-reads.test.ts in the linked PR. Output on main:

✖ runs when a change is named after a template substitution
    actual: 'SKIP',
    expected: 'RUN',

Activity

  1. added a commit that references this issue on Nov 18, 2026
    f3357ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions