Repository navigation
Restore JSON test loading through native alias visibility - #415
Conversation
284km
left a comment
There was a problem hiding this comment.
Reviewed head 9ec9ea55b8663edbe88cc8a200dc8a11503c2761 against current main f0f372e7dc00967ae881f599eae68758648a9148. No new actionable code findings in this diff. The receiver-ancestor lookup and undef guard keep unrelated aliases from satisfying named visibility validation, while retaining ordinary receiver dispatch and Ruby overrides.
Independent validation on Darwin arm64:
- Corpus 307, 407, 959, 1124 and 1165: 40/40 exact reference comparisons across evaluator/VM and normal, hash-index-off, MRO-cache-off and GC-stress configurations.
- Ran all three unchanged original JSON files separately through the normal unittest load paths with seed 1. Reference Ruby 4.0.10 and both candidate engines pass: parser 53 tests / 1,811 assertions; addition 13 / 40; generic object 5 / 26, all with zero failures/errors/skips. Each original matches its pinned upstream Git blob.
- Built current main freshly at ordinary O2 with Mere
9dec2ff6and the pinned mgz inputs. Its evaluator exits 1 before a summary in all three JSON files; its VM passes the same 71 tests / 1,877 assertions. The candidate therefore restores evaluator loading and preserves the passing VM results. Four existing corpus controls also match on both main engines. - Candidate O2 binary
84dd73c21fe3fb54e90340dd81845b23d1d45a0fceda3f5df384d322a4cea6d6was reused after comparing all 1,831 recorded inputs plus the build configuration against this head, and verifying the clean pinned compiler identity/hash. GC-root accounting (matching generated C), dead-definition, method-write and namespace gates pass.
These are focused review checks, not a new complete corpus, full upstream suite, or memory acceptance run. Hosted Linux build/tests and a macOS gem job are still running; other macOS/reference jobs remain queued and downstream matrices are incomplete. Inspected every job of the latest main CI run 46362164472: build-linux fails its complete Module check (195 tests, 1,234 assertions, 0 failures, 2 errors); the VM comparison job is skipped. This pre-existing result is not attributed to this PR or claimed repaired.
No merge: the recorded hold_all_merges / new_failure_review_required flags remain active, and running or missing hosted coverage is outside the unassigned-runner queue exception. The same policy also keeps the already-reviewed open merge candidates on hold. COMMENT because this review account owns the PR.
Restore the CI evaluator JSON test loading by recognizing native method aliases during named visibility validation. OpenStruct conditionally executes
private :block_given!; that alias lives in the native alias table, so checking only Ruby method definitions and builtin names raised NameError before the JSON files could start.Minimal standalone shape (Ruby and the candidate load it; main raises NameError in the conditional):
The native bisect between 85da98f and 491cc5c identifies 6152c4b (#346) as the first bad main commit. It predates the suspected #386/#388/#389/#390/#391 merges. #346 correctly routes named visibility statements through receiver dispatch (including Ruby overrides), but exposes the ordinary call validator's missing alias lookup. The fix keeps that dispatch and adds a lookup in the actual receiver ancestors, guarded by the known-alias name set and undef tombstones. Unrelated classes' aliases cannot satisfy validation.
CI unittest-report evidence:
The bad logs report
exception propagates after ensure. A bounded focused load exposes its underlying exception: NameError, undefined method block_given! for class OpenStruct, at ostruct.rb:490. This is a load failure rather than a long-running JSON test or memory timeout. Native first-parent bisect, same pinned O2 compiler/dependency and original parser file with seed 1:Corpus 1165 covers named private/public/protected changes to native aliases in a conditional, inherited/included/singleton aliases, undef shadowing, unrelated-owner rejection and Ruby visibility overrides. Both engines match the reference, including GC stress. Existing controls 307, 407, 959 and 1124 remain matching on both revisions/engines. Real OpenStruct integration is exercised through the original JSON test load paths, rather than adding a gem dependency to the standalone corpus.
Original CRuby files are unchanged, each run separately under the normal unittest/try.sh load paths, fixed seed 1 and unchanged 2 GiB / 600 s bounds. Cells show tests / assertions; failures/errors/skips. The table records actual results on reference and both baseline/candidate engines; a main VM pass is preserved, rather than assuming both main engines fail.
The module selection is test_s_public/test_s_private/test_s_protected/test_private_class_method/test_public_class_method/test_alias_method. No full unit-test or Rails component suite was run. Reference: clean ruby 4.0.10 through
tools/ref_ruby.sh, revision a704b7cd; no gems installed. Baseline main 98aa453. Mere 9dec2ff6, mgz 661a01d8, ordinary O2. Candidate binary SHA-25684dd73c21fe3fb54e90340dd81845b23d1d45a0fceda3f5df384d322a4cea6d6. The sealed native binary is reused after fixture-only corrections with all compiler/runtime/generated inputs unchanged; all final tracked code/test/dependency input hashes are checked before and after validation. Evaluator runs leave MERE_RUBY_VM unset.sh run_corpus.sh --both: 1041/1041 corpus programs match ruby, index on/off.MERE_RUBY_VM=1 sh run_corpus.sh --both: 1041/1041 corpus programs match ruby, index on/off.MERE_RUBY_VM=1 sh tools/iseq/vm_corpus.sh -j 2: vm_corpus: 1041 programs -- 1041 on the VM, 0 on the evaluator (fell back), 0 FAIL, 0 against the list of fallbacks.Common named-visibility costs:
bench/native_alias_visibility.rb 2000 --seed=1, MERE_RUBY_GC_TIGHT=1, three alternating baseline/candidate pairs per engine, plus count-0 controls (24 runs). Per-call instructions subtract median startup/control from median count-2000 run and divide by 4,000 private/public calls. RSS is the maximum of three count-2000 runs, MiB. A failing baseline JSON load is not used as an equivalent peak-RSS workload.A longer repetition control uses 20,000 iterations / 40,000 named visibility calls, the same startup subtraction, three alternating pairs and fixed-seed GC_TIGHT (another 24 runs). The candidate's alias lookup follows the existing Ruby/builtin checks, so these Ruby-defined methods keep their existing validation path. The longer measured comparison is:
All four selected original files additionally match their Ruby 4.0.10 Git blobs byte-for-byte after testing. No GC/arena policy or workflow changes are included. Local validation is complete; exact-head review and hosted CI remain.