From e75d67f0cf13250261658609b483a0b50cff9415 Mon Sep 17 00:00:00 2001 From: ydah Date: Thu, 9 Jul 2026 23:56:46 +0900 Subject: [PATCH] Fix Query variables storage after max errors --- lib/graphql/query/variables.rb | 2 +- spec/graphql/query/variables_spec.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/graphql/query/variables.rb b/lib/graphql/query/variables.rb index 6fbc73192eb..4b2c12e0918 100644 --- a/lib/graphql/query/variables.rb +++ b/lib/graphql/query/variables.rb @@ -19,7 +19,7 @@ def initialize(ctx, ast_variables, provided_variables) @storage = ast_variables.each_with_object({}) do |ast_variable, memo| if schema.validate_max_errors && schema.validate_max_errors <= @errors.count add_max_errors_reached_message - break + break memo end # Find the right value for this variable: # - First, use the value provided at runtime diff --git a/spec/graphql/query/variables_spec.rb b/spec/graphql/query/variables_spec.rb index b9118d3fdb4..d58adc316c4 100644 --- a/spec/graphql/query/variables_spec.rb +++ b/spec/graphql/query/variables_spec.rb @@ -57,6 +57,7 @@ class TestSchema < VariablesTest::MaxValidationSchema res = schema.execute(query_string, variables: variables) assert_equal 3, res["errors"].count assert_match(/Too many errors processing variables/, res["errors"].last["message"]) + assert_equal 0, res.query.variables.length end end