Skip to content

Avoid freezing execution results during finalization - #5709

Open
ydah wants to merge 1 commit into
rmosolgo:masterfrom
ydah:fix-frozen-execution-results
Open

Avoid freezing execution results during finalization#5709
ydah wants to merge 1 commit into
rmosolgo:masterfrom
ydah:fix-frozen-execution-results

Conversation

@ydah

@ydah ydah commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Ruby head currently freezes the nested array in Array#flatten!'s single-array fast path:

result = []
[result].flatten!
result.frozen? # => true

GraphQL::Execution::Finalize used flatten! while locating errors in nested list results. This unintentionally froze the execution result array, then null propagation attempted to update it and raised FrozenError.

This change uses non-destructive flatten instead. It preserves the existing recursive traversal without freezing result arrays.

The existing [Test], [Test!], and [Test!]! null-propagation cases fail before this change and pass afterward on Ruby 4.1.0dev. They also pass on Ruby 4.0.

@rmosolgo

Copy link
Copy Markdown
Owner

Thanks for tracking down this test failure.

Do you know if this .freeze is intentional or accidental?

With .flatten we're allocating a new Array -- which I'd rather not, if we can help it.

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.

2 participants