Repository navigation
Preserve visibility and metadata for self aliases - #372
Conversation
284km
left a comment
There was a problem hiding this comment.
Reviewed exact head 499f6edc3400e6d0e651f5dafdab68bc0ff04f8a against freshly fetched current main 391b560e5f3311f5ec4b0503684ccd1d0bbd7de4. No new actionable finding. Capturing effective visibility before destination mutation fixes the self-alias cases, and the owned-method shortcut retains hooks and warning sharing while preserving closures and Method snapshots. The prospective merge is clean and has only the four intended files; I did not build that integration tree.
Independent validation: fresh ordinary O2 builds of current main and this exact head with pinned Mere 9dec2ff687a08433247dbdb7729bc19c8522e538 and mgz 661a01d8bb68f5acd68e3192bd47f081d179c436; no runtime binary reuse. Against clean Ruby 4.0.10, corpus 1136, twelve existing alias/visibility/reflection cases, and an additional probe give 56/56 exact matches on head, checking stdout, stderr and exit status across evaluator/VM and hash index ON/OFF with tight GC. Main matches all 48 existing-case comparisons and reproduces the visibility failures in the new corpus and probe. The probe also covers singleton visibility, repeated method_added events, frozen-class refusal, prepend, alias original_name, lexical constants and a saved closure after redefinition/GC. All eight source gates pass, generated-C bracket depth is 155/1024, explicit completed-record hygiene passes, and diff whitespace is clean. No tracked AGENTS.md or CLAUDE.md was found in either fetched tree.
Hosted CI is not all passing. Main run 45913249285 and PR run 45914294032 both fail the bundled-network step. Their downloaded network artifacts have identical whole-file inventories and identical failing case tags: TestNetHTTPInRactor#test_get, TestNetHTTPS#test_ractor and TestTimeout#test_ractor (450 cases: 445 MATCH, 3 RED, 2 BOTH). The HTTP failure in both logs reports an un-shareable Proc in Process.__clock_check inside a Ractor, followed by the same Marshal diagnostic. This is retained baseline evidence, not a finding caused by this diff or a claim that the failure is repaired. macOS/reference and downstream coverage remain queued or incomplete.
I did not rerun full corpus, original whole-file Alias/resource acceptance, Rails, instruction benchmarks or full platform acceptance; the original Alias timeout remains explicitly unresolved in this PR's record. No merge: recorded hold_all_merges / new_failure_review_required is active, and actual CI failures mean this is not a queue-only exception. Already-reviewed #317/#326/#355 were also considered; #355 retains an actionable P2 and #326 depends on unmerged #317. COMMENT because this is the authenticated user's own PR.
284km
left a comment
There was a problem hiding this comment.
Review of 499f6edc. No Critical/Major/Minor findings. The source visibility is now read before the destination flags are cleared, so alias_method :x, :x keeps a private, protected or inherited-public-override visibility. An owned identical-name alias no longer copies its own records onto itself, but still marks the shared definition for redefinition warnings and fires method_added. Inherited, prepended and builtin sources keep the normal alias path. The review bot reviewed this head with no findings, corpus --both 995/995 and the VM corpus are posted, and the test merge with current main is clean.
Self-aliasing preserves the source method visibility, including private/protected methods and an inherited public visibility override. For an owned identical-name alias, unchanged body/closure/scope metadata is retained while alias-sharing warning state and method_added still run. An explicitly public owned initialize stays public, as in Ruby. Inherited, prepended and builtin sources keep their normal copy path. The original resource timeout remains unresolved; this PR fixes correctness and avoids redundant metadata writes.
Fresh local acceptance uses clean Ruby 4.0.10 through tools/ref_ruby.sh. The two full sweeps use the same freshly built O2 candidate, with hash indexing ON and OFF.
sh run_corpus.sh --both: 995/995 PASS, exit 0.MERE_RUBY_VM=1 sh run_corpus.sh --both: 995/995 PASS, exit 0.Focused corpus 1136 matches the reference on both engines (stdout, stderr and exit status). Related original CRuby selections are run unchanged, one file at a time, against the exact matching main 410c231. Every invocation uses
MERE_RUBY_GC_TIGHT=1and parsed--seed=1. The selected test counts below do not claim whole-file or full-suite passes.RSS values below are measured maximum resident set sizes of the test driver from
/usr/bin/time -l, in bytes.Cost measurements use three alternating main/candidate O2 pairs, tight GC and parsed --seed=1. Instructions and elapsed seconds are medians; RSS is the maximum of three runs. Elapsed time is diagnostic under shared-machine load.
Candidate O2 SHA-256:
61cd87c2324a702c0e4bc351cccce4229f9667166ea977847d7859900354c793. Matching-main control: 410c231. Compiler 9dec2ff6, mgz 661a01d8.Original ruby/test_alias.rb test_alias_memory_leak is unchanged: 500 x 1000 define/alias/remove operations, original timeout and memory assertions. Reference passes 1 test / 3 assertions; matching main and candidate both time out on evaluator and VM. This is still an open throughput RED, not a leak diagnosis or a claimed resource-test fix. The separate plain/owned/churn 10000-iteration benchmarks are diagnostics, never substitutes for that original case. Corpus 1136 has 10 reference-matched rows including visibility, hooks, Method snapshots, closures, super/prepend, native aliases, public initialize and warning behavior.
Eight source gates (gc_roots, dup_defs, dead_defs, meth_writes, name_spec, rx_caps, ns_names, name_len), generated-C bracket depth, full/explicit completed record_hygiene and staged/unstaged whitespace: PASS. Code/integration and the completed loop record are pushed together. No full unit/Rails suite, reference gem installation or workflow change.