clockworklabs / clockworklabs/SpacetimeDB

`OnUnhandledReducerError` in client SDKs

Open
#2,513 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
25.2k
Forks
1.1k
Avg merge
2d 7h
Merged PRs (30d)
46

Description

Name not yet decided. Semantics basically locked in by BitCraft needs. Specifically:

When receiving a TransactionUpdate for a known reducer with status Failed or OutOfEnergy, check if there are any callbacks registered on that reducer. If none are registered, invoke the OnUnhandledReducerError with a ReducerEventContext containing the failed reducer and with an Error/Exception object that contains the error message.

Callbacks are of the type FnMut(&module_bindings::ReducerEventContext, sdk::Error).

For the OutOfEnergy case, the passed Error should be distinguishable as meaning out of energy.

Callbacks are registered and removed directly on the DbContext. In Rust, this means the trait DbContext has methods on_unhandled_reducer_error(&self, callback) -> OnUnhandledReducerErrorCallbackId and remove_on_unhandled_reducer_error(&self, callback_id: OnUnhandledReducerErrorCallbackId).

This is high priority in C#, as BitCraft needs this functionality. It is significantly lower priority in Rust and TypeScript.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the client SDK implementations of TransactionUpdate handling and DbContext callback registration, especially the Rust DbContext trait and the C# and TypeScript equivalents. Trace Failed and OutOfEnergy updates, then verify that unhandled reducer errors invoke the callback with ReducerEventContext and distinguishable error information across the intended SDKs.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, rust, typescript
Domain
api, developer-experience
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.