Skip to content

Preserve ruby2_keywords through Ruby forwarding methods - #405

Merged
284km merged 2 commits into
mainfrom
codex-rails1-marked-forwarding-keywords
Nov 28, 2026
Merged

284km merged 2 commits into
mainfrom
codex-rails1-marked-forwarding-keywords

Conversation

@284km

@284km 284km commented Nov 28, 2026 •

Copy link
Copy Markdown
Owner

A ruby2_keywords wrapper calling super into a method declared with ... lost the keyword status of the expanded final Hash. Action Mailer then raised an argument-count/missing-keyword error instead of delivering the message. Apply the existing marked-splat handling when binding forwarding parameters, as well as explicit keyword parameters.

The change is one condition in bind_params. Corpus958 adds direct-super, block-super and explicit-spread-super cases, plus positional-Hash negative controls. #245's native frame/storage work is separate; a later forwarding-marker rename there must retain this semantic check.

Clean Ruby4.0.10 via tools/ref_ruby.sh, revisiona704b7cd95, Prism1.8.2, zero extra gems. Runtime04e11f70; compiler9dec2ff6; mgz661a01d8. Publication adds records to that measured code.

  • run_corpus.sh --both:1036/1036, hash index ON/OFF. VM:1036VM/0fallback/0differences.
  • Corpus958 matches all8 evaluator/VM × hash-index × normal-GC/GC32 configurations; main reproduces the gap.
  • Source gates, supplemental strbuf gate and default/explicit record hygiene pass.
  • CRuby test_keyword:115tests/2592assertions/0failures/0errors, COMPLETE on all five reference/main/candidate engine sides. Its original rb_call_super_kw and iter test extensions were freshly built for each side. Earlier missing-extension/CLI failures remain in the diagnostic records.
  • test_super:50cases all passing on all five sides. test_proc:120cases COMPLETE; main and candidate preserve the same existing curry-proc error and compaction skip on both engines. No previously passing main case lost.
  • Ordinary positional, plain-splat and keyword-splat net instruction medians remain within1% of main on both engines (three alternating0-versus20,000-iteration pairs); all samples are retained.

Mailer target, message_delivery_test.rb: 22MATCH/3RED →25MATCH/0other, both engines, both sides COMPLETE, no bounds. These target measurements use integrations f2ab6b90→e3c16e54 with identical prerequisites, including then-unmerged parser#402, ActiveJob#395 and class reflection#399. The after integration contains this keyword fix and the separate Array-index fix. Corpus/core checks isolate this PR's behavior; target evidence is qualified as an integration comparison. Standalone main+keyword diagnostics remain0MATCH/25MISSING on both sides because the measured main8ed control predates #402 and hits a false Nokogiri warning under Rails strict warnings. No warning is suppressed. Those three prerequisite PRs have since merged; the records still name the exact measured integrations. Full component sweeps are separate.

Large-file RSS, standalone main8edcf953→runtime04e11f70: activesupport/test/json/encoding_test.rb,158MATCH in all12 runs, normal O2/GC, seed12345, jobs2,600s/2GiB per-file family. Each binary has its own fresh native installation. Three alternating pairs:

Engine Before samples KiB After samples KiB Median change
evaluator 1450224 / 1507344 / 1554272 1604944 / 1378368 / 1504864 -0.16%
vm 1195904 / 1228784 / 1246880 1186240 / 1230864 / 1216000 -1.04%

Ranges overlap; no stable memory improvement is claimed.

Evidence: loop/2026-11-28-codex-rails1-marked-forwarding-keywords.md and railstest/framework/records/actionmailer-marked-keyword-forwarding.json, including all case inventories, source/binary/native-install receipts and raw measurement samples.

Exact-head automated review and owner merge-hold clearance remain required. No self-merge or current-head hosted CI-pass claim.

Current-main CI follow-up: the shared read_path_whole/read_path_at StrBuf region findings introduced by #373 are recorded with that stream. They are unchanged by this one-condition keyword delta; no new-head native integration/CI pass is inferred from source comparison.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 1ce83da5 (main.mere +1/-1 in bind_params, corpus 958, record).

  • A method declared with ... binds its rest as *__fwd, so it has no keyword parameters and no **. The marked-splat check (a final Hash flagged by ruby2_keywords and arriving through a splat becomes keywords again) therefore never ran for it. Extending the condition to str_list_has ps8 "*__fwd" makes forwarding keep the flag, which matches Ruby: the forwarded call sees keywords.
  • The check still requires both the r2k_marks flag and arg_splat_has, so an unflagged positional Hash stays positional. Corpus 958's positional-Hash negative controls cover that, alongside direct super, block super and explicit-spread super.
  • Evidence: corpus 958 in all 8 configurations with main reproducing the gap; test_keyword 115/2592 complete on all five sides with its C test extensions rebuilt per side; corpus --both and the VM corpus are clean.

No findings from me. The merge waits for the automated reviewer on this head.

@284km 284km left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed exact head 1ce83da5cc6351eabaf9cba6242aad6040f25514, its existing review/discussion, and current main a882a26ecb185d0548fcf0a986769e8371a7dd83. No new actionable findings in this PR's delta.

The condition correctly extends the existing marked-splat handling to *__fwd; it still requires both the persistent ruby2_keywords mark and this call's splat provenance. The regression covers implicit super, super inside a block, explicit splat-super, and positional-Hash controls.

Independent validation:

  • Corpus 958 and an additional forwarding probe each match clean Ruby 4.0.10 (a704b7cd95, Prism 1.8.2) in all eight evaluator/VM × Hash-index on/off × normal-GC/GC32 configurations: 16 exact exit/stdout/stderr comparisons. The additional probe covers blocks, leading positional arguments, marked/unmarked Hashes, trailing arguments, explicit keywords and empty Hashes.
  • Fresh ordinary O2 current-main build with pinned compiler 9dec2ff6 and mgz 661a01d8 reproduces the regression on both engines; the head matches Ruby. A separate **nil error-message mismatch is identical on main/head and is not a new finding.
  • Candidate O2 binary reuse is explicit: all 2,858 tracked files and the pinned mgz Mere sources match the recorded build; fresh C emission and FFI header match byte-for-byte using the clean pinned compiler. Binary SHA-256 dcfde50cf2b54962c482b8409631d8955092b62dcb506dc50e810a0b69c2c3d6; emitted C 8a213cfe7c400705223465c7ff34de0f36796f4e47617068574ceceab23184c6. Native candidate code was not recompiled.
  • GC roots against fresh C, duplicate definitions, method-write guards, name-length guards, instance-variable access, StrBuf region checks on the standalone head, changed-record hygiene and diff whitespace checks pass.

I inspected the published original/supplemental keyword/core and framework records; I did not independently rerun full corpus, complete CRuby files, framework components or platform resource acceptance. The Mailer result remains a qualified integration comparison containing the separate Array fix.

No merge. Linux build job 140987708595 actually fails the StrBuf region gate for read_path_whole/read_path_at. Fresh current main independently produces the same four source/emitted-C findings. These unchanged helpers belong to the already recorded #373 follow-up, so I am not duplicating that finding here. This real failure is not a runner-queue result. Downstream corpus, CRuby, bootstrap, basic and tool jobs remain queued; evaluator-vs-VM is skipped. Current main CI run 46148220545 is pending with no job records yet. The recorded hold_all_merges/new_failure_review_required remains active. COMMENT because the authenticated reviewer owns this PR.

@284km
284km merged commit 1cfbafe into main Nov 28, 2026
20 of 36 checks passed
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