Skip to content

fix(ci-inference): only an ancestor script makes a cycle - #188

Merged
adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/ci-inference-script-diamond
Nov 18, 2026
Merged

adityankale190895 merged 1 commit into
DiffCI:mainfrom
FredApps:fix/ci-inference-script-diamond

Conversation

@FredApps

@FredApps FredApps commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #187

Changed behavior

Each nested resolveScript call now gets a copy of its ancestors instead of the one shared seen set. A script reached twice through different branches resolves normally, and only a script that reaches one of its own ancestors is reported as script cycle through <name>.

Validation

Unsupported cases

  • A diamond now resolves the shared script once per path, so its reference node appears more than once. The scripts are finite and the chain is acyclic, so this always terminates.
  • How nested yarn/pnpm verbs are read, for example yarn install inside a script, is unchanged here.

Note: #198 includes this PR, with the shared loop already resolved, so the two merge in either order.

resolveScript shared one seen set across sibling branches, so a script
reached twice (ci runs build and test, test runs build) was reported as a
cycle and the step was left not executable. Each nested call now gets its
own copy of its ancestors.

Fixes DiffCI#187

Signed-off-by: FredApps <[email protected]>
FredApps added a commit to FredApps/core that referenced this pull request Nov 17, 2026
…verbs

Each nested resolveScript call now gets a copy of its ancestors, as in DiffCI#188.
A script reached twice through different branches is not a cycle. Without
this copy, merging this branch after DiffCI#188 would bring that bug back.

Signed-off-by: FredApps <[email protected]>

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cross-review (Yandere-san). Head 5a72402.

Checked: each nested resolveScript now gets a copy of seen, so only an ancestor is a cycle. The diamond test fails on main (script cycle through build) and passes here; a real cycle is still UNRESOLVABLE. tests/ci-inference/*.test.ts pass locally. Hosted CI is green (12 success, change-impact neutral on the fork).

Overlap: #198 rewrites the same loop to use packageManagerCommand. On its original head the diamond test still failed. I pushed new Set(seen) and a diamond test to #198 as 166d94b, so merging #198 after this one will not bring the bug back.

No code changes on this branch. Nothing open here.

FredApps added a commit to FredApps/core that referenced this pull request Nov 18, 2026
…n either order

Both change the nested-script loop in resolveScript; this PR already carried DiffCI#188's fix (each nested call gets new Set(seen)). Merging DiffCI#188 in adds its diamond test and lets GitHub merge DiffCI#188 and this PR in either order, or this PR alone.

Signed-off-by: FredApps <[email protected]>
@FredApps
FredApps marked this pull request as ready for review November 18, 2026 00:56
@adityankale190895
adityankale190895 merged commit 28d09af into DiffCI:main Nov 18, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants