github clockworklabs/SpacetimeDB v2.12.0
Release v2.12.0

3 hours ago

New Features

Persistent typed database environments

SpacetimeDB modules can now declare typed environment variables for configuration and secrets. Rust, TypeScript, C#, and C++ modules can read declared values through their execution context, with support for required and optional strings as well as constrained sets of allowed values.

Values can come from project configuration or the publishing process's environment. They are validated against the module's declarations and updated atomically with a module publish. Stored values are preserved by default across publishes, while --env-only, --unset-env, and --replace-env support configuration changes without replacing the module. Authorized users can inspect published values with spacetime env get and spacetime env list.

(#5887, #5961, #6004)

Automatic reconnect for TypeScript and C# clients

The TypeScript and C# SDKs can now keep a DbConnection, its client cache, subscriptions, table handles, and registered callbacks usable across temporary connection loss. Applications can opt in with withAutomaticReconnect() in TypeScript or WithAutomaticReconnect() in C#.

Reconnect attempts use exponential backoff, replay active subscriptions, reconcile the refreshed state with the existing client cache, and preserve the client's identity. Applications using expiring credentials can provide refreshed tokens through withTokenProvider() or WithTokenProvider().

Rust and C++ are coming in a future update.

(#5927, #5956)

Unit testing for Rust and TypeScript modules

Rust and TypeScript modules can now test module logic against an in-memory datastore without publishing to a running SpacetimeDB server. The new test utilities support reducer transactions, procedure and view contexts, typed queries, authentication, deterministic clock and random-number helpers, and mocked procedure HTTP behavior.

The Rust API is available through spacetimedb::test_utils, while TypeScript modules can use spacetimedb/server/test-utils with Vitest. The Rust console-chat and TypeScript React-chat templates include example tests.

TypeScript module tests now also work when the SDK is installed from npm rather than a workspace checkout. Mock HTTP responders can return string or binary response bodies, allowing procedures under test to consume mocked responses through APIs such as text() and json().

(#5558, #6139)

Improvements

HTTP/2 support for procedure HTTPS requests

Outbound HTTPS requests from procedures now negotiate HTTP/2 when the remote service supports it. This allows modules to call HTTP/2-only APIs such as Apple Push Notification service while remaining compatible with HTTP/1.1 servers.

(#6012)

Rollback-safe system-table additions

New databases now write system-table schema information to the commit log before writing rows to those tables. This allows older SpacetimeDB versions to replay databases containing system tables they do not recognize, improving rollback safety for this and future releases.

(#6004)

Clearer local schema validation errors

spacetime publish, spacetime generate, and other commands that inspect a module locally now include the underlying schema validation or module-inspector diagnostic instead of reporting only that schema inspection failed.

(#6079)

Security

Symmetric JWT signing algorithms are rejected

SpacetimeDB now rejects JWTs signed with HS256. Symmetric signing cannot be validated through an issuer's public key in the same way as supported asymmetric algorithms, so these tokens are no longer accepted for authentication.

(#6100)

Bug Fixes

Isolated PostgreSQL authentication state per connection

The PostgreSQL wire-protocol server now keeps authentication and session state isolated to each client connection. SQL execution is rejected until that connection has completed authentication, preventing failed or incomplete connection attempts from inheriting another connection's database or identity.

(#6134)

Fixed duplicate interval-scheduled reducer calls

Updating an interval-scheduled row without changing its scheduling data no longer leaves duplicate pending queue entries for the same row. The scheduler now replaces the existing pending entry instead of enqueueing an additional call.

(#5951)

Fixed TypeScript compiler detection on Windows

The CLI now recognizes tsc.exe in addition to tsc.cmd when locating the TypeScript compiler. This restores type checking for Windows projects using package managers such as Bun.

(#6024)

Fixed missing TypeScript SDK build dependency

The TypeScript SDK now declares terser as a development dependency, making clean SDK builds reproducible without relying on an undeclared package.

(#6083)

Additional Changes

  • The SDK test suite was split into a dedicated package and harness to simplify shared cross-SDK testing. (#5854)
  • The Rust toolchain was updated to 1.97.1. (#6080)
  • CLI documentation now links to the correct Rust API documentation. (#6028)
  • Internal groundwork for asynchronous inter-database communication was added, but asynchronous IDC is not yet exposed as a complete user-facing feature. (#6084, #6104)

What's Changed

  • Added persistent typed database environments for Rust, TypeScript, C#, and C++ modules in #5887, refined their publishing API in #5961, and made system-table additions rollback safe in #6004
  • Added Automatic reconnect for TypeScript clients in #5927
  • Added Automatic reconnect for C# clients in #5956
  • Added Rust and TypeScript module unit-testing support in #5558 and fixed npm-installed TypeScript test projects and mocked HTTP response bodies in #6139
  • Enabled HTTP/2 negotiation for procedure HTTPS requests in #6012
  • Restored detailed schema validation diagnostics in #6079
  • Rejected JWTs signed with symmetric HS256 in #6100
  • Isolated PostgreSQL authentication and session state per connection in #6134
  • Fixed duplicate pending interval-scheduled reducer calls in #5951
  • Fixed TypeScript compiler detection for Bun projects on Windows in #6024
  • Declared the TypeScript SDK's terser development dependency in #6083
  • Split the SDK test suite into a dedicated package and harness in #5854
  • Added the first internal components for asynchronous inter-database communication in #6084 and #6104

Full public changelog: v2.11.0...release/candidate/v2.12.0

Don't miss a new SpacetimeDB release

NewReleases is sending notifications on new releases.