Commit Graph

3108 Commits

Author SHA1 Message Date
clockwork-labs-bot f8bab637c5 Merge remote-tracking branch 'origin/master' into docs/module-owner-init 2026-03-01 14:23:39 -05:00
clockwork-labs-bot 5d9eb7c705 Add missing TypeScript example in migration guide (#4508)
The 'Option 2: overwrite the name of individual tables' section of the
2.0 migration guide had an empty TypeScript tab. Adds a complete example
using `table()` with an explicit `name` property to preserve the
pre-conversion table name.

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-03-01 16:02:30 +00:00
bradleyshep efa6f382b1 LLM benchmark tool updates (#4413)
# Description of Changes

LLM benchmark updates for local development:

- **Local SDK paths**: Templates use relative paths to workspace crates
(`crates/bindings`, `crates/bindings-csharp`,
`crates/bindings-typescript`) instead of published packages, so the
bench runs against local SDK changes.
- **NODEJS_DIR support**: On Windows (e.g. nvm4w), if `pnpm` is not on
PATH, the bench uses `NODEJS_DIR` to locate `pnpm` and prepends it to
PATH for subprocesses.
- **Refactor**: Extracted `relative_to_workspace()` in `templates.rs`
and removed noisy `NODEJS_DIR` logging in `publishers.rs`.
- **Benchmark results**: Updated `docs/llms/llm-comparison-details.json`
and `docs/llms/llm-comparison-summary.json`.

# API and ABI breaking changes

None.

# Expected complexity level and risk

**2** — Local-only changes to the benchmark tool. Templates now require
local SDKs to be built (especially TypeScript: `pnpm build` in
`crates/bindings-typescript`). No impact on published SDKs or runtime.

# Testing

- [ ] Run `cargo llm run --lang rust --modes docs --providers openai`
from repo root
- [ ] Run TypeScript benchmarks with `pnpm build` in
`crates/bindings-typescript` first
- [ ] On Windows with nvm4w, set `NODEJS_DIR` if `pnpm` is not on PATH
and run TypeScript benchmarks

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-03-01 02:22:59 +00:00
Jason Larabie 14f79910ee Update C++ module bindings to RawModuleDefV10 (#4461)
# Description of Changes
- Migrated the C++ module-definition assembly path to V10-first
internals:
      - Added v10_builder and module_type_registration systems.
- Switched Module::__describe_module__ to serialize RawModuleDef with
V10 payload.
      - Updated macro registration pipeline to register through V10
- Added explicit naming support across macro surface (*_NAMED variants
for reducer/procedure/
        view and field/index macros).
- Reworked multi-column index macros (FIELD_MultiColumnIndex,
FIELD_MultiColumnIndex_NAMED) with
        migration alias.
- Added SPACETIMEDB_SETTING_CASE_CONVERSION(...) to support case
conversion policy
- Error-path hardening by adding explicit constraint-registration error
tracking and preinit validation
  - Codegen updates:
      - Updated C++ moduledef regen to V10 builder types.
- Adjusted C++ codegen duplicate-variant wrapper generation to emit
proper product-type
        wrappers.
  - Test/harness updates:
- type-isolation-test runner now defaults to focused V10 regression
checks; --v9 runs broader
        legacy/full suite.
      - Added focused modules for positive/negative V10 checks:
          - test_multicolumn_index_valid
          - error_multicolumn_missing_field
          - error_default_missing_field
- Re-enabled C++ paths in sdks/rust/tests/test.rs procedure/view/test
suites.

# API and ABI breaking changes

- Refactor of the underlying module definition
- New *_NAMED variant macros for explicit canonical naming
- FIELD_NamedMultiColumnIndex renamed to FIELD_MultiColumnIndex

# Expected complexity level and risk

3 - Large set of changes moving over to V10 with underlying changes to
make future updates a little easier

# Testing
- [x] Ran the type isolation test and expanded it
- [x] Ran the spacetimedb-sdk test framework to confirm no more drift
between C++ and other module languages
- [x] Ran Unreal test suite though not really applicable
- [x] New app creation with `spacetime init --template basic-cpp`
- [x] Ran describe module tests against Rust + C# matching with C++ on
the /modules/sdk-test* modules to find any possible mis-alignment

# Review
- [x] Another look at the new features with C++
- [x] Thoughts on *_NAMED macros, I couldn't come up with a better
solution with C++20
2026-02-28 07:05:50 +00:00
Mazdak Farrokhzad abbcec4ab3 keynote-2: alpha -> 1.5, withConfirmedReads(true), remove warmup (#4492)
# Description of Changes

This does 3 things to the keynote-2 benchmark:
- it changes the default alpha to 1.5, which we actually tested the
other services with
- it turns on confirmed reads (not the default for < 2.0)
- it removes warmup

This was tested on
https://github.com/clockworklabs/SpacetimeDB/pull/4404 to have no impact
on the TPS throughput of spacetimedb.
**This PR shouldn't be merged before #4404 has.**

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

This tweaks a bench test.
2026-02-28 03:06:11 +00:00
John Detter c29a44c50b Version upgrade 2.0.3 (#4489)
# Description of Changes

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

- Version upgrade 2.0.3

# API and ABI breaking changes

- None, this is a version bump

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

# Expected complexity level and risk

- 1 - this is a version bump

<!--
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] License has been updated
- [x] Version number is correct (2.0.3)
2026-02-27 20:24:22 +00:00
clockwork-labs-bot 1aff83da93 Fix missing word 'time' in ScheduleAt tutorial docs (#4490)
Fixes a missing word in the Unity and Unreal tutorial part-3 docs.

**Before:** `specify a specific at which to call a reducer once`
**After:** `specify a specific **time** at which to call a reducer once`

Fixed in 4 files (current docs + v1.12.0 versioned docs), 6 occurrences
total.

Spotted by Tyler.

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-02-27 18:22:46 +00:00
bradleyshep a46c106deb Add PlanetScale configuration details to keynote README & DEVELOP (#4474)
# Description of Changes

- **keynote-2 docs:** Document PlanetScale benchmark configuration in
DEVELOP.md (env vars `PLANETSCALE_PG_URL`, `PLANETSCALE_RPC_URL`,
`SKIP_PLANETSCALE_PG`; short “create DB and set env” section; note that
we benchmarked using PS-2560, 32 vCPUs, 256 GB RAM).
- **README:** Add PlanetScale to cloud tier list (PS-2560, single node,
us-central1). Add region (us-central1) to Hardware Configuration for
Server Machine Variant B and Client Machine.

No code or config changes; documentation only.

# API and ABI breaking changes

None.

# Expected complexity level and risk

**Complexity: 1.** Doc-only updates to `templates/keynote-2/README.md`
and `templates/keynote-2/DEVELOP.md`. No behavioral or API impact.

# Testing

- [ ] Skim README and DEVELOP.md for accuracy and formatting.
2026-02-27 15:06:17 +00:00
Ryan d87e49487b [C#] Improve error messages for Views (#4435)
This is the implementation of a fix for #4425

# Description of Changes

* Clarified C# generator diagnostics for view return types:
1. Updated the comments around `IQuery<T>` handling to describe the
return value as `T?`, matching C# semantics.
2. Adjusted the validation comment to say views must return `List<T>` or
nullable `T` instead of “Vec/Option”.
* Synced the diagnostics fixture comments with the new terminology so
STDB0024 examples talk about `List<T>`/`T?`.
* Checked current documentation for anything C# related to “Vec/Option”
and confirmed everything now references `List<T>`/`T?`.
* Regenerated/verified tests and snapshots.

# API and ABI breaking changes

None

# Expected complexity level and risk

1 - Changes are documentation and diagnostic-comment only.

# Testing

- [X] CLI rebuilt, local `dotnet test` pass and error output tests
validated.

---------

Signed-off-by: Ryan <r.ekhoff@clockworklabs.io>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-02-27 01:46:39 +00:00
joshua-spacetime e8a2d33155 C# smoketest for IQuery views (#4391)
# Description of Changes

~~Updates Roslyn codegen to handle `IQuery` return type for views.~~

~~`IQuery` wasn't recognized before this change, which meant `.Build()`
was still required for query builder views.~~

~~Note, we currently support the old `Query` return type which means we
still support `.Build()`. I'm not sure if this was intended when
`IQuery` was originally introduced, so I'm maintaining support for it
until I can determine otherwise. cc @cloutiertyler.~~

This is now a test only change.

This patch introduces scaffolding for defining and running C# module
smoketests. It also adds a new C# smoketest for an`IQuery` view.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

A testing only change.
2026-02-26 23:06:33 +00:00
Tao Tien 824c993fae Remove security warning from 00500-schedule-tables.md (#4463)
Now that scheduled reducers are private, this warning is no longer
necessary.

# Description of Changes

- removed Security Considerations section from Schedule Tables
documentation

Signed-off-by: Tao Tien <29749622+taotien@users.noreply.github.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-02-26 21:57:22 +00:00
clockwork-labs-bot 9fbb322b0b CLI - preserve leading .. in --out-dir paths (#4431)
## Problem

`spacetime generate --out-dir ../frontend-ts-src/module-bindings` was
resolving the path incorrectly, stripping the leading `..` component.
Reported in #4429 via a [user report on
Discord](https://discord.com/channels/1037340874172014652/1475935288919462072/1475935288919462072).

## Root Cause

`normalize_path_lexical()` in `spacetime_config.rs` used
`PathBuf::pop()` to handle `..` components, but `pop()` is a no-op on an
empty `PathBuf`. This silently dropped leading `..` segments:

- Input: `../frontend-ts-src/module-bindings`
- Output: `frontend-ts-src/module-bindings` (wrong — `..` was eaten)

## Fix

Replace the `PathBuf`-based normalization with a `Vec<Component>` stack
approach. `..` only cancels a preceding `Normal` component; otherwise it
is preserved. This correctly handles:

- `../foo` → `../foo` (leading `..` preserved)
- `../../a/b` → `../../a/b` (multiple leading `..` preserved)
- `a/b/../c` → `a/c` (inner `..` still resolves)
- `/home/user/project/../foo` → `/home/user/foo` (absolute paths work)

## Testing

Added `test_normalize_path_preserves_leading_dotdot` covering all edge
cases.

Closes #4429

---------

Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-02-26 19:54:20 +00:00
Piotr Sarnacki ad26525880 Fix publishing in directories with spaces (#4453)
# Description of Changes

The publish subcommand calls the build subcommand internally. The
build's implementation used to split the arguments by space, which
breaks when a directory contains a space.

# API and ABI breaking changes

-

# 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] Tested locally
- [x] Added a test
2026-02-26 19:29:40 +00:00
clockwork-labs-bot 4375cb81a8 spacetime dev - Print feedback when client process exits (#4469)
The main event loop in `spacetime dev` blocked on file change events
with no periodic check on the client process. If the client exited
(e.g., user pressed Enter in the basic-rs template), `spacetime dev`
gave no feedback at all.

**Fix**: Switch from blocking `recv()` to `recv_timeout(1s)` and check
client process status every second. On exit, prints:

- `Client process exited. File watcher is still active.` (exit code 0)
- `Warning: Client process exited with code N. File watcher is still
active.` (non-zero)

The file watcher continues running so module changes are still detected
and published.

---------

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-02-26 18:31:01 +00:00
Zeke Foppa bc4fcec6f3 cargo bump-versions properly updates the smoketests lockfile (#4462)
# Description of Changes

Previously `bump-versions` would push a failing commit because the
smoketests had a diff. This fixes that by having `bump-versions` update
that lockfile.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] Ran `cargo bump-versions --all 3.0.0` and confirmed that the
lockfile was updated

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
v2.0.2
2026-02-26 11:06:23 +00:00
clockwork-labs-bot 350066ab4c spacetime dev - Fix file watcher ignoring --module-path / spacetime.json module_path (#4464)
## Summary

Fixes #4443 — `spacetime dev` ignores both `--module-path` CLI flag and
`module-path` in `spacetime.json` for the file watcher, always watching
`<project-path>/spacetimedb/` instead.

## Root Cause

Two bugs:

1. **Config's `module-path` never applied to `spacetimedb_dir`**: When
`spacetime.json` contains `module-path`, the recovery prompt is
correctly skipped (the code checks for its existence), but the value is
never used to update `spacetimedb_dir`. It stays as
`project_dir/spacetimedb`.

2. **Hardcoded fallback in `determine_publish_configs()`**: When there
are no publish targets in config (no `database` key or `children`), the
fallback creates a publish config entry with `module-path:
"spacetimedb"` hardcoded. This propagates to `extract_watch_dirs()`
(file watcher) and the publish loop, overriding any CLI or config value.

## Fix

1. After loading config, resolve `spacetimedb_dir` from config's
`module-path` in `additional_fields` when CLI did not provide
`--module-path`.

2. Pass the resolved `spacetimedb_dir` to `determine_publish_configs()`
as `default_module_path` so the fallback uses the correct path instead
of hardcoding `"spacetimedb"`.

## Testing

- All 5 existing `determine_publish_configs` tests pass
- Added new test
`test_determine_publish_configs_fallback_uses_provided_module_path` that
verifies the fallback uses the provided path

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2026-02-26 11:06:21 +00:00
joshua-spacetime 9f47647d0f Reduce fsync interval to 10ms (#4466)
# Description of Changes

Reduce fsync interval from 50ms -> 10ms

# API and ABI breaking changes

None

# Expected complexity level and risk

1

Should be fine based on p99 latencies

# Testing

N/A
2026-02-26 11:06:19 +00:00
clockwork-tien 5764ade224 fix(docs): Rename spacerace to referrals for nav item (#4477)
# Description of Changes
- Rename `Spacerace` to `Referrals` for docs nav item to align with
updated naming

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

# Screenshots
- After:
<img width="1510" height="49" alt="image"
src="https://github.com/user-attachments/assets/3bdbe6ec-8a51-4686-9292-28c38b6d14d9"
/>

- Before:
<img width="1460" height="47" alt="image"
src="https://github.com/user-attachments/assets/5c70b0ef-d5fc-42fa-9dc9-5fd4f034d415"
/>


# 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

<!--
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] Docs displays correctly
2026-02-26 11:06:16 +00:00
clockwork-labs-bot 6382220fa0 Remove 'Press any key to exit' in basic-rs and basic-cpp templates (#4468)
The basic-rs and basic-cpp templates say "Press any key to exit..." but
stdin is line-buffered in cooked mode, so `read(&mut [0u8])` actually
blocks until Enter is pressed.

Adding a real "any key" handler would require a terminal crate
dependency (crossterm, termion, etc.) which is heavy for a starter
template. Instead, change the message to "Press Enter to exit..." and
use `read_line()` to match the actual behavior.

Also removes the unused `Read` import.

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2026-02-26 10:37:29 +00:00
clockwork-labs-bot ebea9a4b5c spacetime dev - Improve error when module directory does not exist (#4467)
When `spacetime dev` (or `publish`) cannot find the module directory,
the error was:

```
Error: Failed to build project
Could not detect the language of the module. Are you in a SpacetimeDB project directory?
```

This is confusing because the real problem is the directory does not
exist, not that the language cannot be detected.

Now shows:

```
Module directory does not exist: '/path/to/missing/dir'.
Check your --module-path flag or the module-path setting in spacetime.json.
```

Related to #4443.

---------

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-02-26 08:37:07 +00:00
Zeke Foppa 1e6aa3226c Bump versions to 2.0.2 (#4455)
# Description of Changes

Bumping all versions to 2.0.2 for the release.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

CI

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-26 01:54:35 +00:00
Boegie19 42097c3ff4 Add schedule name correction for LLMs (#4370)
# Description of Changes
This change is needed since the AI halicunates that the name is schedule
for some dam reason every time in the llm tests. while it is scheduled

https://github.com/clockworklabs/SpacetimeDB/blob/e2f8a607593f8e2e446df06d84b21e26af2bfc68/docs/llms/docs-benchmark-details.json#L90
# 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
<!--
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! -->

- [ ] Run the LLM benchmark and see if this fixes it

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2026-02-26 00:25:53 +00:00
Phoebe Goldman 3a850743f5 Correct unique indexes in cheat sheet to use filter, not find (#4452)
# Description of Changes

Some examples in our cheat-sheet incorrectly used a `filter` method on a
unique index. Unique indexes expose `find`, and non-unique indexes
expose `find`. This commit updates the cheatsheet to use the appropriate
index seek methods.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

N/a

# Testing

N/a

# Reviewers

Does the C++ code work as written, or do you have to do something
horrible to do with ranges?
2026-02-26 00:14:37 +00:00
Ryan f8ee1194fd [Docs] [C#] Update docs with List<T> returns and IEnumerable<T> tests (#4392)
# Description of Changes

* Updates `00500-views.md` with:
* Changes returned value to a nullable value, to match the return type
defintion.
* Wraps sample code in `public partial class Module` so pasting it in to
IDE will not return errors.
* Updates `00500-cheat-sheet.md` with:
* Changes reducer names to not start with `On` to avoid error `STDB0010:
Reducer method OnConnect starts with 'On', which is a reserved prefix.`
  * Adds `Accessor` values to views.
* Updates `Filter()` returned value to use `.ToList()` and the return
type to use `List<Player>` rather than `IEnumerable<Player>` to avoid
error, due to needing a return type to be `Vec<T>` or `Option<T>`.
* Updated `Coddgen.Test` to include tests verifying current behavior of
`IEnumerable<T>`, to aid in future update to allow a return type of
`IEnumerable<T>` to be allowed and converted internally to the required
type.

# API and ABI breaking changes

None

# Expected complexity level and risk

1 – documentation-only edits with no behavioral impact.

# Testing

- [X] Changed code blocks tested locally to ensure formatting resolved
in IDE.
2026-02-25 22:50:48 +00:00
John Detter 611be36278 Fix spacerace button in docs (#4458)
# Description of Changes

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

- Right now if you go to the docs https://spacetimedb.com/docs/ and you
click on spacerace in the upper right it will 404. This PR fixes this
issue.

# 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 - just a docs update

<!--
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! -->

```
cd docs
npm install
npm run dev
```

- [x] spacerace button works in docs
2026-02-25 21:49:06 +00:00
Zeke Foppa 95c8c062fd Smoketest subscribe properly respects new confirmed behavior (#4454)
# Description of Changes

This doesn't actually change any used behavior, but fixes the
(apparently unused) `subscribe_confirmed` function, and makes it
possible to request unconfirmed reads as well.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

CI still passes? 🤷

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-25 20:37:58 +00:00
Shubham Mishra a327f91d30 TS: fix sourceName in table schema (#4449)
# Description of Changes
fixes: https://github.com/clockworklabs/SpacetimeDB/issues/4433.
Test will be added in:
https://github.com/clockworklabs/SpacetimeDB/pull/4450/changes

# API and ABI breaking changes
NA

# Expected complexity level and risk
2
2026-02-25 15:37:38 +00:00
Ryan 6fea15f745 [C#] Update RawTableIterBase.Enumerator to use ArrayPool for buffer (#4385)
This is the implementation of a fix for #4093 

# Description of Changes

* Updated `RawTableIterBase.Enumerator` to rent its scratch buffer from
`ArrayPool<byte>.Shared` (with dynamic re-rent on `BUFFER_TOO_SMALL`)
and return it on dispose, so iterating rows no longer allocates a fresh
`byte[]` per step.
* The enumerator still exposes the row bytes via `ArraySegment<byte>
Current`, but now the underlying storage is reused across iterations
rather than recreated each time.

Testing results from `master`:
```
allocated_bytes=14000
elapsed_ticks=1521829
sum=1249975000
row_count=50000
Find() TinyRecord (8 bytes payload) -> 132208 bytes allocated
Find() MediumRecord (~50 bytes payload) -> 132440 bytes allocated
Find() LargeRecord (1 KB payload) -> 134528 bytes allocated
Find() LargeRecord (10 KB payload) -> 152408 bytes allocated
Find() LargeRecord (100 KB payload) -> 336728 bytes allocated
Iter() 10 rows -> 131896 bytes allocated
Filter() iterate 20 rows -> 133288 bytes allocated
Filter() iterate 100 rows -> 135976 bytes allocated
10x consecutive Find() (TinyRecord) -> 1319120 bytes allocated
```

Testing results with this fix:
```
allocated_bytes=14000
elapsed_ticks=1504949
sum=1249975000
row_count=50000
Find() TinyRecord (8 bytes payload) -> 1096 bytes allocated
Find() MediumRecord (~50 bytes payload) -> 1280 bytes allocated
Find() LargeRecord (1 KB payload) -> 4464 bytes allocated
Find() LargeRecord (10 KB payload) -> 27464 bytes allocated
Find() LargeRecord (100 KB payload) -> 234312 bytes allocated
Iter() 10 rows -> 680 bytes allocated
Filter() iterate 20 rows -> 1872 bytes allocated
Filter() iterate 100 rows -> 3280 bytes allocated
10x consecutive Find() (TinyRecord) -> 8000 bytes allocated
```
# API and ABI breaking changes

No API or ABI changes

# Expected complexity level and risk

2 - low/moderate:
Touches the hot-path iterator that every `Iter`/`Find`/`Filter` call
uses

# Testing

- [X] Compiled CLI and ran regression tests locally
- [X] Verified iterator-based harness runs (client + module reducers) on
both `master` and this branch, confirming allocations drop from ~131 KB
per read to payload-scaled values.
- [X] Ensured no regressions in standard harness sanity checks
(`row_count=50000`, `sum=1249975000`).
2026-02-25 03:05:52 +00:00
Knut Egil V. Nygård 5fcd934d34 Correct "table" to "view" in 00250-zen-of-spacetimedb.md (#4434)
# Description of Changes

Corrected the wording from `a table` to `a view` where the documentation
links to the "Views" feature page.

---------

Signed-off-by: Knut Egil V. Nygård <86576502+knut-egil@users.noreply.github.com>
Signed-off-by: joshua-spacetime <josh@clockworklabs.io>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-02-25 01:12:20 +00:00
Julien Lavocat bce97d45ac Fix AI assistant rules links in llms.txt (#4430)
# Description of Changes

Fix AI assistant rules links in llms.txt, they were missing a `/docs`

# API and ABI breaking changes

None.

# Expected complexity level and risk

0.0001

# Testing

Clicked the link
2026-02-24 22:42:59 +00:00
Zeke Foppa 3a2e2346e7 CI - Fix smoketests running twice (#4281)
# Description of Changes

Smoketests were running twice because `tests/foo.rs` automatically gets
turned into a test binary, but we also had a `mod.rs` that listed each
file, so they were getting tested via that as well.

This was first broken in
https://github.com/clockworklabs/SpacetimeDB/pull/4184.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] CI passes
- [x] If I run `cargo ci smoketests` locally, I still see the CLI tests
running
- [x] If I run `cargo ci smoketests` locally, I do not see a particular
CLI test name appearing more than once (e.g.
`cli_cannot_publish_breaking_change_without_flag`)
- [x] `cargo ci smoketests check-mod-list` passes
- [x] `cargo ci smoketests check-mod-list` fails if I `touch
crates/smoketests/tests/smoketests/foo.rs`

---------

Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-02-24 19:18:08 +00:00
Alessandro Asoni 54e24cc1cd Add ARM M-series CPU note in benchmark readme (#4426)
# Description of Changes

Add one line to the benchmark readme

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Checked rendered markdown
2026-02-24 19:06:00 +00:00
Zeke Foppa e0d3557e54 Update bump-versions to support prereleases (#4384)
# Description of Changes

`cargo bump-versions` works properly with prerelease versions. Before it
would quietly drop the `-foo` or `+foo` suffix.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] Ran the script and bumped the versions for the 2.0.0 prerelease

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-24 18:59:37 +00:00
Piotr Sarnacki 0f0d54b03b Remove source-config field from spacetime.json (#4423)
# Description of Changes

We mistakenly were saving source-config field to the spacetime.json
config file. This commit automatically removes the filed if it's
present. Note that in order to preserve comments that users might have
added we use text based modification, but we validate the resulting JSON
before saving

# Expected complexity level and risk

2

# Testing

I tested locally
2026-02-24 17:27:24 +00:00
Piotr Sarnacki ec434f3f67 Don't save source_config to spacetime.json (#4422)
# Description of Changes

We mistakenly save a struct field that is only for internal usage into
the spacetime.json config file. This PR fixes that.


# Expected complexity level and risk

1
2026-02-24 17:27:13 +00:00
Mazdak Farrokhzad 6832fa1bce keynote-2: use rust client (#4421) 2026-02-24 17:47:20 +01:00
Kim Altintop 11a693d4c3 durability: Default local durability sync interval to 50ms (#4420)
Cherry-picked from #4404
Better default for confirmed reads (which are the default since #4390).
2026-02-24 08:25:33 +00:00
Tyler Cloutier a4d29daec8 Fix spacetime dev template issues and clean up CLI (#4396)
## Summary

Multiple fixes and improvements to `spacetime dev`, `spacetime publish`,
`spacetime init`, and templates:

### CLI fixes
- **Fix `spacetime dev` watch path and .env.local handling** for
templates with a `spacetimedb/` subdirectory
- **Validate package manager availability** before installing
dependencies — re-prompts if the selected PM isn't on PATH
- **Remove JS/TS beta warning** from `spacetime publish`
- **Remove unstable warning** from `spacetime init`
- **Remove unused `spacetime energy` command** (can be re-added later
when properly implemented)
- **Fix `tsc` detection on Windows** — `set_extension(".cmd")` produced
`tsc..cmd` (double dot); fixed to `set_extension("cmd")`
- **Add `typescript` as devDependency** to all server template
`spacetimedb/package.json` files so `tsc` is available during build
- **Strip `\?\` extended-length path prefix** from user-facing output in
both `dev` and `publish` commands (produced by `fs::canonicalize()` on
Windows)
- **Fix publish reporting success when user declines** non-local server
prompt — changed `return Ok(())` to `bail!()` consistent with other
abort cases
- **Forward stdin to client process** in `spacetime dev` so interactive
CLI templates work

### Template fixes
- **Fix Angular template environment variables** — Angular's esbuild
builder doesn't support `import.meta.env`, so we use a dev script to
generate `environment.local.ts` with Angular's native `fileReplacements`
pattern
- **Fix TanStack Start template** — rename `createRouter` to `getRouter`
(v1.121+ breaking change), upgrade to React 19, and add
`@vitejs/plugin-react` for automatic JSX runtime support
- **Fix `moduleResolution` in remix-ts and nextjs-ts** server tsconfigs
— change from `"node"` to `"bundler"` to support subpath exports like
`spacetimedb/server`
- **Fix browser-ts template** — convert from static HTML + IIFE bundle
to standard Vite dev server app so it works with `spacetime dev` and
reads env vars from `.env.local`
- **Add `deno` as devDependency** to deno-ts template (matches how
bun-ts includes bun)
- **Convert basic-ts from empty web app to CLI app** matching basic-rs —
connect, subscribe to person table, print on insert

## Test plan

- [x] `cargo test -p spacetimedb-cli` — all 133 tests pass
- [ ] `spacetime dev --template angular-ts` — verify Angular app
connects with correct database name
- [ ] `spacetime dev --template react-ts` — verify React template still
works
- [ ] `spacetime dev --template tanstack-ts` — verify TanStack Start
template loads without errors
- [ ] `spacetime dev --template remix-ts` — verify Remix template builds
and runs
- [ ] `spacetime dev --template nextjs-ts` — verify Next.js template
still works
- [ ] `spacetime dev --template browser-ts` — verify Vite dev server
starts and app connects
- [ ] `spacetime dev --template bun-ts` — verify Bun CLI template runs
interactively
- [ ] `spacetime dev --template basic-ts` — verify CLI connects and
prints on insert
- [ ] Verify no `\?\` prefix in any displayed paths on Windows
- [ ] Verify no `tsc not found` warning when building server modules
- [ ] Select unavailable package manager at init prompt — verify
re-prompt
- [ ] Decline non-local server prompt — verify clean error instead of
"Published successfully!"

---------

Co-authored-by: Piotr Sarnacki <drogus@gmail.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
v2.0.1
2026-02-24 02:39:42 -05:00
bradleyshep e9ecfa9775 Keynote fixes/refinements (#4418)
# Description of Changes

Integrate the `keynote-2` benchmark template into the pnpm workspace so
it uses the local SpacetimeDB TypeScript SDK instead of a pinned npm
version.

- Add `templates/keynote-2` to `pnpm-workspace.yaml` and switch its
`spacetimedb` dependency to `workspace:*`
- Regenerate module bindings for SDK 2.0.1
- Update `DEVELOP.md`: bump Node.js prerequisite to ≥ 22.x (required by
the SDK's use of `Promise.withResolvers`), update CLI commands to use
`cargo run -p spacetimedb-cli --` for local development
- Fix `build` script: use `tsc` only (keynote-2 is a Node.js CLI app,
not a web app — `vite build` fails without an `index.html`)
- Fix demo results display: treat 0 TPS as a failure (`✗ FAILED`)
instead of showing it as a valid result and producing a nonsensical
"Infinityx FASTER" comparison
- Enable `LOG_ERRORS` by default in the demo so reducer failures are
immediately visible instead of silently producing 0 TPS
- Minor cleanup: fix unused variable warning in
`init_sqlite_seed_in_docker.ts`

# API and ABI breaking changes

None.

# Expected complexity level and risk

1 — Scoped entirely to the `keynote-2` template and its workspace
integration. No changes to the SDK, server, or any other template.

# Testing

- [ ] Run `pnpm install && pnpm --filter spacetimedb build` from repo
root
- [ ] Run `pnpm run demo -- --systems spacetimedb --seconds 3` from
`templates/keynote-2` against a local SpacetimeDB server and confirm
non-zero TPS
- [ ] Verify that a system producing 0 TPS shows `✗ FAILED` and is
excluded from the comparison chart
- [ ] Verify that reducer errors are printed to console during benchmark
failures

---------

Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
2026-02-23 23:27:30 -08:00
Zeke Foppa 2b85157d18 Confirmed reads default only for v2 connections (#4419)
# Description of Changes

Reducing scope of https://github.com/clockworklabs/SpacetimeDB/pull/4390
to only apply to V2 clients.

# API and ABI breaking changes

I think this is an API change?

# 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! -->

- [ ] <!-- 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: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-23 23:27:12 -08:00
bradleyshep c37b7912b3 LLM Benchmark docs updates from testings (#4416)
# Description of Changes

Documentation updates from llm-benchmark testing. Includes:

- **Core concepts**: Tables, column types, auto-increment, indexes,
access permissions, schedule tables, event tables, performance
- **Client references**: C# and TypeScript reference updates
- **Migration guide**: 2.0 migration docs
- **AI rules**: `spacetimedb-csharp.mdc`, `spacetimedb-typescript.mdc`,
new `spacetimedb-migration-2.0.mdc`
- **Cheat sheet**: Database cheat sheet updates
- **Reducers, procedures, reducer context**: Small fixes and
clarifications
- **llms.md**: LLM-related doc updates

# API and ABI breaking changes

None. Documentation only.

# Expected complexity level and risk

**Complexity: 2** — Broad docs changes but no code. Risk is limited to
incorrect or misleading docs.

# Testing

- [ ] Build docs site and confirm it renders
- [ ] Spot-check updated pages (tables, schedule tables, cheat sheet,
client references)
- [ ] Confirm C# tutorial examples use `nameof(...)` and snake_case

---------

Signed-off-by: bradleyshep <148254416+bradleyshep@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2026-02-23 21:09:14 -08:00
clockwork-labs-bot b002158db8 Enable confirmed reads by default (#4390)
## Summary

Enable confirmed reads by default for all WebSocket subscriptions and
SQL queries. This is a 2.0 breaking change that improves data integrity.

### What changed

Previously, subscription updates and SQL results were sent to clients
immediately, before the transaction was confirmed durable. A server
crash could cause clients to have observed data that was lost.

Now the server defaults to `confirmed=true`. Clients receive updates
only after durability is confirmed. This adds a small latency cost but
guarantees that any data a client receives will survive a server
restart.

### Changes

**Server (2 files, 2 lines each):**
- `subscribe.rs`: `SubscribeQueryParams.confirmed` defaults to `true`
- `database.rs`: `SqlQueryParams.confirmed` defaults to `true`

**Documentation:**
- Migration guide updated with "Confirmed Reads Enabled by Default"
section
- Added to overview list and quick migration checklist

### Opt-out

Clients can opt out by explicitly passing `?confirmed=false` in the
WebSocket URL or using `.withConfirmedReads(false)` /
`.WithConfirmedReads(false)` / `.with_confirmed_reads(false)` in SDKs.

### Smoketest impact

Smoketests that don't explicitly pass `--confirmed` will now get
confirmed reads via the server default. This should not cause failures
-- confirmed reads only add a small wait for durability confirmation
before sending results. The `confirmed_reads.py` smoketest explicitly
passes `--confirmed` and continues to work as before.

### SDK impact

No SDK changes needed. SDKs only send the `confirmed` query parameter
when explicitly set by the user. When not set, the server default
applies -- which is now `true`.

---------

Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <bot@clockworklabs.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-24 02:27:42 +00:00
Jason Larabie e476668b3a C++ Quickstart - spacetime dev not working (#4414)
# Description of Changes
Updated the /templates/basic-cpp to target Rust 2.0.* and add
pre-generated bindings as the updated `spacetime dev` seems to require
that.

# API and ABI breaking changes

N/A 

# Expected complexity level and risk

1 - Template only change

# Testing

- [x] Was able to use `spacetimedb-cli.exe dev --template basic-cpp`
2026-02-24 00:05:10 +00:00
Noa 28ca85566a Fix keynote-2 module (#4412)
# Description of Changes

Updates to v2 bindings

# Expected complexity level and risk

1

# Testing

- [x] Compiles
2026-02-23 23:30:03 +00:00
bradleyshep 55c1b815d4 LLM Benchmark Results - Feb 26 (#4388)
# Description of Changes

- Update llm benchmark results based on latest testing
- Clean up details file to remove old models
- Regenerated the summary file

# API and ABI breaking changes

- None

# Expected complexity level and risk

- 1

# Testing

- Verify the new summary file loads correctly on the website.
2026-02-23 23:15:39 +00:00
Ryan 92e9767a81 [Docs] Updates to 00600-c-sharp.md to work in 2.0 (#4415)
# Description of Changes

* Updates directory tree to reflect the actual results of running
`spacetime dev --template basic-cs my-spacetime-app` with no additional
arguments.
* Updates the `Add` -> `add` reducer call to use lower-case to match the
default when no override is specified.
* Updates the `SayHello` -> `say_hello` reducer call to use lower-case
to match the default when no override is specified.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [X] Walked through every step with a local server to test behavior.
This involved.
* Cleared all local cache and rebuilding the CLI.
* Rebuilding the DLLs
* From my test project directory, running:
`D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe
dev --template basic-cs my-spacetime-app` and selecting the default
values.
* This threw an error because, I believe, it was not using the local
DLLs.
* Going into each `.csproj` to ensure they are using the local versions
of the files.
* Running the remaining commands, while targeting the local CLI
executables:
  * Note: `local` server is mapped to `127.0.0.1:3000`
```
D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe publish -s local my-spacetime-app
D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe call -s local my-spacetime-app add Alice
D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe sql -s local my-spacetime-app "SELECT * FROM Person"
D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe call -s local my-spacetime-app say_hello
D:\Projects\ClockworkLabs\SpacetimeDB\target\debug\spacetimedb-cli.exe logs -s local my-spacetime-app
```
2026-02-23 23:11:39 +00:00
Jeffrey Dallatezza 7923d6f64b Update default doc version to 2.0.0 (#4411)
# Description of Changes

Docs will now go to version 2.0.0 by default, and there is a banner with
a link to the newer docs if someone is viewing the v1 docs.

# Expected complexity level and risk

1. Biggest risk here is breaking links.

# Testing

I tested this locally, and checked that links are working.

There is also a broken link checker in the CI.
2026-02-23 23:09:42 +00:00
Noa bb08c8b571 [TS] Add typescript dependency to typescript templates (#4409)
# Description of Changes

`spacetime build` now attempts to run tsc for typescript modules, and
will emit a warning if it's not present. This PR makes it so our CLI
stops emitting a warning for our templates.

# Expected complexity level and risk

1

# Testing

- [x] Verified that typescript gets properly installed.
2026-02-23 22:40:41 +00:00
Zeke Foppa 88407f0958 Bump versions to 2.0.1 (#4403)
# Description of Changes

Just bumping versions to 2.0.1.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing
- [ ] CI passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-23 21:54:10 +00:00
Zeke Foppa edb54e51e4 Fix version upgrade check for prerelease versions (#4407)
# Description of Changes

Fix our version compatibility checking for prereleases. Fixes
https://github.com/clockworklabs/SpacetimeDB/issues/4405.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing
I've added more unit tests for the upgrade behavior surrounding
prereleases (upgrading to a prerelease, upgrading from a prerelease, and
upgrading between prereleases).

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2026-02-23 21:12:56 +00:00