Skip to content

fix(vm/opcode/push,environment,templates,generator,await,new): convert panics to EngineError::Panic using js_expect#5232

Open
KaustubhOG wants to merge 1 commit intoboa-dev:mainfrom
KaustubhOG:fix/vm-opcode-push-env-templates-panics
Open

fix(vm/opcode/push,environment,templates,generator,await,new): convert panics to EngineError::Panic using js_expect#5232
KaustubhOG wants to merge 1 commit intoboa-dev:mainfrom
KaustubhOG:fix/vm-opcode-push-env-templates-panics

Conversation

@KaustubhOG
Copy link
Contributor

@KaustubhOG KaustubhOG commented Mar 22, 2026

Part of #3241.

Converts all convertible .expect() panics to .js_expect()? in:

  • opcode/push/array.rs (4)
  • opcode/push/environment.rs (2)
  • opcode/push/class/mod.rs (1)
  • opcode/push/class/field.rs (8)
  • opcode/push/class/private.rs (12)
  • opcode/environment/mod.rs (12)
  • opcode/templates/mod.rs (7)
  • opcode/generator/mod.rs (6)
  • opcode/generator/yield_stm.rs (2)
  • opcode/await/mod.rs (5)
  • opcode/new/mod.rs (2)

Total: 61 panics converted.

@KaustubhOG KaustubhOG requested a review from a team as a code owner March 22, 2026 19:42
@github-actions github-actions bot added Waiting On Review Waiting on reviews from the maintainers C-VM Issues and PRs related to the Boa Virtual Machine. and removed Waiting On Review Waiting on reviews from the maintainers labels Mar 22, 2026
@github-actions github-actions bot added this to the v1.0.0 milestone Mar 22, 2026
@KaustubhOG KaustubhOG force-pushed the fix/vm-opcode-push-env-templates-panics branch from 8a12289 to 8be07af Compare March 22, 2026 19:44
@github-actions github-actions bot added the Waiting On Review Waiting on reviews from the maintainers label Mar 22, 2026
@github-actions
Copy link

github-actions bot commented Mar 22, 2026

Test262 conformance changes

Test result main count PR count difference
Total 52,963 52,963 0
Passed 50,545 50,545 0
Ignored 1,426 1,426 0
Failed 992 992 0
Panics 2 2 0
Conformance 95.43% 95.43% 0.00%

Tested main commit: 0592ecc32629c18d43dc136b6675ef980f37a061
Tested PR commit: 0042a0b56e9bcaed3e28541eeec4be05ca007ae3
Compare commits: 0592ecc...0042a0b

…t panics to EngineError::Panic using js_expect
@KaustubhOG KaustubhOG force-pushed the fix/vm-opcode-push-env-templates-panics branch from 8be07af to 0042a0b Compare March 22, 2026 20:00
@KaustubhOG
Copy link
Contributor Author

To this pr i tried one new thing
For functions returning ControlFlow<CompletionRecord>, ? is not available, so js_expect cannot be used directly. A new pattern was introduced using let..else + handle_error + PanicError:

let Some(value) = some_option else {
    return context.handle_error(PanicError::new("msg").into());
};

This ensures panics are still converted to EngineError::Panic without requiring a JsResult context. Happy to revert these if a different approach is preferred.

@codecov
Copy link

codecov bot commented Mar 22, 2026

Codecov Report

❌ Patch coverage is 46.80851% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.85%. Comparing base (6ddc2b4) to head (0042a0b).
⚠️ Report is 916 commits behind head on main.

Files with missing lines Patch % Lines
core/engine/src/vm/opcode/push/class/private.rs 0.00% 9 Missing ⚠️
core/engine/src/vm/opcode/await/mod.rs 40.00% 6 Missing ⚠️
core/engine/src/vm/opcode/generator/yield_stm.rs 28.57% 5 Missing ⚠️
core/engine/src/vm/opcode/generator/mod.rs 50.00% 4 Missing ⚠️
core/engine/src/vm/opcode/push/array.rs 66.66% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main    #5232       +/-   ##
===========================================
+ Coverage   47.24%   59.85%   +12.60%     
===========================================
  Files         476      582      +106     
  Lines       46892    63478    +16586     
===========================================
+ Hits        22154    37992    +15838     
- Misses      24738    25486      +748     

☔ 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-VM Issues and PRs related to the Boa Virtual Machine. Waiting On Review Waiting on reviews from the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant