Repository navigation
Recover accepted Ripper call prefixes before missing block ends - #414
Conversation
…1-ripper-incomplete-commands
284km
left a comment
There was a problem hiding this comment.
Reviewed exact head 32039d674829888d9b93149afdffc818cf768f11 against current main f0f372e7dc00967ae881f599eae68758648a9148 in isolated checkouts. The accepted-prefix walk fixes the original layout-call case, preserves opaque callback values, and correctly retains the active reentry guard after rescued recursive attempts. One P2 / Major issue remains: the new recovery can dispatch calls after a syntax rejection that native Ripper has already encountered (inline).
Independent validation on macOS arm64:
- Fresh ordinary O2 builds of both revisions using pinned Mere
9dec2ff687a08433247dbdb7729bc19c8522e538and mgz661a01d8bb68f5acd68e3192bd47f081d179c436. Clean Ruby 4.0.10 selected throughtools/ref_ruby.sh, revisiona704b7cd95a42cc0cf5f307137bf3aac0285b915, Prism 1.8.2, 38 bundled nondefault gems and no extras. - All 11 existing Ripper corpus fixtures match the reference on base/head, evaluator/VM, and Hash index on/off: 88/88 control comparisons. New corpus 1026 matches on all four head combinations; its four main comparisons differ as expected for the behavior being repaired.
- Complete upstream
test_sexp.rb(58 tests / 98 assertions) andtest_scanner_events.rb(64 / 631) pass on reference and both revisions/engines, with zero failures/errors/skips. These focused runs used a 120-second process timeout; they are not a resource-acceptance measurement. - A 1,377-input exploratory matrix produces identical output through the head's native evaluator and its Ruby-loaded adapter, with no exceptions. This is exploratory coverage, not a claim of reference parity. The new rejected-suffix callback is separately reproduced in all four head engine/index combinations; both main and native Ruby omit that callback. Parenthesizing the inner call and the original missing-layout-block case are retained as controls.
- Regenerating the entire embedded Prism/Ripper source produces a byte-identical
m_prism_lib.mere. GC roots against freshly emitted C, duplicate/dead-definition checks, StrBuf source/emitted-C checks, and diff whitespace checks pass.
I did not independently rerun the full corpus, all upstream Ripper files, Rails suites, Linux checks, or RSS acceptance. The PR's published test_ripper/test_parser_events REPORT_MISMATCH observations remain failures/incomplete acceptance, not passes. The published framework record retains every previous passing identity and the one dependency-tracker improvement, but that is supplied evidence rather than an independent Rails rerun.
No merge attempted. Hosted core CI still has executing jobs and queued coverage, so the queue-only exception does not apply. Current main CI run 46362164472 failed its complete Module gate: 195 tests / 1234 assertions, 0 failures and 2 timeout errors (test_iclass_memory_leak, test_complemented_method_entry_memory_leak), with no outer limit event. All 25 jobs of that run were inspected. The recorded global merge holds remain active; this review does not establish a repair or waive those failures. Already-reviewed #410 also has executing corpus/CRuby work, the other open PRs are drafts, and merelang/mere has no open PRs.
Event is COMMENT because the authenticated account owns this PR; the P2 finding requires a fix before merge.
284km
left a comment
There was a problem hiding this comment.
Follow-up review of exact head 8b69a3178098ab8ec51b30e28a748c107fbb7f08 against current main f0f372e7dc00967ae881f599eae68758648a9148. The earlier P2 / Major finding in discussion #4736736761 is fixed: recovery now stops before visiting the unsupported command/do-block argument. The rejected suffix no longer dispatches render, while the parenthesized-inner control and original incomplete layout call still dispatch it. No new actionable findings.
Independent validation on macOS arm64:
- Fresh ordinary O2 head build with pinned Mere
9dec2ff6and mgz661a01d8; Ruby 4.0.10 revisiona704b7cd95/ Prism 1.8.2 selected throughtools/ref_ruby.shwith no extra reference gems. Main's previously built O2 binary was reused after comparing all 2,888 tracked files against fetched current main, plus the pinned mgz checkout and build mode; no differences were found. - All 11 existing Ripper corpus fixtures match Ruby on main/head, evaluator/VM, and Hash index on/off: 88/88 controls. Updated corpus 1026 matches on all four ordinary head configurations and all four additional GC-stress-32 configurations. Its four main differences are expected for the functionality being repaired.
- The original three-case reproduction matches Ruby on all four head engine/index combinations; the old head still reproduces the erroneous callback and main still lacks the intended recovery controls.
- Original upstream
test_sexp.rb(58 tests / 98 assertions) andtest_scanner_events.rb(64 / 631), archived from the pinned Ruby commit, pass on reference/main/head and both native engines: zero failures, errors or skips. These use 120-second process timeouts and are focused correctness checks, not resource acceptance. - An exploratory 1,596-source Ruby-loaded-adapter suffix matrix introduces no new false
renderrelative to current main and loses no previously matching render observation. Eight pre-existing false-render cases remain outside this recovery path. A separate 1,377-source adapter matrix loses no previously matching complete observation. This does not establish full invalid-source parity. - Embedded Prism/Ripper regeneration is byte-identical; freshly emitted-C GC-root accounting, duplicate/dead-definition checks, StrBuf source/emitted-C checks and diff whitespace checks pass.
I did not independently rerun the complete corpus, Rails suites, Linux validation or RSS acceptance. The supplied expanded Rails/Ripper/resource records remain supplied evidence; their test_ripper / test_parser_events REPORT_MISMATCH states are not passes.
No merge attempted. The hosted Linux build is still executing, macOS/reference jobs are queued, and downstream coverage is incomplete, so the unassigned-runner exception does not apply. All 25 jobs of latest main CI 46362164472 were inspected: build-linux failed the complete Module gate (195 tests / 1,234 assertions, zero failures, two internal timeout errors in test_iclass_memory_leak and test_complemented_method_entry_memory_leak; no outer limit event in the retained result). The recorded hold_all_merges / new_failure_review_required flags remain active. Already-reviewed #410 and #415 were also considered and retain executing/incomplete CI; the other open mere-ruby PRs are drafts, and merelang/mere has no open PRs. This review neither attributes the main failures to this change nor clears the holds.
COMMENT because the authenticated account owns this PR. The prior code finding is addressed; merge acceptance remains pending.
Action View loses
renderdependencies in incomplete ERB snippets because Ripper emits no accepted call header before the missingend. Recover the accepted prefix for that error family, keeping the failed parse and its diagnostics. Restore callbackerror?state and reject parser reentry as Ruby 4.0.10 does.Fixes #339. Addressed P2/Major #4736736761 from head
32039d67: fail closed before visiting recovered prefixes containing an unsupported command/do-block argument. Corpus 1026 adds the rejected suffix and its parenthesized-inner control. A 56-source matrix reports 55 matches and one pre-existing difference on each hosted Prism version (1.8 / 2.1) and on all 8 native engine/index/GC configurations. It has no new regression, falserenderor exception.The isolated Rails lock selects Prism 2.1.0; both its ErrorRecoveryNode and bundled Prism 1.8.2 MissingNode remain incomplete. Corpus 1026 covers the accepted headers, opaque callback values, nested/prefix/body cases and repeated rescued reentry. A bare argument-less fcall is deferred until its block is complete, as Ruby requires. Ordinary recursive helper methods avoid a self-referential traversal closure.
Runtime
f55995a0140a5aa9c15611235a93f6dc1c6cf34b, main baseline9d1c0f32. Local validation:1040/1040 corpus programs match ruby, with the hash index ON and OFFvm_corpus: 1040 programs -- 1040 on the VM, 0 on the evaluator (fell back), 0 FAIL, 0 against the list of fallbackstest_sexp(58 tests / 98 assertions) andtest_scanner_events(64 / 631) pass on both builds/engines.test_ripperretains 4 internal 10-second leak-test timeouts andtest_parser_events2, identical to main on each engine; their REPORT_MISMATCH states are not PASS. Outer 600 s / 2 GiB limits were not reached. Full identities and states are retained.Parse instruction counts, before→after (net per parse including loop and explicit GC):
The error path now performs accepted-prefix work. This does not claim complete invalid-source Ripper parity. Full raw case identities, sample variation and execution states are retained in
railstest/framework/records/actionview-ripper-incomplete-prefix.jsonand the loop note.Reference:
tools/ref_ruby.sh, clean Ruby 4.0.10 revisiona704b7cd95a42cc0cf5f307137bf3aac0285b915, Prism 1.8.2, zero extras. Effective default Gem paths: 46 default + 38 exact bundled specs (manifest checked); isolated installer audit: 46 default only. Compiler9dec2ff6, mgz661a01d8. Owner merge waits for automated review of the exact head.