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

Fix: deal with interface inheritance when retrieving selectionset #3793

Merged
merged 4 commits into from
Sep 11, 2023

Conversation

o0Ignition0o
Copy link
Contributor

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:

  interface OperationItemStuff implements OperationItem

For

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:

  type Dog implements Animal

For

...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.

@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

@o0Ignition0o, please consider creating a changeset entry in /.changesets/. These instructions describe the process and tooling.

@router-perf
Copy link

router-perf bot commented Sep 8, 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 o0Ignition0o requested review from Geal, bnjjj and SimonSapin and removed request for Geal and bnjjj September 8, 2023 15:41
@o0Ignition0o o0Ignition0o merged commit 5b9c216 into dev Sep 11, 2023
@o0Ignition0o o0Ignition0o deleted the igni/interface_implementing_interface_validation branch September 11, 2023 12:13
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`.
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.

3 participants