Skip to content

fix(runtime): route parse error slots through a silent context probe#2670

Merged
slepp merged 3 commits into
mainfrom
fix/2658-parse-error-slot-probe
Jul 16, 2026
Merged

fix(runtime): route parse error slots through a silent context probe#2670
slepp merged 3 commits into
mainfrom
fix/2658-parse-error-slot-probe

Conversation

@slepp

@slepp slepp commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Why

Parse error-slot routing (set_error/clear_error/get_error in hew-runtime/src/parse_error_slot.rs) identified the current actor via the diagnostic extern hew_actor_current_id(). When no execution context is installed, that extern writes the EXECUTION_CONTEXT_NOT_INSTALLED sentinel into LAST_ERROR as a side effect — so merely routing an error slot could corrupt the very error state the slot exists to protect. A prior parse error (or a clean null slot) got clobbered with an unrelated context diagnostic on non-actor threads.

Fixes #2658

What

  • runtime: added hew_actor_current_id_silent(), a pub(crate) probe built on the non-clobbering execution_context::current_context() and the shared actor_id_from_context helper — same actor-id semantics, no LAST_ERROR write. All three parse error-slot routing sites now use it. The diagnostic extern hew_actor_current_id() is untouched: same #[no_mangle] extern "C" signature, same sentinel-write contract (callers such as the execution-context tests explicitly consume that write).
  • tests: a divergence test pins both contracts — silent probe returns -1 and leaves hew_last_error() null; diagnostic extern returns -1 and writes exactly the EXECUTION_CONTEXT_NOT_INSTALLED constant. Four non-actor regressions cover the error slot preserving a prior error and staying null from clean. A WASM scheduler parity test drives a real mailbox → enqueue → hew_sched_run dispatch and asserts both probes agree inside dispatch and stay silent outside it.

Test

  • silent_probe_diverges_from_diagnostic_on_missing_context (actor.rs) — mutation-verified: reverting the silent probe to require_current_context() fails this test plus all four non-actor slot tests
  • nonactor_* regression tests in parse_error_slot.rs (prior-error preserved; slot stays null from clean)
  • self_api_sees_current_actor_during_dispatch extended in scheduler_wasm.rs for silent/diagnostic probe parity on the WASM scheduler path

Quality Checklist

  • PR title, body, and commit messages avoid internal-only orchestration/model vocabulary
  • No new .ok()? or unwrap_or_default() in codegen without // JUSTIFIED comment
  • New allocations have cleanup paths for sync, async, and actor shutdown contexts
  • Serialization changes include round-trip encode/decode tests (n/a — no serialization change)
  • New runtime features have WASM implementation or // WASM-TODO(#NNN): marker, and new hew_* exports are classified in scripts/jit-symbol-classification.toml (silent probe is pub(crate), not an export; WASM path covered by the parity test)
  • No duplicated logic — the silent probe reuses current_context() and the shared actor_id_from_context helper

slepp added 3 commits July 15, 2026 13:05
The parse_error_slot routing decision (actor map vs. thread-local
fallback) called hew_actor_current_id(), whose missing-context path
writes "execution context not installed" into the generic last-error
slot. Every non-actor set/get/clear — the module's own documented
fallback path — therefore clobbered an unrelated real error, for every
error kind (json/yaml/toml/datetime/cron/...).

Add hew_actor_current_id_silent(), which probes current_context()
without the diagnostic write, factor the shared actor-id derivation
into actor_id_from_context(), and route all three parse_error_slot
call sites through the silent probe. The extern "C"
hew_actor_current_id() keeps its diagnostic contract bit-for-bit:
callers that treat an absent context as a failure still get the
last-error write, pinned by a new regression test.

Fixes #2658
Extend the dispatch-identity regression: under WASM-scheduler dispatch
hew_actor_current_id_silent() must report the same actor ID as the
diagnostic accessor, and outside dispatch it must return -1 while
leaving the generic last-error slot untouched.
@slepp slepp merged commit a2fb5b1 into main Jul 16, 2026
12 checks passed
@slepp slepp deleted the fix/2658-parse-error-slot-probe branch July 16, 2026 07:17
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: use a silent context probe for parse error slots

1 participant