Merge train 178: #10176 - #10192
Merged
Merged
Conversation
added 3 commits
September 13, 2026 11:29
Every RegExp operation ran under one fixed Budget of 100,000,000 work units. Valid programs Node completes threw `RangeError: Regular expression work limit exceeded`: a 32,000-unit non-ASCII split and a 60,000-unit global replace (from the per-search seek charge), and after #10165's fixes even linear splits and replaces of 11-15 million units. No finite allowance separates valid programs from pathological ones. Perex charges per subject unit an amount set by the program, not the subject: about 1 for `/x/`, 9 for `/\w+/g`, 60 for `/([a-z]+)([0-9]+)/g`, over 200 for a 32-unit lookahead. Any cap therefore throws on some large linear input, while a quadratic pattern on a short subject never reaches it. JavaScript engines never abort matching for work. WORK becomes usize::MAX. Searches still run in QUANTUM slices with a GC poll between them, so collection and cancellation keep working, and the scratch, program and output memory limits are unchanged. A catastrophic pattern now runs as long as it does in Node instead of throwing. The existing tests that exercise ExecError::WorkLimit all pass their own small budgets, so they still cover the error mapping and accounting. Test: gc::tests::runtime_roots::perex_work_policy runs one valid, linear search that charges about 1.2e8 units (a failing 32-unit lookahead at every position, with no required literal that admission could reject up front) and asserts it completes and charges more than the former limit. It fails when the old 100,000,000 cap is restored. Claude-Session: https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
📝 WalkthroughWalkthroughThe regex runtime work allowance changes from a fixed limit to ChangesRegex work policy
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: ✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge train 178: lands #10176 (do not cap RegExp operations by work; part of #10164) at head
b895f32e51, plus the workspace version bump to 0.5.1550.Both PR commits were cherry-picked onto
5cec2fbbc9without conflicts and match bygit patch-id --stable.Before landing, #10176 was rebased onto
mainafter train 177 (#10174). The two PRs merged cleanly as text, but the combined tree did not compile: #10176'sperex_work_policytest calledapi::execute_with_resourceswith 6 arguments, and #10174 added thereuseparameter. The test now passesNone, which is what a standalone call means. Details are on #10176.Local validation of this branch (perrymaster, Linux x86_64;
--locked, no publish-age override in the environment):cargo metadata --locked,cargo fmt --all -- --checkcargo check -p perry-runtime --no-default-features --features full --lib(regex feature off): 0 warningscargo check -p perry-runtime --lib --tests: no warnings outside the knownglobal_this_webassembly.rsdead code on maincargo test -p perry-runtime --lib -- --test-threads=1: 3699 passed, 1 failed. The failure isnative_stack::tests::stack_top_respects_custom_thread_stack_sizes, red on main.cargo clippy -p perry-runtime --lib --tests: the same 12approx_constanterrors as main. Diffed against the9b911855f8clippy baseline, the warnings added in this tree come from commits already onmain(arena/tests_batch_unregister.rs,gc/policy.rs, and perf(regex): bind once per split/replace/match, and split searches forward (#10165) #10174'sperex_split.rstest); none are in files fix(regex): do not cap RegExp operations by work (#10164) #10176 touchesscripts/run_lint_gates.shscript tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main at5cec2fbbc9(1 of 77, same gate). The compile tier was not run.check_changeset_fragment.sh PerryTS/perry 10176: passWORK = 100_000_000failsperex_operation_allowance_admits_linear_work_beyond_the_former_limit.GitHub runners are down, so this local replay is the gate. Next in order: #10181, then #10183.
https://claude.ai/code/session_01Da12JXeG5XuVBma5yWp5C9
Summary by CodeRabbit
Bug Fixes
split,replace, and matching operations can now complete without triggering a work-limit error.Chores