Skip to content

Deprecate ReducerContext::identity in favor of database_identity#4843

Open
Mr-Dust0 wants to merge 1 commit intoclockworklabs:masterfrom
Mr-Dust0:issue-3201-database-identity
Open

Deprecate ReducerContext::identity in favor of database_identity#4843
Mr-Dust0 wants to merge 1 commit intoclockworklabs:masterfrom
Mr-Dust0:issue-3201-database-identity

Conversation

@Mr-Dust0
Copy link
Copy Markdown

@Mr-Dust0 Mr-Dust0 commented Apr 18, 2026

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

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 18, 2026

CLA assistant check
All committers have signed the CLA.

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.

Deprecate ReducerContext::identity in favor of ReducerContext::database_identity

2 participants