Clear class_proxy.class_binding after its one-time use - #50
Open
maedi wants to merge 3 commits into
Open
Conversation
class_binding exists solely to eval default/type-expression values (e.g. the bare String in def method(var: String)) against the class's own lexical scope, once, right when the class body finishes loading -- confirmed nothing else in low_type, lowkey, or any consumer reads it afterward. Leaving it set matters beyond just retaining an unused Binding: a Binding can never be made Ractor-shareable, even frozen -- Ractor.make_shareable raises Ractor::Error unconditionally for one -- so a live Binding on class_proxy permanently blocks Ractor.make_shareable(Lowkey.keys), i.e. sharing the whole file/class/method-proxy registry across Ractors. Clearing it here removes that specific blocker.
This was referenced Sep 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
class_proxy.class_bindingcaptures the class body'sBindingviaTracePoint :end, used once toevaldefault/type-expression values (e.g. the bareStringindef method(var: String)) against the class's own lexical scope.I checked every consumer across
low_type,lowkey, and every gem thatdepends on either -- nothing reads it after that one evaluation.
Leaving it set matters for more than tidiness: a
Bindingcan never bemade Ractor-shareable, even frozen:
So a live
Bindingsitting onclass_proxy-- which lives insideLowkey.keys,the file/class/method-proxy registry every
LowType-included class is storedin -- permanently blocks
Ractor.make_shareable(Lowkey.keys), i.e. sharingthat whole registry across Ractors, regardless of anything else.
Fix
Set
class_proxy.class_binding = nilright after the one evaluation thatneeds it. Confirmed via
Adapter::Loader.load(the only other thing that runsin the same
TracePointcallback) that nothing downstream touches it either.Testing
spec/units/class_binding_spec.rb-- loads a real fixture classand asserts
class_bindingisnilafterward.Metrics/AbcSizeoffense on.included, present onmainbefore this change).Second of three PRs from a look at what it'd take to make Raindeer's stack
Ractor-safe (see #49 for the first). This one is necessary but not
sufficient --
Lowkeyitself still needs a way to actually callRactor.make_shareableon its registry; that's a separate PR against thelowkeyrepo.🤖 Generated with Claude Code