IDC: Outbox implemenation by Shubham8287 · Pull Request #4780 · clockworklabs/SpacetimeDB

added 4 commits

April 13, 2026 15:41
 1. ST_OUTBOUND_MSG
	1. Maintains an auto-incrementing msg_id per sender.
	2. Stores in-flight outbound reducer calls (outbox pattern).
	3. Used by IdcActor to issue remote calls with strictly increasing msg_id.
2. ST_INBOUND_MSG
	1. Tracks latest processed msg_id per sender along with reducer result
	2. For duplicate requests where the msg_id is already present, the result is returned without executing the reducer.
	3. Requests with a msg_id older than the latest seen for a sender are dropped
- update `schema` crate for validation logic
- update `TableSchema` with `outbox: Option<OutboxDef>` field
- Drives reducer execution from `ST_OUTBOUND_MSG`
- Calls `on_result` reducer and delete entry from  `ST_OUTBOUND_MSG` in same transaction.
- If reducer fails, delete entry in next transaction, somewhat similar to `SchedulerActror`
- Reducer failure are only considered if reducer actually ran and returned error, all other cases of error will result in retrying.

`call_from_database(database_identity, msg_id, params)`

- Caller should ensure `msg_id` never decrease for same sender `database_identity` else API returns `InvalidRequest`.
- If reducer ran and failed it returns `StatusCode::UNPROCESSABLE_ENTITY`, which caller shouln't retry.
- All other errors, including network errors are retried by `IdcActor`.

This was referenced

Apr 13, 2026