Skip to content

Merge train 183: #10207 - #10208

Merged
proggeramlug merged 3 commits into
mainfrom
train183
Sep 13, 2026
Merged

proggeramlug merged 3 commits into
mainfrom
train183

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Merge train 183: lands #10207 (stop capping replace and split output lists at the scratch limit; part of #10164) at head 7b10d913b6, plus the workspace version bump to 0.5.1556.

Both PR commits were cherry-picked onto 0956673b5 without conflicts. main has not moved since the PR's base, so the tree before the bump is byte-identical to the PR head.

Review: List::push no longer refuses at SCRATCH_BYTES / 8 entries, which capped a callback replace over 'ab12 cd345;' at about 700,000 records with "Regular expression memory limit exceeded". The list is a GC array. List::get indexes with as u32, but js_array_push_f64 at length u32::MAX takes the spec path and throws a RangeError from ArraySetLength, so the list can never silently wrap. Reaching that length would need an array of about 34 GB.

Local validation of this branch (perrymaster, Linux x86_64, --locked):

  • cargo metadata --locked, cargo fmt --all -- --check
  • cargo check -p perry-runtime --no-default-features --features full --lib (regex feature off): 0 warnings
  • cargo check -p perry-runtime --lib --tests: no warnings outside the known global_this_webassembly.rs dead code
  • cargo test -p perry-runtime --lib -- --test-threads=1: 3725 passed, 1 failed. The failure is native_stack::tests::stack_top_respects_custom_thread_stack_sizes, red on main. The suite includes the new perex_replace_output_is_not_capped_by_the_scratch_limit.
  • cargo clippy -p perry-runtime --lib --tests: the same 12 approx_constant errors, and the warning diff is identical to train 181's
  • scripts/run_lint_gates.sh script tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main.
  • gc_runtime_root_holders.py passes; check_changeset_fragment.sh PerryTS/perry 10207: pass

https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9

Summary by CodeRabbit

  • New Features

    • Increased the maximum output size for regular-expression replace, replaceAll, and split operations by removing the previous fixed entry limit.
    • Large operations are now constrained by available memory and maximum string length rather than the former list cap.
  • Bug Fixes

    • Fixed global replacements failing with a memory-limit error when processing very large outputs.
  • Chores

    • Updated the application version to 0.5.1556.

Ralph Küpper added 3 commits September 13, 2026 14:26
…h limit (#10164)

`String.prototype.replace`, `replaceAll` and `split` threw "Regular expression
memory limit exceeded" once an operation's list reached 8,388,608 entries:
`List::push` refused past `SCRATCH_BYTES / 8`. A replacement stores three
entries per output piece and a callback replace appends two pieces per match,
so `'ab12 cd345;'.repeat(n).replace(/[0-9]+/g, cb)` threw from exactly 699,050
records, where Node finishes in about 235 ms. That limit is for native scratch
buffers; these lists are ordinary GC arrays whose length follows the subject.

The cap is removed. The lists are bounded by what can be allocated, and output
by the existing maximum-string-length check on piece units. The work budget has
been unlimited since #10176 for the same reason.

Test: a `replaceAll` over one match more than the former cap allows now
produces the complete output; with the cap restored the same test aborts on the
thrown error.

Claude-Session: https://claude.ai/code/session_01RJkA4Fhqz9J5F5fzDk5HWv
@proggeramlug
proggeramlug merged commit 26ed55c into main Sep 13, 2026
18 of 20 checks passed
@proggeramlug
proggeramlug deleted the train183 branch September 13, 2026 14:40
@coderabbitai

coderabbitai Bot commented Sep 13, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7e5590f4-f504-483c-b635-3d29b2845cbc

📥 Commits

Reviewing files that changed from the base of the PR and between 0956673 and b8bd6ce.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • CLAUDE.md
  • Cargo.toml
  • changelog.d/10207-regex-list-cap.md
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_replace.rs
  • crates/perry-runtime/src/regex/perex_replace_storage.rs

📝 Walkthrough

Walkthrough

The regex runtime no longer applies the fixed scratch-buffer entry cap to operation lists. A regression test verifies large global replacement output. Workspace version documentation updates to 0.5.1556.

Changes

Regex list capacity

Layer / File(s) Summary
Remove regex list entry cap
crates/perry-runtime/src/regex/perex_replace_storage.rs, changelog.d/10207-regex-list-cap.md
List::push no longer rejects entries at the scratch-buffer limit. The changelog documents the updated behavior for replace, replaceAll, and split.
Validate behavior and update version
crates/perry-runtime/src/gc/tests/runtime_roots/perex_replace.rs, Cargo.toml, CLAUDE.md
A regression test verifies global replacement beyond the former limit. The workspace and documented versions update to 0.5.1556.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch train183

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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