Skip to content

Freeze Grape's constants all the way down - #3095

Merged
ericproulx merged 1 commit into
masterfrom
refactor/ractor-shareable-internals
Nov 21, 2026
Merged

ericproulx merged 1 commit into
masterfrom
refactor/ractor-shareable-internals

Conversation

@ericproulx

@ericproulx ericproulx commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

Part of making Grape's internals readable from a non-main Ractor, without calling the Ractor API from lib/, as groundwork for Ractor mode (#2978). Split from the first version of this PR, with the rest in #3096, #3097 and #3098.

A non-main Ractor reads a constant only when its value is frozen all the way down. These were frozen on the outside only:

Constant Held In a Ractor
Validations::ParamsScope::SPECIAL_JSON Array[JSON], an unfrozen Array every given and mutually_exclusive raised
Validations::Types::SPECIAL, Types::GROUPS the same, as a key and an element
Exceptions::Base::MESSAGE_STEPS unfrozen Strings a malformed JSON body answered 400 with the isolation error as its message, and strict header versioning raised
Cookies::DELETED_COOKIES_ATTRS a Time cookies.delete raised

DryTypes::StrictCache::MAPPING and ParamsCache::MAPPING stay as they are: they hold dry-types' own objects, and only building a coercer reads them.

🤖 Generated with Claude Code

@ericproulx
ericproulx force-pushed the refactor/ractor-shareable-internals branch 2 times, most recently from a768473 to 5448634 Compare November 21, 2026 17:05
@ericproulx
ericproulx force-pushed the refactor/ractor-shareable-internals branch from 5448634 to 07d0ada Compare November 21, 2026 17:16
@ericproulx ericproulx changed the title Make Grape's constants and what an API compiles into shareable across Ractors Freeze Grape's constants all the way down Nov 21, 2026
A non-main Ractor reads a constant only when its value is frozen all the
way down. SPECIAL_JSON, Types::SPECIAL and Types::GROUPS held
Array[JSON], an unfrozen Array; MESSAGE_STEPS held unfrozen Strings;
DELETED_COOKIES_ATTRS held a Time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ericproulx
ericproulx force-pushed the refactor/ractor-shareable-internals branch from 07d0ada to 7eef4da Compare November 21, 2026 17:23
@ericproulx
ericproulx merged commit 197369a into master Nov 21, 2026
53 checks passed
@ericproulx
ericproulx deleted the refactor/ractor-shareable-internals branch November 21, 2026 17:27
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.

1 participant