Skip to content

Merge train 178: #10176 - #10192

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

Merge train 178: #10176#10192
proggeramlug merged 3 commits into
mainfrom
train178

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

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 5cec2fbbc9 without conflicts and match by git patch-id --stable.

Before landing, #10176 was rebased onto main after train 177 (#10174). The two PRs merged cleanly as text, but the combined tree did not compile: #10176's perex_work_policy test called api::execute_with_resources with 6 arguments, and #10174 added the reuse parameter. The test now passes None, 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 -- --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 on main
  • cargo test -p perry-runtime --lib -- --test-threads=1: 3699 passed, 1 failed. The failure is native_stack::tests::stack_top_respects_custom_thread_stack_sizes, red on main.
  • cargo clippy -p perry-runtime --lib --tests: the same 12 approx_constant errors as main. Diffed against the 9b911855f8 clippy baseline, the warnings added in this tree come from commits already on main (arena/tests_batch_unregister.rs, gc/policy.rs, and perf(regex): bind once per split/replace/match, and split searches forward (#10165) #10174's perex_split.rs test); none are in files fix(regex): do not cap RegExp operations by work (#10164) #10176 touches
  • scripts/run_lint_gates.sh script tier: 76 of 77 pass. The failure is public benchmark evidence freshness, identical on main at 5cec2fbbc9 (1 of 77, same gate). The compile tier was not run.
  • check_changeset_fragment.sh PerryTS/perry 10176: pass
  • Fault injection on the rebased PR head: restoring WORK = 100_000_000 fails perex_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

    • RegExp operations are no longer interrupted by a fixed work limit for valid, large inputs.
    • Large split, replace, and matching operations can now complete without triggering a work-limit error.
    • Existing memory limits and cancellation behavior remain unchanged.
  • Chores

    • Updated the application version to 0.5.1550.

Ralph Küpper 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
@proggeramlug
proggeramlug merged commit df886c6 into main Sep 13, 2026
19 of 21 checks passed
@proggeramlug
proggeramlug deleted the train178 branch September 13, 2026 11:38
@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: 1c5e5bff-cb4c-49f3-a764-fc18a29112bd

📥 Commits

Reviewing files that changed from the base of the PR and between 5cec2fb and 40feb58.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • CLAUDE.md
  • Cargo.toml
  • changelog.d/10176-regex-no-work-cap.md
  • crates/perry-runtime/src/gc/tests/runtime_roots.rs
  • crates/perry-runtime/src/gc/tests/runtime_roots/perex_work_policy.rs
  • crates/perry-runtime/src/regex/perex_api.rs

📝 Walkthrough

Walkthrough

The regex runtime work allowance changes from a fixed limit to usize::MAX. A feature-gated test covers searches beyond the former limit. The changelog documents the behavior, and project versions advance to 0.5.1550.

Changes

Regex work policy

Layer / File(s) Summary
Remove regex work cap and validate heavy searches
crates/perry-runtime/src/regex/perex_api.rs, crates/perry-runtime/src/gc/tests/runtime_roots.rs, crates/perry-runtime/src/gc/tests/runtime_roots/perex_work_policy.rs
The regex work allowance now uses usize::MAX. Searches continue to run in slices with collector polling, and memory limits remain unchanged. A test verifies completion beyond the former allowance.
Document and version the behavior change
changelog.d/10176-regex-no-work-cap.md, Cargo.toml, CLAUDE.md
The changelog records the removed work-limit error. The workspace package and documented current version change to 0.5.1550.

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

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: jdalton

✨ 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 train178

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