Skip to content

fix(core): enhance validation for continuous task dependencies #31786

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AgentEnder
Copy link
Member

Current Behavior

We error if a non-parallel task has a continuous dependency, but when running a command that contains a task that depends on a continuous task which itself is marked as non-parallel we do not error. This results in the command hanging on the continuous non-parallel task, instead of running the parent task as well.

Expected Behavior

We error in both situations.

Related Issue(s)

Fixes #

Improve assertTaskGraphDoesNotContainInvalidTargets to validate two scenarios:
- Non-parallel tasks that depend on continuous tasks
- Non-parallel continuous tasks that are depended on by other tasks

Signed-off-by: AgentEnder <craigorycoppola@gmail.com>
@AgentEnder AgentEnder requested a review from a team as a code owner June 30, 2025 16:27
@AgentEnder AgentEnder requested a review from Cammisuli June 30, 2025 16:27
Copy link

vercel bot commented Jun 30, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ❌ Failed (Inspect) Jul 2, 2025 4:15pm

Copy link

nx-cloud bot commented Jun 30, 2025

View your CI Pipeline Execution ↗ for commit 4c8e4e8.

Command Status Duration Result
nx-cloud record -- nx format:check ❌ Failed 6s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 5s View ↗
nx documentation ✅ Succeeded 1m 13s View ↗

Nx Cloud AI Fix

Nx Cloud AI analyzes your failing CI tasks and automatically generates fixes whenever possible.

Description Status Link
Fix generation in progress ⏳ Not applied    View ↗  

☁️ Nx Cloud last updated this comment at 2025-07-02 16:10:10 UTC

Comment on lines +171 to +176
for (const dependency of taskGraph.continuousDependencies[task.id]) {
if (taskGraph.tasks[dependency].parallelism === false) {
nonParallelContinousTasksThatAreDependedOn.push(
taskGraph.tasks[dependency]
);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

The loop checking for non-parallel continuous tasks is nested inside the previous conditional block, which means it only executes when the current task has parallelism === false and has continuous dependencies. This will miss scenarios where a task with parallelism === true depends on a continuous task with parallelism === false.

To catch all cases where a continuous task with parallelism === false is depended on, this loop should be moved outside the previous if statement but kept within the main for loop that iterates through all tasks.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@nx-cloud nx-cloud bot requested a review from a team as a code owner July 2, 2025 15:59
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
@@ -159,19 +159,33 @@ export function validateNoAtomizedTasks(
export function assertTaskGraphDoesNotContainInvalidTargets(
taskGraph: TaskGraph
) {
const invalidTasks = [];
const nonParallelTasksThatDependOnContinuousTasks = [];
const nonParallelContinuousTasksThatAreDependedOn = [];
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a typo in the variable name nonParallelContinousTasksThatAreDependedOn (missing the letter 'u' in "Continuous"). This misspelling appears in multiple places in the file. The correct spelling should be nonParallelContinuousTasksThatAreDependedOn.

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

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.

2 participants