Files
SpacetimeDB/modules/sdk-test-procedure-cpp
Luke c7af2d4cd3 Deprecate ReducerContext::identity in favor of database_identity (#4843)
## Summary
- add `ReducerContext::database_identity()` in Rust bindings
- deprecate `ReducerContext::identity()` and keep it as a compatibility
alias
- update reducer docs example to use `ctx.database_identity()`
- add C# reducer-context equivalent: `DatabaseIdentity` and obsolete
`Identity` alias
- update Rust/C# module test callsites to the new API name
- update C# codegen snapshots for generated `ReducerContext` API output

## Why
Issue #3201 reports user confusion between reducer `ctx.identity()`
(database/module identity) and `ctx.sender`. This change clarifies
naming while preserving compatibility.

## Validation
- `cargo check -p spacetimedb -p module-test` (Passed)
- `dotnet test crates/bindings-csharp/Codegen.Tests/Codegen.Tests.csproj
--nologo` (Passed)
- `dotnet test crates/bindings-csharp/Runtime.Tests/Runtime.Tests.csproj
--nologo` (Failed) pre-existing unrelated failure:
- `Runtime.Tests/JwtClaimsTest.cs(10,23): CS1729: 'JwtClaims' does not
contain a constructor that takes 2 arguments`

## Compatibility
- Rust: `identity()` still works but is deprecated in favor of
`database_identity()`.
- C#: `Identity` still works but is marked `[Obsolete]` in favor of
`DatabaseIdentity`.

Closes #3201
2026-05-04 19:50:39 +00:00
..
2026-02-07 04:26:45 +00:00
2026-02-07 04:26:45 +00:00
2026-02-07 04:26:45 +00:00
2026-02-07 04:26:45 +00:00

SDK Test Procedure C++

This module tests the procedure functionality in the SpacetimeDB C++ bindings.

Tests Included

  • return_primitive: Procedure returning primitive type (u32)
  • return_struct: Procedure returning custom struct
  • return_enum_a/return_enum_b: Procedures returning enum variants
  • will_panic: Procedure that panics (for error testing)

Tests Excluded (Part 2+)

The following Rust tests are excluded as they require features not yet implemented:

  • HTTP requests (read_my_schema, invalid_request)
  • Transactions (insert_with_tx_commit, insert_with_tx_rollback)
  • Scheduled procedures (schedule_proc, scheduled_proc)

Building

.\compile.bat

This will generate lib.wasm in the build directory.