From 0635e66c92c81cbe51f505e0da41041f48715815 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 21 Sep 2026 06:40:11 -0400 Subject: [PATCH 1/3] Assign Query#result_values when an error is raised --- lib/graphql/execution/runner.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/graphql/execution/runner.rb b/lib/graphql/execution/runner.rb index 3b76ddfeca..28d66be5f9 100644 --- a/lib/graphql/execution/runner.rb +++ b/lib/graphql/execution/runner.rb @@ -155,6 +155,10 @@ def execute end query.result end + rescue Exception + # Assign values here so that the query's `@executed` becomes true + queries.map { |q| q.result_values ||= {} } + raise end rescue SystemStackError => err @multiplex.queries.map do |query| From 536448705f39a160e14ef2451a68f72bc4ddfb16 Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 21 Sep 2026 06:48:06 -0400 Subject: [PATCH 2/3] Update stack_error handling --- lib/graphql/execution/runner.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/graphql/execution/runner.rb b/lib/graphql/execution/runner.rb index 28d66be5f9..aa50dab8f6 100644 --- a/lib/graphql/execution/runner.rb +++ b/lib/graphql/execution/runner.rb @@ -155,17 +155,17 @@ def execute end query.result end + rescue SystemStackError => err + queries.map do |query| + @schema.query_stack_error(query, err) + query.result_values ||= { "errors" => query.context.errors.map(&:to_h) } + query.result + end rescue Exception # Assign values here so that the query's `@executed` becomes true queries.map { |q| q.result_values ||= {} } raise end - rescue SystemStackError => err - @multiplex.queries.map do |query| - @schema.query_stack_error(query, err) - query.result_values ||= { "errors" => query.context.errors.map(&:to_h) } - query.result - end ensure Fiber[:__graphql_current_multiplex] = previous_multiplex end From 776e3156b4654f0ff9f833c837c1b6de85c73f4a Mon Sep 17 00:00:00 2001 From: Robert Mosolgo Date: Mon, 21 Sep 2026 09:40:41 -0400 Subject: [PATCH 3/3] Add some exec-next field configs --- spec/graphql/analysis/query_complexity_spec.rb | 6 +++++- spec/graphql/language/sanitized_printer_spec.rb | 6 +++++- spec/graphql/schema_spec.rb | 3 ++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/spec/graphql/analysis/query_complexity_spec.rb b/spec/graphql/analysis/query_complexity_spec.rb index 52c86ff49d..ee8c548a73 100644 --- a/spec/graphql/analysis/query_complexity_spec.rb +++ b/spec/graphql/analysis/query_complexity_spec.rb @@ -762,7 +762,11 @@ class Entity < GraphQL::Schema::Union end class Query < GraphQL::Schema::Object - field :entity, Entity, fallback_value: nil + field :entity, Entity, fallback_value: nil, resolve_static: true + + def self.entity(ctx) + nil + end end def self.resolve_type diff --git a/spec/graphql/language/sanitized_printer_spec.rb b/spec/graphql/language/sanitized_printer_spec.rb index 84702cc29d..0e5656ad7e 100644 --- a/spec/graphql/language/sanitized_printer_spec.rb +++ b/spec/graphql/language/sanitized_printer_spec.rb @@ -352,10 +352,14 @@ class Grouping < GraphQL::Schema::Enum end class Query < GraphQL::Schema::Object - field :things, [String] do + field :things, [String], resolve_static: true do argument :group, Grouping end + def self.things(ctx, group:) + [group] + end + def things(group:) [group] end diff --git a/spec/graphql/schema_spec.rb b/spec/graphql/schema_spec.rb index e22c2e47cf..9404b4df75 100644 --- a/spec/graphql/schema_spec.rb +++ b/spec/graphql/schema_spec.rb @@ -299,7 +299,8 @@ def self.use(schema_defn) query_type = Class.new(GraphQL::Schema::Object) do graphql_name 'Query' - field :foobar, Integer, null: false + field :foobar, Integer, null: false, resolve_static: true + def self.foobar(ctx); 1337; end def foobar; 1337; end end