mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 23:59:43 -04:00
c7af2d4cd3
## 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
module-test Rust test
Called as part of our integration tests to ensure the system is working as expected.
Note: Also mirrored as a C# version at
modules/module-test-cs, so must be kept in sync.
How to Run
Execute individual tests with module-test for Rust and module-test-cs for C#
at standalone_integration_test, or call
# Will run both Rust/C# module
cargo test -p spacetimedb-testing
# Only Rust
cargo test -p spacetimedb-testing rust
# Only C#
cargo test -p spacetimedb-testing csharp