Skip to content

[graphql] Main issue/MR for converting to the new query interpreter runtime...

This issue is the main issue for this effort, and the main MR with branch bw-graphql-interpreter.

MR handling

Many of the changes can not really be checked into master at this time. There are too many changes to effectively use a feature flag, although there is one defined, :graphql_interpeter.

For now we will use the following process:

  1. Main integration branch will be bw-graphql-interpreter
  2. All new MRs that cannot be included in master should target the integration branch bw-graphql-interpreter
  3. If a change in the code is compatible with master, then the change should be made there
  4. The integration branch will be rebased on master periodically, and downstream branches can then rebase on the integration branch

As detailed in GraphQL - Interpreter

GraphQL-Ruby 1.9.0 includes a new runtime module which you may use for your schema. Eventually, it will become the default.

The new runtime was added to address a few specific concerns:

  • Validation Performance: The previous runtime depended on a preparation step (GraphQL::InternalRepresentation::Rewrite) which could be very slow in some cases. In many cases, the overhead of that step provided no value.
  • Runtime Performance: For very large results, the previous runtime was slow because it allocated a new ctx object for every field, even very simple fields that didn’t need any special tracking.
  • Extensibility: Although the GraphQL specification supports custom directives, GraphQL-Ruby didn’t have a good way to build them.

We'll need to do this eventually, but it might take a little work.

I'm not currently aware of any specific requirements for us to do this immediately. But the longer we wait, the more code that is written and might be non-conformant.

We're currently upgrading to 1.10.x

Note, the MR for this issue should also revert !29208 (merged) (see #211478 (comment 320636547)).

/cc @cablett @.luke @reprazent


Items to do:

  • remove all resolve: -> procs from fields - this is no longer supported

  • convert our query analysers (Gitlab::Graphql::QueryAnalyzers::RecursionAnalyzer and Gitlab::Graphql::QueryAnalyzers::LoggerAnalyzer) to use GraphQL::Analysis::AST - these must be converted all at once

  • update code in spec/support/helpers/graphql_helpers.rb#resolve_field

      # TODO: This will need to change when we move to the interpreter - at that
      # point we will call `field#resolve`
      field.resolve_field(parent, arguments, query_ctx)
Edited by Brett Walker