Skip to content
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

Deal with interfaces on fragment spreads when no __typename is queried #3718

Merged
merged 12 commits into from
Sep 6, 2023

Conversation

o0Ignition0o
Copy link
Contributor

Fix #2587

Operations would over rely on the presence of __typename to resolve selection sets on interface implementers. This changeset checks for the parent type in an InlineFragment, so we don't drop relevant selection set when applicable.

Fix #2587

Operations would over rely on the presence of __typename to resolve selection sets on interface implementers.
This changeset checks for the parent type in an InlineFragment, so we don't drop relevant selection set when applicable.
@github-actions

This comment has been minimized.

@router-perf
Copy link

router-perf bot commented Sep 1, 2023

CI performance tests

  • step - Basic stress test that steps up the number of users over time
  • events_without_dedup - Stress test for events with a lot of users and deduplication DISABLED
  • xlarge-request - Stress test with 10 MB request payload
  • xxlarge-request - Stress test with 100 MB request payload
  • events_big_cap_high_rate - Stress test for events with a lot of users, deduplication enabled and high rate event with a big queue capacity
  • const - Basic stress test that runs with a constant number of users
  • reload - Reload test over a long period of time at a constant rate of users
  • large-request - Stress test with a 1 MB request payload
  • events - Stress test for events with a lot of users and deduplication ENABLED
  • step-jemalloc-tuning - Clone of the basic stress test for jemalloc tuning
  • no-graphos - Basic stress test, no GraphOS.

@o0Ignition0o
Copy link
Contributor Author

@Geal @BrynCooke not 100% sure of the change I just made, can we walk through the code together ?

@o0Ignition0o o0Ignition0o marked this pull request as ready for review September 5, 2023 10:57
@o0Ignition0o o0Ignition0o merged commit aa5073f into dev Sep 6, 2023
@o0Ignition0o o0Ignition0o deleted the igni/typename_fragment_interfaces branch September 6, 2023 09:06
o0Ignition0o added a commit that referenced this pull request Sep 11, 2023
)

Followup to #3718, this changeset makes sure we're able to generate the
most concrete selection set for a given operation.

This means finding the most concrete type we can when we're dealing with
interfaces:
- If InterfaceA implements InterfaceB, use InterfaceA as current_type to
generate an inline fragment's selection set
  
Given the following invariants:
```graphql
  interface OperationItemStuff implements OperationItem
```

For
```graphql
fragment OperationItemFragment on OperationItem {
  ... on OperationItemStuff {
     stuff
  }
}
```

The most concrete interface to generate fields for `OperationItemStuff`
is not `OperationItem`, so we narrow down the selection to
`OperationItemStuff`.

The fixes for #3718 still apply, IE:

Given the following invariants:
```graphql
  type Dog implements Animal
```
For
```graphql
...on Animal {
  id
  ...on Dog {
    name
  }
}
```
The most concrete type to generate a selection set for `Dog` is not
`Animal`, so we narrow down the selection to `Dog`.
garypen pushed a commit that referenced this pull request Sep 12, 2023
)

Followup to #3718, this changeset makes sure we're able to generate the
most concrete selection set for a given operation.

This means finding the most concrete type we can when we're dealing with
interfaces:
- If InterfaceA implements InterfaceB, use InterfaceA as current_type to
generate an inline fragment's selection set
  
Given the following invariants:
```graphql
  interface OperationItemStuff implements OperationItem
```

For
```graphql
fragment OperationItemFragment on OperationItem {
  ... on OperationItemStuff {
     stuff
  }
}
```

The most concrete interface to generate fields for `OperationItemStuff`
is not `OperationItem`, so we narrow down the selection to
`OperationItemStuff`.

The fixes for #3718 still apply, IE:

Given the following invariants:
```graphql
  type Dog implements Animal
```
For
```graphql
...on Animal {
  id
  ...on Dog {
    name
  }
}
```
The most concrete type to generate a selection set for `Dog` is not
`Animal`, so we narrow down the selection to `Dog`.
@abernix abernix mentioned this pull request Sep 14, 2023
@o0Ignition0o o0Ignition0o mentioned this pull request Oct 19, 2023
12 tasks
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.

Use of __typename affects presence of fragment spread data on interfaces
3 participants