Skip to content

ProcedureCallError: preserve distinction between guest and host errors - #5855

Open
mahmudsudo wants to merge 2 commits into
clockworklabs:masterfrom
mahmudsudo:master
Open

ProcedureCallError: preserve distinction between guest and host errors#5855
mahmudsudo wants to merge 2 commits into
clockworklabs:masterfrom
mahmudsudo:master

Conversation

@mahmudsudo

Copy link
Copy Markdown

Description of Changes

Addresses #5660 (follow-up from #5640).

Previously, ProcedureCallError combined all execution failures into InternalError(String), lumping guest module panics/traps together with host internal errors. Consequently, procedure error logging in the HTTP API handler was temporarily downgraded to log::info! to avoid false positive host alerts triggered by guest panics.

This PR:

  1. Adds a GuestPanic(String) variant to ProcedureCallError in crates/core/src/host/module_host.rs.
  2. Updates InstanceCommon::call_procedure in crates/core/src/host/wasm_common/module_host_actor.rs to return ProcedureCallError::GuestPanic when guest execution encounters a panic/trap, while preserving ProcedureCallError::InternalError for host-side failures (such as return value deserialization failure).
  3. Updates map_procedure_error in crates/client-api/src/routes/database.rs to:
    • Log ProcedureCallError::GuestPanic at log::debug! level (preventing false alarm host alerts).
    • Log ProcedureCallError::InternalError at log::error! level (ensuring host alerts fire on internal host failures).
  4. Adds unit test test_map_procedure_error_distinguishes_guest_panic_and_internal_error.

API and ABI breaking changes

No breaking changes to the external client wire protocol or HTTP status codes. Internal Rust enum ProcedureCallError in spacetimedb_core::host received an additional GuestPanic variant.

Expected complexity level and risk

1 - Low risk, targeted error variant separation and log level correction.

Testing

  • Added unit test test_map_procedure_error_distinguishes_guest_panic_and_internal_error in crates/client-api/src/routes/database.rs
  • Verified ProcedureCallError variant handling and log levels

@CLAassistant

CLAassistant commented Sep 2, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Signed-off-by: TheRustFanatic <75342173+mahmudsudo@users.noreply.github.com>
@mahmudsudo

Copy link
Copy Markdown
Author

@JasonAtClockwork

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.

2 participants