-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(query): remove engine validation for query (#9271)
### Description We don't want to validate certain issues with graphs with `turbo query`, because it should be still usable even with an invalid graph. ### Testing Instructions Added a test that shows that `turbo query` is tolerant of issues that `turbo run` is not.
- Loading branch information
1 parent
2a7c317
commit 7cb4f75
Showing
12 changed files
with
269 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/app-a/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "app-a", | ||
"scripts": { | ||
"build": "echo 'build app-a'", | ||
"test": "echo 'test app-a'" | ||
}, | ||
"dependencies": { | ||
"lib-a": "*" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/app-b/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "app-b", | ||
"scripts": { | ||
"build": "echo 'build app-b'", | ||
"test": "echo 'test app-b'" | ||
}, | ||
"dependencies": { | ||
"lib-b": "*", | ||
"lib-c": "*" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/lib-a/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "lib-a", | ||
"scripts": { | ||
"build": "echo 'build lib-a'", | ||
"test": "echo 'test lib-a'" | ||
}, | ||
"dependencies": { | ||
"lib-b": "*" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/lib-b/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "lib-b", | ||
"scripts": { | ||
"build": "echo 'build lib-b'", | ||
"test": "echo 'test lib-b'" | ||
}, | ||
"dependencies": { | ||
"lib-d": "*" | ||
} | ||
} |
6 changes: 6 additions & 0 deletions
6
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/lib-c/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"name": "lib-c", | ||
"scripts": { | ||
"build": "echo 'build lib-c'" | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/lib-d/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "lib-d", | ||
"scripts": { | ||
"build": "echo 'build lib-d'", | ||
"test": "echo 'test lib-d'" | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "unknown-dependency", | ||
"workspaces": [ | ||
"app-a", | ||
"app-b", | ||
"lib-a", | ||
"lib-b", | ||
"lib-c", | ||
"lib-d" | ||
] | ||
} |
32 changes: 32 additions & 0 deletions
32
turborepo-tests/integration/fixtures/task_dependencies/invalid-dependency/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"tasks": { | ||
"build0": { | ||
"dependsOn": [ | ||
"^build0", | ||
"prepare" | ||
] | ||
}, | ||
"test": { | ||
"dependsOn": [ | ||
"^build0", | ||
"prepare" | ||
] | ||
}, | ||
"prepare": {}, | ||
"side-quest": { | ||
"dependsOn": [ | ||
"prepare" | ||
] | ||
}, | ||
"build1": { | ||
"dependsOn": [ | ||
"^build1" | ||
] | ||
}, | ||
"build2": { | ||
"dependsOn": [ | ||
"app-a#custom" | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../../helpers/setup_integration_test.sh persistent_dependencies/10-too-many | ||
|
||
Validate that we get an error when we try to run multiple persistent tasks with concurrency 1 | ||
$ ${TURBO} run build --concurrency=1 | ||
x invalid task configuration | ||
|
||
Error: x You have 2 persistent tasks but `turbo` is configured for concurrency of | ||
| 1. Set --concurrency to at least 3 | ||
|
||
[1] | ||
|
||
However on query, we ignore this validation | ||
$ ${TURBO} query "query { packages { items { tasks { items { fullName } } } } }" | jq | ||
WARNING query command is experimental and may change in the future | ||
{ | ||
"data": { | ||
"packages": { | ||
"items": [ | ||
{ | ||
"tasks": { | ||
"items": [] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "one#build" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "two#build" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} | ||
|
||
Setup | ||
$ . ${TESTDIR}/../../../helpers/setup_integration_test.sh task_dependencies/invalid-dependency | ||
warning: re-init: ignored --initial-branch=main | ||
|
||
Validate that we get an error when trying to depend on a task that doesn't exist | ||
$ ${TURBO} run build2 | ||
x Could not find "app-a#custom" in root turbo.json or "custom" in package | ||
,-[turbo.json:27:1] | ||
27 | "dependsOn": [ | ||
28 | "app-a#custom" | ||
: ^^^^^^^^^^^^^^ | ||
29 | ] | ||
`---- | ||
|
||
[1] | ||
|
||
However, we don't get an error when we query | ||
$ ${TURBO} query "query { packages { items { tasks { items { fullName } } } } }" | jq | ||
WARNING query command is experimental and may change in the future | ||
{ | ||
"data": { | ||
"packages": { | ||
"items": [ | ||
{ | ||
"tasks": { | ||
"items": [] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "app-a#build" | ||
}, | ||
{ | ||
"fullName": "app-a#test" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "app-b#build" | ||
}, | ||
{ | ||
"fullName": "app-b#test" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "lib-a#build" | ||
}, | ||
{ | ||
"fullName": "lib-a#test" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "lib-b#build" | ||
}, | ||
{ | ||
"fullName": "lib-b#test" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "lib-c#build" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"tasks": { | ||
"items": [ | ||
{ | ||
"fullName": "lib-d#build" | ||
}, | ||
{ | ||
"fullName": "lib-d#test" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |