Skip to content

CI inference: a script reached twice through package.json (a diamond) is reported as a script cycle #187

Closed

Description

@FredApps

What happens

resolveScript (src/ci-inference/resolve.ts) passes one seen set to every nested call, so it records every script visited anywhere in the tree, not just the current chain of ancestors. A script reached through two different branches, a diamond, is then reported as UNRESOLVABLE: script cycle through <name> even though there is no cycle.

Repro

{ "scripts": { "ci": "npm run build && npm run test", "test": "npm run build && jest", "build": "tsc" } }

resolveScript(dir, "ci", …) on main (40aa308):

ci:    UNRESOLVED   depends on 2 unresolved reference(s)
test:  UNRESOLVED   depends on 1 unresolved reference(s)
build: UNRESOLVABLE script cycle through build

Through inferPipeline, with a committed lockfile and steps npm ci then npm run ci, the npm run ci operation is executable: false on main and true with the fix. SCRIPTS_RESOLVED fails on the phantom cycle.

Impact

This is a false refusal for a common package.json shape: a top-level ci or test script that builds first, while a nested script also builds. The operation and its purpose path are reported not executable, and the receipt blames a cycle that does not exist.

Failing test

tests/ci-inference/script-diamond.test.ts in the linked PR. Output on main:

✖ a script reached through two branches is not a cycle
  ... {"identifier":"build","resolution":"UNRESOLVABLE", ... "reason":"script cycle through build"}
    actual: 'UNRESOLVED',
    expected: 'RESOLVED',
✔ a real cycle is still unresolvable

Activity

  1. added a commit that references this issue on Nov 18, 2026
    28d09af
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