Skip to content

fix(runtime): compile error/3 and raise its reason - #23

Merged
mremond merged 1 commit into
mainfrom
fm/task-92a05a11
Nov 13, 2026
Merged

mremond merged 1 commit into
mainfrom
fm/task-92a05a11

Conversation

@mremond

@mremond mremond commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Why

OTP libraries use error/3 to raise a reason with diagnostic options, but native compilation rejected these calls.

What changed

  • error/3 and erlang:error/3 compile and raise the supplied reason.
  • Tail calls, apply, fun references and computed calls raise the same error.
  • A shared native and BEAM regression covers options, argument evaluation and exception control flow.

Before and after

Before: Direct error/3 calls failed to compile; all three probed dynamic call shapes raised error:undef.

After: All nine regression call paths raise the supplied reason, and all three dynamic probe results match BEAM.

This changes native compilation and raised exceptions, not a screen; the evidence is compiled program output compared with BEAM.

Checked

Live validation: Demonstrated for this version. 1 of 1 scenarios driven live in the product.

Scenario Result Evidence
error/3 compiles and raises the supplied reason through direct and dynamic calls, matching BEAM. ✅ Passed live Thirty consecutive fixture executions completed with exact expected output; all three dynamic probe outputs match BEAM.
  • Regression on unchanged main: Main rejected unresolved erlang:error/3; dynamic probe paths raised error:undef.
  • Strict lint and Rust workspace gate: Clippy passed; 2,145 tests passed, none failed and one was ignored.
  • Allocator configuration and complete native end-to-end gate: Allocator defaults and override passed; 480 end-to-end tests passed, none failed and two external-module tests were skipped.
  • Independent code and proof reviews: Both passed with no findings at the committed version.
  • Pull request checks: All current-version checks passed or skipped, including native Linux and macOS end-to-end suites and cross-compilation.
How it was checked

Built the runtime before the compiler with cargo build --release --locked.

Ran cargo clippy --workspace --all-targets --locked -- -D warnings and cargo test --workspace --locked --no-fail-fast.

Ran python3 scripts/test-allocator-config.py and ./target/release/nera test -j 1 --timeout 30.

Compared compiled native programs with BEAM, including ten consecutive executions of the new fixture in each mode.

Local execution covered macOS arm64; hosted checks also passed native Linux x86_64 execution and both cross-compilation jobs.

Risk

Risk: low in every dimension.

Full risk assessment
Dimension Level Why
Blast radius low One exception entry plus its direct and dynamic registrations.
Behavior low Calls now compile and raise the intended reason instead of failing or raising undef.
Undo low Reverting the change requires no data migration.
Evidence low Compiled native behavior matches BEAM and the complete local gate passed.
Sensitivity low No accounts, keys, saved settings or production data.
Novelty low The new entry reuses the existing error/1 exception path.
Dependencies low No dependency changes.
Not done

Args and error_info metadata are accepted but not retained in Nera's arity-only stacktrace frames.

Pipeline

Updates from git push no-mistakes

Infinitary checked this version: an independent review that also judged the documents, and live validation the review accepted.

Register the native entry for direct and dynamic calls, reusing the existing error exception path. Add an OTP 29 parity fixture and document that Args and error_info metadata are not retained in stacktrace frames.
@github-actions github-actions Bot added this to the 0.1.1 milestone Nov 13, 2026
@mremond
mremond merged commit fc58ac2 into main Nov 13, 2026
22 checks passed
@mremond
mremond deleted the fm/task-92a05a11 branch November 14, 2026 11:03
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