-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
fix(query): remove engine validation for query #9271
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Up to you since you're the one driving
query
, but returning information that we know is incorrect feels off to me. Do we need to worry about panics down the line in query around assumptions that every task has a valid package and has valid task dependencies?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's necessary so people can use query to help refactor their repos into valid configurations for turbo. But yeah, we will have to watch out for panics. I have a larger plan to switch us to a compiler-y error model where we accumulate diagnostics and try to recover from errors as much as possible.