Repository navigation
Preserve Array override arguments until native index conversion - #406
Conversation
284km
left a comment
There was a problem hiding this comment.
Reviewed head 5521d70b (main.mere +22/-4, corpus 941, record).
- Semantics: right. A Ruby override of an Array index method, on the singleton or on an Array subclass, now receives the original arguments, as in Ruby.
Mail::AttachmentsList#[]=with a filename String key reaches its body. Native entry through an alias (blt_alias_call), a retained Method orsuperstill converts withcoerce_arr_index_args, sosuper(name)from such an override keeps Array's own conversion and errors. Corpus 941 covers both sides, including ato_intthat must not run before the override. - Fast path: exact Integer arguments skip both the conversion and the new override lookup. The read/write/fetch rows are flat or slightly faster.
[Minor] Please measure the non-Integer path too. Every call whose arguments are not the listed Integer shapes now does has_meth (dispatch_cls_of recv) name plus hng_sng_has before converting. That covers a[1..3], a[-2..], a[i, n] with a non-Integer n, a.values_at(...), a.flatten(1), a.rotate(k) with a Float, and a.slice(range). Range slicing is common in real code, so please add a row for a[1..3] (and values_at with 3 Integers, which misses the 1–2 argument fast shapes) against main on both engines. If it is measurably slower, the 0- and 1-argument Range shapes could join the fast path: a plain VRange of Integers on a receiver whose class is exactly Array with no singleton.
The merge waits for that row and for the automated reviewer on the head.
284km
left a comment
There was a problem hiding this comment.
Reviewed exact head 5521d70be656dd44261dc8c0915f45cf845a5115 against current main 08a452ebb2f563b15ca9caaae83dd44c2ad3ebaa.
The original-argument dispatch change is supported by corpus 941: it matches clean Ruby 4.0.10 in all eight evaluator/VM × hash-index ON/OFF × normal-GC/GC32 configurations. I found one additional Minor correctness regression in native-alias arity handling, detailed inline. The existing review's non-Integer performance request is still outstanding and is not duplicated here.
Validation: separate temporary checkouts and fresh ordinary O2 builds of head and current main, mgz 661a01d8; regenerated head C matches the published pinned-compiler C SHA256 (b9202849…). The alias-arity reproducer matches Ruby on main in 8/8 configurations and differs on this head in 8/8. Source name-length, method-write, GC-root and StrBuf checks, changed-record hygiene and diff whitespace checks pass on the head. Full corpus, whole upstream Array tests and framework/resource comparisons were not rerun in this review; the publication's incomplete Array observations remain incomplete. Exploratory fetch/super and ArithmeticSequence alias discrepancies also occur on main and are excluded from the findings.
No merge: the recorded all-merge hold remains active, and hosted CI still includes running tests/builds and queued jobs, not only unassigned runner queues. Latest main CI run 46151473357 has an actual Linux source-gate failure in the pre-existing read_path_whole/read_path_at StrBuf helpers; that is not attributed to this Array change. The other open PRs are drafts; there are no eligible already-reviewed candidates.
|
The final17-file Mailer sweep stopped before test discovery: the previously clean private Ruby4.0.10 can no longer boot RubyGems because kernel_require.rb is missing. Its binary still has the original5ad9092c SHA and a704b7cd revision, but default gem specifications and parts of its source tree are also absent. No Rails test ran and no results.json was produced; this is preserved as an environment-startup failure, not a framework RED or an all-pass result. Cause is not yet established. I am rebuilding an independent reference from the official Ruby4.0.10 release, SHA-256 b53eef3371fa5d3e3b74340edcd015f06d5d8853968d4e539a5264fce41ed9f1 (matches the installed ruby-build definition), revisiona704b7cd95. Before resuming I will require exact agreement with the earlier inspected inventory (46 default specifications; no nondefault specifications), Prism1.8.2 and zero extras, then use fresh native installation/output directories. The code and previously completed measured-source records are unchanged. The failed attempt and new-reference provenance will stay distinct in the final report; no record-only push is planned. Correction to the initial inventory count: the preserved isolated reference-inspection receipt contains46 default specs, not84. The rebuilt reference was compared for exact equality with that receipt, in addition to the strict extra-gem guard. The new full17-file cohort is now complete and reported below. |
|
The full Action Mailer run is finished; this stream has released its full-component slot. Both engines: 268 MATCH, 0 RED/MISSING/BOTH/UNCONFIRMED/EXTRA. All17 files are COMPLETE on both reference and Mere; no bounded file needed an isolated rerun. The earlier full cohort had248MATCH/20RED. This is the frozen local integration including the PR406 review corrections (native alias arity and Range/three-Integer no-coercion paths), not a claim about later current-main changes. Standalone PR runtime The PR406 code/record follow-up is still local while its final large-file RSS comparison runs. I will batch those commits into one push, then request exact-head re-review. The original reviewed head remains unchanged for now. actionmailer integration measurementAll 17 selected files measured against clean Ruby 4.0.10 through
Per-side file states:
Remaining REDs by file: Bounded files requiring isolated reruns: 0.
Qualifications:
Reference selector: |
|
Pushed the two review corrections and their records together, once. Exact new head:
Review/resource evidence and full17-file record. Original whole-Array bounded observations and pre-optimization measurements remain explicitly separate. The PR remains Ready for re-review. Exact-head bot review and owner acceptance are still required; the global merge hold is not inferred to be lifted, and no self-merge is performed. Current-main373 StrBuf findings remain with that stream. |
284km
left a comment
There was a problem hiding this comment.
Re-reviewed 5521d70b..8483ecb4 against my Minor and the automated one.
- Non-Integer path cost: addressed. Zero arguments, three-Integer
values_at, and Integer/nil-bounded Range slicing ([],slice,slice!,values_at) now skip the override probe. Since those arguments need no conversion, passing them through unchanged is correct whether or not an override exists. The new rows area[1..3]−1.3%/−1.4% andvalues_atwith 3 Integers −2.8%/−2.7% against main. - Alias/super arity before coercion: addressed.
array_index_native_callchecks Array's native arity fromarity_tblbeforecoerce_arr_index_args. Corpus 941 adds wrong-arity calls through aliases, Methods andsuperwith a nil index and a side-effectingto_int.
Suggestion (non-blocking): in array_index_native_call, the arity failure is let _ = raise_exc ... in (), and the function then falls through to prim_method recv name (coerce_arr_index_args ...). Elsewhere raise_exc only records the exception. The corpus shows the to_int hook does not run, so presumably the pending exception stops the conversion further down. Still, an explicit if bad then raise_exc ... else prim_method ... would make "reject before converting" local rather than dependent on that.
No blocking findings from me. The merge waits for the automated reviewer on this head.
284km
left a comment
There was a problem hiding this comment.
Re-reviewed exact head 8483ecb40947e1243d40ceaac7a779f62bff1d06 against current main 08a452ebb2f563b15ca9caaae83dd44c2ad3ebaa, including the existing reviews and follow-up discussion. No new actionable findings.
The previous Minor native-alias arity finding is fixed. Wrong-arity at/flatten calls through saved aliases, retained Methods and super now raise ArgumentError before nil/index conversion; the side-effecting to_int counter stays zero. Corpus 941 and an independent arity/Range probe each match clean Ruby 4.0.10 in all eight evaluator/VM × hash-index ON/OFF × normal-GC/GC32 configurations. The original alias/retained-Method control also matches Ruby on both current main and this head in all eight configurations. raise_exc ends in fail, so the error path exits before reaching coercion; this does not rely on a pending-exception flag.
The non-Integer performance request is addressed by the unchanged-argument Range and three-Integer values_at paths. I recomputed the published medians from their raw instruction samples and checked their source pins; I did not independently rerun those performance measurements. The 17-file Mailer record contains matching reference/Mere PASS inventories for all 268 identities in both engines. Those are the documented frozen integration results, not a new current-main integration run. The two recorded Array baseline failures and earlier incomplete whole-Array memory-bound observations remain explicit.
Validation used separate temporary checkouts and fresh ordinary O2 builds. Compiler 9dec2ff6 was freshly built; its head-generated C matches the recorded SHA256 9bee678203974d273325ccd76e77f6a1f70d32716413cafb8771810335ab1404, and the FFI header agrees. mgz is pinned at 661a01d8. Reference Ruby is 4.0.10, revision a704b7cd95, Prism 1.8.2, with the reference extra-gem guard passing. Head name-length, method-write, GC-root, StrBuf, changed-record hygiene and diff whitespace checks pass. Full corpus, whole upstream Array and framework/resource suites were not rerun in this review.
No merge: hold_all_merges and new_failure_review_required remain active. Hosted CI still has running builds/tests plus queued jobs, so the unassigned-runner-only exception does not apply. Every job of latest main CI run 46151473357 was inspected: Linux build and corpus actually fail the existing read_path_whole/read_path_at StrBuf gate; the same gate failure reproduces on current main locally and is not introduced by this PR. The other open mere-ruby PRs (#392 and #245) are drafts; merelang/mere has no open candidates.
Array subclass overrides received arguments after native index conversion, so Mail::AttachmentsList#[]= rejected filename String keys before its Ruby body ran. Preserve original arguments for Ruby overrides, and apply conversion on native alias, retained Method and super entry. Native entry checks Array's original arity before any conversion hook.
Arguments that need no conversion skip the added override probe: exact Integer shapes, zero arguments, three-Integer values_at, and integer/nil-bound Range slicing. Corpus941 includes filename keys, assignment returns, frozen override bodies, native conversion, original to_int-bearing objects, and wrong-arity nil/side-effecting-to_int calls through aliases, Methods and super.
Final measured standalone runtime
da465c1481770a472764455c775bacea047528c0, main control8edcf953c37c3c7f0d4223c5227a7e4ea589ec6a; clean Ruby4.0.10 throughtools/ref_ruby.sh, revisiona704b7cd95, Prism1.8.2, zero extra gems. Compiler9dec2ff6, mgz661a01d8. Publication adds records to this tested code.run_corpus.sh --both: 1036/1036, hash index ON/OFF. VM: 1036 VM / 0 fallback / 0 differences.test_arrayobservations at425 remain explicit in the original record: reference493tests/23683assertions all passing; both Mere controls/engines MEMORY_LIMIT in permutation-array-modified, including isolated replays. That incomplete whole file was not rerun or relabeled passing in this follow-up.Net instructions per operation including the loop, three alternating pairs against main8ed. Ordinary rows use0-versus20000 iterations; Range/values_at use0-versus100000. Every output matches the reference.
Large-file max RSS, exact standalone main8ed→finalda465c14: AS JSON encoding158MATCH in all12 runs, all COMPLETE/all passing. Fresh native gems installed by each exact measured binary and recovered reference; seed12345, normal GC, jobs2,600s/2GiB per file family, three alternating pairs.
All samples and variation are retained; no stable memory improvement is inferred from overlapping ranges. The original pre-optimization cost/RSS observations also remain available.
Final separate Action Mailer integration
2e4f119295a5afe87cc8a8eaaef03ea8cbeea35b: all17 files, evaluator268MATCH/0other and VM268MATCH/0other; both sides COMPLETE for every file, no time/memory bounds. Prior full cohort248MATCH/20RED→268MATCH/0RED. Base102MATCH and message_delivery25MATCH both engines. This integration includes the merged ActiveJob395, class-reflection399, parser402 and keyword405 prerequisites plus this Array correction; it is not the standalone PR binary or later current main. Integration corpus1037/1037, VM1037/0/0. Full per-file states, times and source/native receipts are inactionmailer-final-17.jsonand the completion report.The prior reference prefix developed missing RubyGems files; v15 stopped before discovery and remains an environment failure. Final controls use a new isolated official Ruby4.0.10 build, identical revision/Prism1.8.2/46-default-spec inventory, strict extra-gem guard passed, new binary SHA256
3d4b6667beb1612cc7076ae14e2a9f299d4fc870cb75b22371ab6ba6f2e7d5c8. All final native installs are fresh; no Gem.default_dir writes.Evidence:
loop/2026-11-29-codex-rails1-array-index-review-followup.md,railstest/framework/records/actionmailer-array-index-review-followup.json,actionmailer-final-17.json, and the originalactionmailer-array-index-overrides.json.Measured source pins predate #373's read helpers. Current-main StrBuf findings there are with that stream; no gate suppression or current-main/hosted-CI pass is claimed. Code and records are batched in one push. Exact-head automated review and owner acceptance remain required; no self-merge.