Skip to content

fix(runtime-limits): charge built-in iteration loops against loop budget#5070

Closed
linisha15 wants to merge 3 commits intoboa-dev:mainfrom
linisha15:fix/runtime-limits-builtin-iteration-5060
Closed

fix(runtime-limits): charge built-in iteration loops against loop budget#5070
linisha15 wants to merge 3 commits intoboa-dev:mainfrom
linisha15:fix/runtime-limits-builtin-iteration-5060

Conversation

@linisha15
Copy link
Contributor

@linisha15 linisha15 commented Mar 14, 2026

Description

Summary
This PR ensures built-in iteration performed in Rust respects the runtime loop budget configured via set_loop_iteration_limit.

What changed

  • Added loop-budget charging in built-in iteration paths using IncrementLoopIteration::operation((), context).
  • Covered String.prototype.repeat and shared Array/TypedArray iteration helper paths.
  • Added runtime-limit parity tests to ensure behavior matches VM loop limits.
  • Added regression coverage for large repeat counts to prevent unbounded work.

Why
Previously, loop limits applied to VM-compiled loops but not all built-in Rust loops, which could bypass runtime protection.

Validation
-Verified runtime-limit tests for:

  • VM loop limit behavior
  • Built-in parity behavior
  • Large repeat regression behavior

Closes #5060

@linisha15 linisha15 requested a review from a team as a code owner March 14, 2026 19:00
@linisha15
Copy link
Contributor Author

Hi! @jedel1043 , please review my pr .

@github-actions
Copy link

github-actions bot commented Mar 14, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 49,935 49,935 0
Ignored 2,207 2,207 0
Failed 821 821 0
Panics 0 0 0
Conformance 94.28% 94.28% 0.00%

Tested main commit: 1dacd48b3356a377ba9d594d9a9ce898b519f7a6
Tested PR commit: c82d6ae9dfcc53f21472ad641f19bb5ecbca42bc
Compare commits: 1dacd48...c82d6ae

@codecov
Copy link

codecov bot commented Mar 14, 2026

Codecov Report

❌ Patch coverage is 42.85714% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.13%. Comparing base (6ddc2b4) to head (e236b5a).
⚠️ Report is 852 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/builtins/typed_array/builtin.rs 25.00% 12 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5070       +/-   ##
===========================================
+ Coverage   47.24%   59.13%   +11.88%     
===========================================
  Files         476      563       +87     
  Lines       46892    62589    +15697     
===========================================
+ Hits        22154    37011    +14857     
- Misses      24738    25578      +840     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jedel1043 jedel1043 added Waiting On Review Waiting on reviews from the maintainers and removed waiting-for-review labels Mar 15, 2026
@linisha15
Copy link
Contributor Author

Since the issue has already been resolved in another PR, I'll close this one. Thanks!

@linisha15 linisha15 closed this Mar 15, 2026
@github-actions github-actions bot removed the Waiting On Review Waiting on reviews from the maintainers label Mar 15, 2026
@linisha15 linisha15 deleted the fix/runtime-limits-builtin-iteration-5060 branch March 15, 2026 17:46
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.

Runtime limits: ensure built‑in iteration helpers respect set_loop_iteration_limit

2 participants