Commit Graph

3295 Commits

Author SHA1 Message Date
Jason Larabie 44f9581487 @brougkr fix(unreal): Replace FTickableGameObject with FTSTicker (#4835)
# Description of Changes
This is a copy of #4006 with only the updates to the way Unreal handles
ticks. As per @brougkr findings:

- **FTickableGameObject initialization order bug** - Replaced with
FTSTicker for reliable tick registration:
  - Removed FTickableGameObject inheritance
  - Added FTSTicker::FDelegateHandle for manual tick registration
  - Added destructor to clean up ticker registration
  - Added OnTickerTick() method

### Issue
FTickableGameObject registers itself in its constructor BEFORE
UDbConnectionBase's constructor body runs. Even with
ETickableTickType::Never, UE's GENERATED_BODY() macro can interfere with
base class initialization order, causing the default constructor to be
called instead.

# API and ABI breaking changes

- Refactor of an underlying component of the SDK and non-breaking.

# Expected complexity level and risk

2 - This changes the structure of how the database tooling can
auto-tick, but is invisible to the developer

# Testing

As this changes a core feature I tested all aspects:
- [x] Reproduced the bug and confirmed against `master` and this branch
to see the fix working
- [x] Ran full suite of Unreal tests
- [x] Manually tested Unreal Blackholio
2026-04-23 21:06:20 +00:00
Zeke Foppa 70db721c3a Revert breaking PRs (#4881)
# Description of Changes

Revert the following PRs that have caused some breakage:
```
a32cffa76 Finish refactoring out replay (#4850)
d639be0af Replay: some code motion & reuse `ReplayCommittedState` (#4849)
78d6b6f7d Update NativeAOT-LLVM infrastructure to current ABI (#4515)
d5c1738c1 Better module backtraces for panics and whatnot (#577)
6f23b19f3 Wait for database update to become durable (#4846)
81c9eab86 Add `spacetime lock/unlock` to prevent accidental database deletion (#4502)
809aebd7c Move field `replay_table_updated` to `ReplayCommittedState` (#4807)
21b58ef99 Update axum (#2713)
b5cadff7a Extract replay stuff out of `CommittedState`, part 1 (#4804)
```

I also updated the Python smoketests for breakage introduced in
https://github.com/clockworklabs/SpacetimeDB/pull/4502. Reverting that
PR caused conflicts, so this fix is more straightforward.

# API and ABI breaking changes

Maybe kind of, but we haven't released any of these.

# Expected complexity level and risk

1

# Testing

Ask @bfops about testing

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-23 14:54:23 -07:00
Mazdak Farrokhzad adbe22b556 bindings: reuse panic message for datastore_index_scan_point_bsatn (#4876)
# Description of Changes

See tin.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Covered by existing tests.
2026-04-23 12:49:17 +00:00
Mazdak Farrokhzad a32cffa769 Finish refactoring out replay (#4850)
# Description of Changes

Move the rest of replay logic to `mod replay`.

Closes #4055.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

Just code motion.
2026-04-23 10:49:20 +00:00
Mazdak Farrokhzad 7c51914cd5 Indices: house keeping (privatize stuff + fix minor bug in insert_index) (#4782)
# Description of Changes

Index code housekeeping: Privatizes `TableIndex` fields, fixes
`insert_index` panic logic, and adds some useful helpers for future
work.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Covered by existing tests
2026-04-23 10:26:54 +00:00
Mazdak Farrokhzad e7294bf2e8 Add support for bytes key btree indices (#4733)
# Description of Changes

Add support for btree indices where the keys are encoded byte strings
for e.g., multi-column indices of no-unbounded-types (arrays and
strings) that aren't floats.

The main interesting stuff in this PR is in `bytes_key.rs` which defines
`RangeCompatBytesKey`, a type that is derived from `BytesKey`, by
converting little-endian encoded integers to big-endian. Signed integers
are now also supported, but floats are not. `table_index/mod.rs` also
includes a bunch of interesting stuff.

# API and ABI breaking changes

Technically this fixes pre-existing bugs in the handling of `Excluded`
ranges for multi-col indices.

# Expected complexity level and risk

2?

# Testing

- A proptest `order_in_bsatn_is_preserved` is now adjusted and enabled
to exercise the ordering of `RangeCompatBytesKey`.
- A proptest `btree_multi_col_range_scans_work` is added to check the
behavior of range scans on multi-col indices.

---------

Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-04-23 07:51:58 +00:00
Ryan 86b3ac1453 Fix SQL parser to support negative numbers in INSERT statements (#4660)
This fix is intended to resolve the community reported issue #4659

# Description of Changes
Add handling for `UnaryOperator::Minus` and `UnaryOperator::Plus` in a
new `parse_insert_value()` used during `INSERT` operations. This works
by convert negative unary expressions to signed numeric strings in
INSERT VALUES clauses.

# API and ABI breaking changes
None.

# Expected complexity level and risk
1 (Low). Localized parser fix.

# Testing
- [X] Ran local tests to verify negative numbers work in Rust,
TypeScript, and C# modules
- [X] Confirmed positive numbers and invalid expressions still work
correctly
* Testing involved running `spacetime sql module "INSERT INTO table
(col) VALUES (-100.0);"` from a CLI.

---------

Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-04-23 03:59:17 +00:00
Zeke Foppa 033c625eb5 Smoketests - Fix another name collision (#4873)
# Description of Changes

Similar to some changes made in
https://github.com/clockworklabs/SpacetimeDB/pull/4269.

Found another smoketest with a name collision which could cause flakes
when running against a remote server.

# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

# Expected complexity level and risk

1

# Testing

- [ ] Smoketests pass

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-23 02:00:22 +00:00
Zeke Foppa 604bb3e649 CI - Move simple jobs into cargo ci (#4871)
# Description of Changes

Migrate these checks into `cargo ci`:
- Check that packages are publishable
- Docs test
- TypeScript - Tests

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

2

# Testing

- [ ] CI passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-23 01:13:25 +00:00
Zeke Foppa 0a08879e8a CI - cargo ci update-flow runs on Windows (#4874)
# Description of Changes

Removed some "if we're on windows" checks in the CI so that we're always
running through `cargo ci update-flow`.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

1.

# Testing

- [x] Upgrade flow tests pass

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 23:51:53 +00:00
Zeke Foppa 943ed7c0c7 CI - Merge workflow files (#4869)
# Description of Changes

Merged `typescript-test.yml` and `docs-test.yml` into `ci.yml`.

Note: The required checks will need to be updated when this PR is ready
to merge.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

1

# Testing

- [x] CI passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 22:16:13 +00:00
Zeke Foppa 2aa27b0dd7 CI - Move the DLL updating code into a function (#4868)
# Description of Changes

Just moving code into functions so it can be reused, no functional
changes.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

1

# Testing

None

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 19:35:18 +00:00
Zeke Foppa e2a74b5d1a cargo ci self-docs uses doc comments as well as explicit helptext (#4860)
# Description of Changes

Several args for `cargo ci` had empty helptext, because we were only
printing the explicitly-annotated helptext. This PR updates it so that
inline helptext also shows in the README.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

1

# Testing
- [x] Updated README has more helptext

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 19:04:53 +00:00
Zeke Foppa 2d67d76189 CI - Merge hooks (#4224)
# Description of Changes

Invoke a private workflow when a PR merges, so that we can do extra
follow-up actions.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

2

# Testing
- [x] When a PR merged with a corresponding private PR, I got a discord
notification:
<img width="543" height="70" alt="image"
src="https://github.com/user-attachments/assets/209347c3-57be-47d7-8d75-6154c9e222cb"
/>

- [x] When a PR merged without a corresponding private PR, no discord
notification

---------

Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 18:24:50 +00:00
Noa f896974b29 [TS] Implement near-heap-limit termination (#4777)
# Description of Changes

Uses `Isolate::add_near_heap_limit_callback` to prevent unbounded heap
growth. Upon nearing the heap limit, we will now:
1. Call `Isolate::terminate_execution`.
2. Request that v8 double the heap limit.

Then, upon finishing a function call, we lower the heap limit back down.

This should hopefully fix the issue where v8 hits the heap limit and
crashes the whole process.

Also improves the way termination requests are checked for and
processed.

# Expected complexity level and risk

2

# Testing

- [ ] Manual testing with memory-leaky modules
2026-04-22 17:19:26 +00:00
Zeke Foppa a7729f7dab CI - Fold typescript lint into cargo ci lint (#4856)
# Description of Changes

Merge the `TypeScript - Lint` CI job into `cargo ci lint`.

Note that this removes the custom caching for the pnpm store, but we're
planning to overhaul our CI cache approach anyway.

# API and ABI breaking changes

None. CI only.

# Expected complexity level and risk

1

# Testing

- [x] Lint step passes on this PR

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-22 16:24:00 +00:00
Mazdak Farrokhzad d639be0af6 Replay: some code motion & reuse ReplayCommittedState (#4849)
# Description of Changes

First two commits are code motion.
The second commit fixes a mistake I made in a previous PR that made us
use potentially several `ReplayCommittedState`s per
`datastore.replay(..)`.

More to come in terms of PRs; stay tuned.

# API and ABI breaking changes

None

# Expected complexity level and risk

3
2026-04-22 11:23:06 +00:00
joshua-spacetime 91494c9cf2 Keep subscription fanout worker warm with adaptive linger policy (#4805)
# Description of Changes

Similar to https://github.com/clockworklabs/SpacetimeDB/pull/4801, after
we evaluate subscriptions on the main database thread, we send the
results to a worker whose job it is to fan out the updates for the
relevant clients. Hence we want to make sure this worker is not
constantly parked on `recv()` as each `send` on the main thread will
incur overhead waking the task.

To avoid this I've added a utility that wraps an `mpsc`
`UnboundedReceiver` with an adaptive "linger" policy. On each message
`recv`, the worker will now "linger" for a period of time and wait for
any more messages before parking itself on the `recv()` again.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Manual performance testing for now. Automation to follow.
2026-04-22 01:21:44 +00:00
Tyler Cloutier 78d6b6f7dd Update NativeAOT-LLVM infrastructure to current ABI (#4515)
## Summary

- Update the experimental NativeAOT-LLVM build path
(`EXPERIMENTAL_WASM_AOT=1`) to include all host function imports from
ABI versions 10.0 through 10.4
- Fix the compiler package reference to work on both Windows x64 and
Linux x64 (was hardcoded to Windows only)
- Add a CI smoketest to verify AOT builds work on Linux x64

## Context

See #4514 for the full writeup on the C# AOT situation. The
`wasi-experimental` workload that all C# module builds depend on is
deprecated and removed from .NET 9+. NativeAOT-LLVM is the recommended
path forward for ahead-of-time compilation of C# to WebAssembly.

The existing NativeAOT-LLVM support (added by RReverser in #713) was
stale: missing imports added since then and a Windows-only package
reference.

## Changes

**`SpacetimeDB.Runtime.targets`:**
- Add 10 missing `WasmImport` declarations across spacetime_10.0 through
10.4
- Replace `runtime.win-x64.Microsoft.DotNet.ILCompiler.LLVM` with
`runtime.$(NETCoreSdkPortableRuntimeIdentifier).Microsoft.DotNet.ILCompiler.LLVM`
so it resolves correctly on Linux x64 as well
- Use explicit version strings instead of the `$(SpacetimeNamespace)`
variable

**`ci.yml`:**
- Add AOT build smoketest step in the `csharp-testsuite` job

## Test plan

- [x] CI smoketest passes: `EXPERIMENTAL_WASM_AOT=1 dotnet publish -c
Release` builds successfully on Linux x64
- [ ] Existing C# tests continue to pass (no changes to the default
interpreter path)

---------

Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
Co-authored-by: Ryan <r.ekhoff@clockworklabs.io>
Co-authored-by: Jason Larabie <jason@clockworklabs.io>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
2026-04-21 21:47:16 +00:00
DexterKoelson 59ac77970f Add useProcedure React hook and export procedures from codegen (#4752)
Closes #4751

# Description of Changes
- Add `useProcedure` React hook that mirrors `useReducer` which returns
a stable, typed callback that queues calls until the connection is ready
- Add `ProcedureParamsType` and `ProcedureReturnType` utility types to
`type_utils.ts`
- Update TypeScript codegen to emit `export const procedures =
__convertToAccessorMap(proceduresSchema.procedures)` in generated module
bindings, matching the existing pattern for reducers

```ts
import { procedures } from './module_bindings';
import { useProcedure } from 'spacetimedb/react';

const doSomeThing = useProcedure(procedures.doSomeThing);
const result = await doSomeThing({ foo: "..." });
```

# API and ABI breaking changes
None. Additive only — new hook export and new codegen line.

# Expected complexity level and risk
Low. The hook is a near-copy of `useReducer` adapted for procedure
signatures. The codegen change adds one line following the identical
pattern used for reducers.

# Testing
- [x] TypeScript SDK compiles with no new errors (`tsc --noEmit`)
- [x] All 170 existing tests pass (17 test files)
- [x] Tested end-to-end in a React app calling a procedure

---------

Co-authored-by: Jason Larabie <jason@clockworklabs.io>
2026-04-21 21:06:06 +00:00
Ryan 649e0a8379 Add sdk-test-procedure-cs test module (#4840)
# Description of Changes

Adds a `sdk-test-procedure-cs` test to the other test modules in
`sdks/rust/tests/test.rs`.
Functionally `sdk-test-procedure-cs` performs all the operations as the
Rust test `sdk-test-procedure` but through C#, fulfilling the
requirements of Issue #3951

# API and ABI breaking changes

No API or ABI changes, this only adds a test.

# Expected complexity level and risk

1

# Testing

- [X] Ran `cargo test -p spacetimedb-sdk csharp_procedures` locally
without errors.
2026-04-21 21:06:04 +00:00
Zeke Foppa ea834acb79 CI - move pnpm build into cargo ci test (#4855)
# Description of Changes

To make `cargo ci test` more properly include the full test logic.

# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

# Expected complexity level and risk

1

# Testing

honestly none

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-21 20:23:07 +00:00
Zeke Foppa 1c10afea0b CI - Move the git diff check under cargo ci smoketests (#4854)
# Description of Changes

To make `cargo ci` more properly the full test logic.

# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

# Expected complexity level and risk

1

# Testing

honestly none

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-21 20:10:40 +00:00
Zeke Foppa 0cbf4dc5c8 Add cargo lint as alias for cargo ci lint (#4853)
# Description of Changes

Just a one-line alias as requested

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

`cargo lint` properly runs `cargo ci lint`.

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-04-21 19:19:00 +00:00
Noa d5c1738c15 Better module backtraces for panics and whatnot (#577)
# Description of Changes


![image](https://github.com/clockworklabs/SpacetimeDB/assets/33094578/9c6356af-9b34-462a-8441-8bd859a73b86)

If these symbols aren't in the stack, it does no processing

# Expected complexity level and risk

1 - it's pretty self-contained, and backwards-compatible with the
existing logs data format

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-21 13:08:57 +00:00
Jason Larabie f1fe5db95a Update the defaultValue check to allow for falsy and undefined values (#4838)
# Description of Changes

This fixes a bug in TypeScript table default serialization where falsy
defaults like 0, '', false, and explicit undefined were treated as if no
default was provided. I did this as a property check in order to allow
`undefined` which becomes None() as the API allows `T | undefined`.

Closes: #4700 

# API and ABI breaking changes

N/A 

# Expected complexity level and risk

1 - Simple change to check the default value was added as a property

# Testing

- [x] Reproduced the failing issue in a simple throwaway project
2026-04-21 13:08:54 +00:00
Kim Altintop 6f23b19f36 Wait for database update to become durable (#4846)
Confirmed reads applies only to subscription clients, calls to the the
HTTP API publish endpoint return a success response before the operation
is confirmed.

While we await scheduling of a new database, updates require to wait for
the update transaction to be confirmed. To allow this, the
`TransactionOffset` channel and the database's `DurableOffset` need to
be returned all the way up to the request handler.

Note that waiting for confirmation is almost always the right choice, so
can't be opted out of at the time of submission of this patch. Callers
may, however, extend the timeout after which waiting for confirmation is
cancelled.
2026-04-21 07:58:57 +00:00
Ryan af37985a4d Adds a non-repeating scheduled reducer test (#3233)
# Description of Changes

Adds a non-repeating scheduled reducer integration test to the existing
Rust and C# integration tests, in order to address #3213

# API and ABI breaking changes

No

# Expected complexity level and risk

1

# Testing

- [X] Ran `cargo test -p spacetimedb-testing` and all tests passed

---------

Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
2026-04-20 23:19:04 +00:00
clockwork-labs-bot 81c9eab86c Add spacetime lock/unlock to prevent accidental database deletion (#4502)
## Motivation

Feature request: "Is there any way we can lock a module to prevent it
from being deleted? A bit concerned about some fat finger risk of
accidentally deleting prod."

## Solution

Adds a database lock mechanism. A locked database cannot be deleted
until explicitly unlocked.

### New CLI Commands

```bash
# Lock a database to prevent deletion
spacetime lock my-database

# Attempt to delete a locked database (fails with 403)
spacetime delete my-database
# Error: Database is locked and cannot be deleted. Run \`spacetime unlock\` first.

# Unlock when you actually need to delete
spacetime unlock my-database
spacetime delete my-database
```

Both commands support `--server` and `--no-config` flags, and resolve
the database from `spacetime.json` when no argument is given (same as
`spacetime delete`).

### New HTTP API

- `POST /v1/database/:name_or_identity/lock` -- Lock a database
- `POST /v1/database/:name_or_identity/unlock` -- Unlock a database

Both require the same authorization as `DELETE` (owner only).

### Implementation

- Lock state stored in a separate `database_locks` sled tree in the
standalone control DB (avoids changing the `Database` struct and needing
a data migration)
- `ControlStateReadAccess::is_database_locked()` and
`ControlStateWriteAccess::set_database_lock()` added to the trait
- `delete_database` route checks lock state before proceeding; returns
`403 Forbidden` with a descriptive message if locked
- Locking is idempotent (locking an already-locked database is a no-op,
same for unlock)
- Lock only prevents deletion, not publishing updates

### What is NOT locked

- `spacetime publish` (updating module code) still works on locked
databases
- Only `spacetime delete` is blocked

This matches the intent: protect prod from accidental destruction while
allowing normal deployments.

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-20 21:03:15 +00:00
Piotr Sarnacki 7726fe807a Add a test for #1121 (#1125)
# Description of Changes

While working on #1111 I realised that we have a bug with subscriptions
not being unique when multiple clients with the same identity are
connected. I fixed the bug and only then realised it was already fixed
yesterday in #1121. When working on my changes I created a test for the
issue, so I guess it doesn't hurt to at least submit it.

# Expected complexity level and risk

1

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-17 21:51:40 +00:00
Leo Voon dea509bfc1 Add Astro TypeScript template (#4688)
## Summary
- add a new `templates/astro-ts` template based on the existing Astro +
SpacetimeDB integration work
- include Astro SSR, a React client island for realtime updates, and a
small `server:defer` example
- add Astro quickstart documentation under
`docs/docs/00100-intro/00200-quickstarts/00152-astro.md`

## Validation
- `pnpm install`
- `pnpm -F spacetimedb build`
- `pnpm -F ./templates/astro-ts build`

## Notes
- I did not add `astro-ts` to the built-in template listing in
`spacetime dev` docs, to match the current `nextjs-ts` pattern.

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-04-17 21:01:58 +00:00
Micha Huhn b1d5c5958a docs(fix): add missing ctx.db (#4768)
Signed-off-by: Micha Huhn <michahuhndev@gmx.de>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-04-17 19:47:39 +00:00
bradleyshep 7143ed9722 Clean up keynote-2 template README & DEVELOP (#4624)
# Description of Changes

Refresh this stale PR against current `master`. Several original items
were already applied upstream or conflict with recent keynote-2 work
(#4616, #4647, #4678, #4682, #4698, #4703, #4743, #4745, #4753, #4757),
so those are dropped. What remains is the still-relevant subset, rebased
onto the current file structures.

**README.md:**
- Use `pnpm run demo` in Quick Demo (consistency with pnpm workspace)
- Add `--concurrency` and `--alpha` to demo options
- Add `--` separator to `docker compose run` bench example
- Fix hardware config punctuation (add comma before "OS:")
- Remove redundant Quick Start section; replace with link to DEVELOP.md
for prerequisites and CLI reference
- Add symlink for license

**DEVELOP.md:**
- Use `pnpm run` throughout (demo, prep, bench) instead of `npm run`
- Drop the `-- ` pass-through after `pnpm run bench` (not needed with
pnpm; matches the `#4703` testing examples)
- Add Rust to Prerequisites
- Add explicit list of valid connector names (`convex`, `spacetimedb`,
`bun`, `postgres_rpc`, `cockroach_rpc`, `sqlite_rpc`, `supabase_rpc`,
`planetscale_pg_rpc`)
- Update CLI reference defaults to match methodology (seconds: 1→10,
concurrency: 10→50)
- Condense `docker compose run` bench example to a single line with `--`
separator; fix `npm prep` → `pnpm run prep`

**src/opts.ts:** (CLI parsing moved here in `#4703`; original PR
targeted the now-gone inline parsers in `cli.ts`/`demo.ts`)
- `parseBenchOptions`: bench `--seconds` default `1` → `10`
- `parseDemoOptions`: demo `--concurrency` default `10` → `50`

**.env.example:**
- Comment out `USE_DOCKER=1` and `SKIP_CONVEX=1` so demo defaults
(convex, spacetimedb) work out of the box
- Comment out `CONVEX_USE_SHARDED_COUNTER=1` (still a supported knob,
just off by default)

# Dropped as superseded by master

- Rust Client README section tweaks (heading capitalization,
`bottlnecked`/`then` typo fixes) — section was removed by `#4753`
- Rename `SPACETIME_METRICS_ENDPOINT` → `USE_SPACETIME_METRICS_ENDPOINT`
— master's `src/config.ts` still reads the original name
- Connector-name fixes in examples (`sqlite` → `sqlite_rpc`, `postgres`
→ `postgres_rpc`) — already corrected on master

# API and ABI breaking changes

None.

# Expected complexity level and risk

**1** – Documentation and default-value changes. No functional changes
to core logic.

# Testing

- [x] `pnpm install` in `templates/keynote-2/` succeeds
- [x] `pnpm run bench --help` / `pnpm run demo --help` render with
valid-connec
2026-04-17 13:03:36 +00:00
xDovos 6d7b3b5fef move 00300-spacetime-json.md into the right docs folder (#4779)
# Description of Changes

<!-- Please describe your change, mention any related tickets, and so on
here. -->

moves the docs file for spacetime.json into the right folder so that the
website shows it.


# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

no

# Expected complexity level and risk

<!--
How complicated do you think these changes are? Grade on a scale from 1
to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex
change.

This complexity rating applies not only to the complexity apparent in
the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning
ways. -->

1

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

no testing needed
2026-04-17 03:14:35 +00:00
John Detter db2df60dcc Windows VM runner test (#4278)
# Description of Changes

<!-- Please describe your change, mention any related tickets, and so on
here. -->

This enables the use of the self hosted windows runners.

|CI Job|Before|After|Change|
|---|---|---|---|
|CI/Smoketests (Windows)|79m|31m|154% faster|

This is *before* we do any work with caching.

# API and ABI breaking changes

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

None, this is just a CI change.

# Expected complexity level and risk

1 - this is just a CI change.

<!--
How complicated do you think these changes are? Grade on a scale from 1
to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex
change.

This complexity rating applies not only to the complexity apparent in
the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning
ways. -->

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

- [x] Ran the windows smoketest several times. Each time it is passing,
although several runs I was making performance changes so some runs are
faster than others.

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-04-17 02:43:34 +00:00
John Detter d20a24a4d1 Make Tyler a codeowner for CI and tools (#4836)
# Description of Changes

<!-- Please describe your change, mention any related tickets, and so on
here. -->

Adds Tyler to codeowners for:
- `.github/` - this also gives Tyler codeowner over the `CODEOWNERS`
file
- `/tools/upgrade-version/`
- `/tools/license-check/`

# API and ABI breaking changes

None

<!-- If this is an API or ABI breaking change, please apply the
corresponding GitHub label. -->

# Expected complexity level and risk

1 - this is just a codeowner change

<!--
How complicated do you think these changes are? Grade on a scale from 1
to 5,
where 1 is a trivial change, and 5 is a deep-reaching and complex
change.

This complexity rating applies not only to the complexity apparent in
the diff,
but also to its interactions with existing and future code.

If you answered more than a 2, explain what is complex about the PR,
and what other components it interacts with in potentially concerning
ways. -->

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

NA

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2026-04-16 21:46:52 -04:00
clockwork-labs-bot f3109bbaa0 Add path context to invalid TOML config errors (#4815)
Fixes #4749.

## Summary
The old report was filed against a `spacetime.toml` path from 1.11-era
CLI flows. On current `master`, the shared TOML config parser already
returns parse failures, but the top-level error does not say which
config file was invalid.

This patch makes the shared TOML config loader add file-path context
while preserving the underlying TOML span details, so users get an error
like `invalid TOML syntax in ...` followed by the parser's line and
column information.

## Testing
- `cargo test -p spacetimedb-core
parse_config_reports_the_invalid_file_path -- --nocapture`
- manual test:
```
➜ cargo run -pspacetimedb-cli -- list
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.33s
     Running `target/debug/spacetimedb-cli list`
Error: config file /home/work/.config/spacetime/cli.toml is invalid

Caused by:
    TOML parse error at line 5, column 17
      |
    5 | [[server_configs]
      |                 ^
    invalid table header
    expected `.`, `]]`
```

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-16 15:12:50 +00:00
Mazdak Farrokhzad 809aebd7c4 Move field replay_table_updated to ReplayCommittedState (#4807)
# Description of Changes

Shaves another 32 bytes off of `CommittedState` by moving the last
replay only map out of the type.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

Covered by existing tests.
2026-04-16 13:08:30 +00:00
Noa 21b58ef993 Update axum (#2713)
# Description of Changes

~~Axum now has what we need out of it for a websocket wrapper, so we no
longer need to duplicate `util/flat_csv.rs` and `util/websocket.rs`,
meaning we have less code to maintain.~~ Nevermind, we know send raw
frames, which axum's wrapper does not support. Makes this PR simpler.

# Expected complexity level and risk

2 - upgrading a dependency is a risk, but looking through the
[changelog](https://github.com/tokio-rs/axum/blob/main/axum/CHANGELOG.md#080)
there isn't anything that should affect us.

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

- [x] tests pass <!-- maybe a test you want to do -->
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-04-16 13:08:25 +00:00
Micha Huhn ddba47f76a fix: reorder Vue component (#4748)
Reorder the Vue component based on the Vue convention:
1. `<script>`
2. `<template>`

It's only a visual change of the code. It has no effect on the
functionality.
2026-04-15 21:14:08 +00:00
Alessandro Asoni 4df71befc2 Fix spacetime dev bug when running with a project path (#4809)
# Description of Changes

Fixes an issue where running `spacetime dev <database name> --template
chat-react-ts --server maincloud` for an existing database and a new
local project folder would fail with this error:

```sh
  Building...
  Error: Failed to build project

  Caused by:
      Module directory does not exist: '/Users/aasoni/./spacetimedb'. Check your --module-path flag or the module-path setting in spacetime.json.
```

Summary of the bug:
- determine_publish_configs was called at line 373 before the project
existed, storing <cwd>/./spacetimedb as the module path
- After init correctly updated spacetimedb_dir to the new project's
path, a later block (lines 454-468) re-read the stale path from the
early publish config and overwrote the correct value
- The rebuild guard at line 498 never triggered because publish_configs
was non-empty (due to the database name CLI argument)

The fix clears publish_configs at the end of the init block, causing the
rebuild at line 498 to run with the correct, post-init spacetimedb_dir.

# API and ABI breaking changes

No

# Expected complexity level and risk

1

# Testing

<!-- Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected! -->

- [x] Re-ran `spacetime dev` with various flags to confirm they all
still worked
- [x] Verified that the specific error case was fixed
2026-04-15 20:48:54 +00:00
Allen Ray 8e0216577d Export AuthCtx and JwtClaims in stdb/server typescript sdk (#4649)
# Description of Changes

Exports AuthCtx and JwtClaims so that they can be used in helper
functions for checking authentication.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

None, similar to #4567, just adding more exports

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2026-04-15 20:29:19 +00:00
Philippe Tremblay b974cb7e55 fix(ts-bindings): populate response headers in fetch() (#4691)
# Description of Changes

`fetch()` in TypeScript bindings was deserializing the full
`HttpResponse` from BSATN (including headers), but then discarding them
and always returning `new Headers()`. This adds a `deserializeHeaders()`
helper that converts BSATN-deserialized `HttpHeaders` into a
web-standard `Headers` object, so response headers are now correctly
populated on the returned `SyncResponse`.

# API and ABI breaking changes

None. Purely additive — no existing code depended on the (always-empty)
headers.

# Expected complexity level and risk

1 — Single-line behavioral change plus a small helper function. The fix
mirrors the existing request-side encoding pattern.

# Testing

- [x] Unit test: headers survive BSATN serialize/deserialize round-trip
- [x] Unit test: empty headers round-trip correctly
- [x] Verified `deserializeHeaders` uses the same `textDecoder` (UTF-8)
as existing body decoding
2026-04-15 19:34:51 +00:00
Kim Altintop 7d537d3020 durability: Simplify shutdown (#4808)
We switched to using `async-channel` as the backing queue in 2b3aa5a,
which allows to close the channel on the sender side without dropping
the sender. This is unlike tokio channels, which require the sender to
be dropped, or the receiver to request the channel to be closed.

This allows to greatly simplify the async shutdown of a durability
instance by simply awaiting the actor's `JoinHandle` instead of a
complicated chain of notification primitives.
2026-04-15 18:44:09 +00:00
clockwork-labs-bot 2356bbcb0b docs: Add commitlog reference document (#4668)
Per Tyler's request. Consolidates the three commitlog proposals from
SpacetimeDBPrivate into a single public reference document:

- **Proposal 0003** (commitlog format): Segment structure, commit
format, transaction records, mutations, integrity model, wire format,
versioning
- **Proposal 0016** (offset index): Index files, entry format,
read/write behavior, configuration
- **Proposal 0027** (commitlog epoch): Epoch field for replication,
format version 1

The document is written in textbook style with no emdashes or
contractions, following the docs style guide. All proposal-specific
language (motivation sections, alternatives considered, implementation
stages, etc.) has been removed in favor of a direct reference format.

Placed at
`docs/docs/00200-core-concepts/00100-databases/00400-commitlog.md`
alongside the existing database concept docs.

No private repo details are referenced.

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-15 18:36:52 +00:00
joshua-spacetime 74802ebf5c Update typescript sdk to use v3 websocket api (#4784)
Reopening https://github.com/clockworklabs/SpacetimeDB/pull/4762 which
was approved but merged prematurely.
2026-04-15 18:17:48 +00:00
clockwork-labs-bot f672ae2273 Run client_connected hook for HTTP SQL requests (#4563)
## Summary

The `/v1/database/:name_or_identity/sql` endpoint now calls the module's
`client_connected` reducer before executing SQL, and
`client_disconnected` after. This allows module authors to accept or
reject SQL connections based on the caller's identity, matching the
existing behavior of the `/call` endpoint.

## Motivation

Previously, the `/sql` endpoint bypassed the module's `onConnect` hook
entirely, meaning module authors had no way to restrict who could run
SQL queries against their database. The `/call` endpoint already runs
the connect hook, so this brings `/sql` to parity.

## Changes

- `crates/client-api/src/routes/database.rs`: The `sql` handler now:
  1. Generates a random connection ID
  2. Calls `module.call_identity_connected()` before executing SQL
  3. Executes the SQL query
  4. Calls `module.call_identity_disconnected()` after
5. If `client_connected` rejects the connection, returns 403 Forbidden
without executing the query

- `sql_direct()` is unchanged since it is also used by the pgwire
server, which has its own connection lifecycle.

## Behavior

- If the module defines a `client_connected` reducer that throws/errors
for a given identity, the SQL request returns `403 Forbidden`
- If no `client_connected` reducer is defined, behavior is unchanged
- The connection is always cleaned up via `client_disconnected` after
the query completes

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2026-04-15 08:56:43 -07:00
james gilles c65fc311b0 Add internal docs for C# bindings packages (#2938)
# Description of Changes
Adds some docs to the C# bindings packages.

# API and ABI breaking changes

None

# Expected complexity level and risk

0

# Testing

N/A

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2026-04-15 14:16:43 +00:00
T-Podgorski b8cf10c7fc Unity tutorial part 2 CLI call fix (#3665)
# Description of Changes
Fixed a CLI call in docs Unity tutorial that generated client module
code in an incorrect directory.

# API and ABI breaking changes
None.

# Expected complexity level and risk
1

# Testing
Built a project by following the tutorial with the wrong call vs the
fixed call. Compared against different parts of the tutorial to confirm
the intent.

---------

Signed-off-by: T-Podgorski <147391857+T-Podgorski@users.noreply.github.com>
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-04-15 13:04:22 +00:00
Mazdak Farrokhzad b5cadff7a5 Extract replay stuff out of CommittedState, part 1 (#4804)
# Description of Changes

Moves stuff out of `datastore.rs` and `committed_state.rs` that has to
do with replay into its own module `replay.rs`.
This also shaves 64 bytes off of `CommittedState` so that we don't
continue carrying the cost of replay after it has finished.

This is a more limited version / part 1 of
https://github.com/clockworklabs/SpacetimeDB/pull/4055 which focuses on
almost pure code motion so that we're more diligent and careful about
the transition. Future PRs will continue with other parts of #4055.

# API and ABI breaking changes

None

# Expected complexity level and risk

1, just simple and safe code motion.

# Testing

Covered by existing tests as this is code motion.
2026-04-15 08:58:52 +00:00