-
Notifications
You must be signed in to change notification settings - Fork 259
fix(2892): consider entity resolvers in n + 1 check #2978
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
Merged
Merged
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
e7dbb91
feat(npo): implement n+1 checks for entity resolvers
meskill 351a90d
fix caching
meskill 47b546a
fix lint
meskill 5d2fbd7
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill ec2bf54
update message for snaps
tusharmath 051e259
Merge branch 'main' into fix/npo-entity
tusharmath 2d4d2af
revert type resolver
tusharmath 503288f
test: add additional test case
meskill 5894dfc
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill 39f1770
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill bf6fd5f
fix test config
meskill 4a8cb3f
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill 637c660
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill 436d906
fix lint
meskill 6305b93
Merge branch 'main' into fix/npo-entity
tusharmath 9fe4750
Merge branch 'main' into fix/npo-entity
meskill 7bd5e65
fix fixtures
meskill e5b03c8
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill e04d649
simplify the code and add more tests
meskill f15f2cb
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill 96e6bf1
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill 5bf0761
fix chunk usage
meskill 0baa0e8
Merge branch 'main' into fix/npo-entity
meskill ad9051a
Merge branch 'main' into fix/npo-entity
meskill f667e8e
Merge branch 'main' into fix/npo-entity
amitksingh1490 71915a6
Merge remote-tracking branch 'origin/main' into fix/npo-entity
meskill bceaa40
fix compilation error
meskill 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
type T1 @http(url: "") { | ||
t1: Int | ||
} | ||
|
||
type T2 @http(url: "") { | ||
t2: [N] @http(url: "") | ||
} | ||
|
||
type T3 @http(url: "", batchKey: ["id"]) { | ||
t3: [N] @http(url: "") | ||
} | ||
|
||
type T4 @http(url: "", batchKey: ["id"]) { | ||
t4: [N] @http(url: "", batchKey: ["id"]) | ||
} | ||
|
||
type T5 @http(url: "", batchKey: ["id"]) { | ||
t5: [String] @http(url: "", batchKey: ["id"]) | ||
} | ||
|
||
type T6 @http(url: "", batchKey: ["id"]) { | ||
t6: [Int] | ||
} | ||
|
||
type N { | ||
n: [Int] @http(url: "") | ||
} | ||
|
||
type Query { | ||
x: String | ||
t1: T1 @http(url: "") | ||
t2: T2 @http(url: "") | ||
t3: T3 @http(url: "") | ||
t4: T4 @http(url: "") | ||
t5: T5 @http(url: "") | ||
t6: T6 @http(url: "") | ||
t1_ls: [T1] @http(url: "") | ||
t2_ls: [T2] @http(url: "") | ||
t3_ls: [T3] @http(url: "") | ||
t4_ls: [T4] @http(url: "") | ||
t5_ls: [T5] @http(url: "") | ||
t6_ls: [T6] @http(url: "") | ||
} |
23 changes: 23 additions & 0 deletions
23
src/core/config/npo/fixtures/multiple-deeply-nested.graphql
This file contains hidden or 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,23 @@ | ||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
type Root { | ||
nested: Nested1 | ||
nested_list: [Nested1] | ||
} | ||
|
||
type Nested1 { | ||
a: DeepNested @http(url: "") | ||
b: DeepNested @http(url: "", batchKey: ["id"]) | ||
c: DeepNested @http(url: "") | ||
d: [DeepNested] @http(url: "") | ||
} | ||
|
||
type DeepNested { | ||
test: [String] @http(url: "") | ||
} | ||
|
||
type Query { | ||
root: Root @http(url: "") | ||
} |
This file contains hidden or 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,29 @@ | ||
schema @server @upstream { | ||
query: Query | ||
} | ||
|
||
type T1 { | ||
t1: Int | ||
} | ||
|
||
type T2 { | ||
t2: [N] @http(url: "") | ||
} | ||
|
||
type T3 { | ||
t3: [N] @http(url: "", batchKey: ["id"]) | ||
} | ||
|
||
type N { | ||
n: Int @http(url: "") | ||
} | ||
|
||
type Query { | ||
x: String | ||
t1: T1 @http(url: "") | ||
t2: T2 @http(url: "") | ||
t3: T3 @http(url: "") | ||
t1_ls: [T1] @http(url: "") | ||
t2_ls: [T2] @http(url: "") | ||
t3_ls: [T3] @http(url: "") | ||
} |
This file contains hidden or 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,21 @@ | ||
schema @server(port: 8030) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
version: Int! @expr(body: 1) | ||
foo: [Foo!]! @expr(body: [{fizz: "buzz"}]) | ||
bar: [Foo!]! @expr(body: [{fizz: "buzz"}]) | ||
buzz: [Foo!]! @expr(body: [{fizz: "buzz"}]) | ||
} | ||
|
||
type Foo { | ||
fizz: String! | ||
c: Int | ||
} | ||
|
||
type Foo { | ||
fizz: String! | ||
c: Int | ||
spam: [String!]! @http(url: "https://example.com/spam", query: [{key: "id", value: "{{.value.fizz}}"}]) | ||
} |
This file contains hidden or 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 |
---|---|---|
|
@@ -2,5 +2,4 @@ | |
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
--- | ||
query { f1 { f1 { f2 } } } | ||
query { f1 { f2 } } | ||
15 changes: 15 additions & 0 deletions
15
...re/config/npo/snapshots/tailcall__core__config__npo__tracker__tests__entity_resolver.snap
This file contains hidden or 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,15 @@ | ||
--- | ||
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
snapshot_kind: text | ||
--- | ||
query { t2 { t2 { n } } } | ||
query { t2_ls { t2 } } | ||
query { t3 { t3 { n } } } | ||
query { t3_ls { t3 } } | ||
query { t4 { t4 { n } } } | ||
query { t4_ls { t4 { n } } } | ||
query { __entities(representations: [{ __typename: "T1"}]) } | ||
query { __entities(representations: [{ __typename: "T2"}]) } | ||
query { __entities(representations: [{ __typename: "T3"}]) { t3 } } | ||
query { __entities(representations: [{ __typename: "T4"}]) { t4 { n } } } |
10 changes: 10 additions & 0 deletions
10
...ig/npo/snapshots/tailcall__core__config__npo__tracker__tests__multiple_deeply_nested.snap
This file contains hidden or 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 @@ | ||
--- | ||
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
snapshot_kind: text | ||
--- | ||
query { root { nested { d { test } } } } | ||
query { root { nested_list { a } } } | ||
query { root { nested_list { b { test } } } } | ||
query { root { nested_list { c } } } | ||
query { root { nested_list { d } } } |
1 change: 1 addition & 0 deletions
1
...core/config/npo/snapshots/tailcall__core__config__npo__tracker__tests__multiple_keys.snap
This file contains hidden or 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
--- | ||
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
snapshot_kind: text | ||
--- | ||
query { f1 { f2 } } | ||
query { f1 { f3 } } |
8 changes: 8 additions & 0 deletions
8
...onfig/npo/snapshots/tailcall__core__config__npo__tracker__tests__multiple_type_usage.snap
This file contains hidden or 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,8 @@ | ||
--- | ||
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
--- | ||
query { t2 { t2 { n } } } | ||
query { t2_ls { t2 } } | ||
query { t3 { t3 { n } } } | ||
query { t3_ls { t3 { n } } } | ||
meskill marked this conversation as resolved.
Show resolved
Hide resolved
|
7 changes: 7 additions & 0 deletions
7
...core/config/npo/snapshots/tailcall__core__config__npo__tracker__tests__nested_config.snap
This file contains hidden or 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 @@ | ||
--- | ||
source: src/core/config/npo/tracker.rs | ||
expression: actual | ||
--- | ||
query { bar { spam } } | ||
query { buzz { spam } } | ||
query { foo { spam } } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.