Commit Graph

72 Commits

Author SHA1 Message Date
Tyler Cloutier d78517fd9a Misc docs and small CLI improvements (#3953)
# Description of Changes

This PR does several small things:

1. It removes the explicit `h1` tags on every page, and either uses the
side bar title directly, or puts it in the frontmatter
2. It merges what are currently called quickstarts into a single Chat
App Tutorial
3. It creates new quickstarts which just use `spacetime dev --template`
to get you up and running quickly
4. It adds a "The Zen of SpacetimeDB" page much like the Zen of Python
which goes over the 5 key principles of SpacetimeDB
5. It reorders all Tabs groups so that the ordering is `TypeScript`,
`C#`, `Rust`, `Unreal`, `C++`, `Blueprints` (order of decreasing
popularity).
6. It improves the sidebar navigation by having categories act as
overview pages, and also fixes the breadcrumbs
7. It fixes various small typos and issues
8. Closes #3610 and adds cursor rules files generally
9. It fixes general styling on the docs page by bring it inline with the
UI design:

Old:
<img width="1678" height="958" alt="image"
src="https://github.com/user-attachments/assets/f36efee6-b81a-4463-a179-da68b3a7152e"
/>

New:
<img width="1678" height="957" alt="image"
src="https://github.com/user-attachments/assets/f430f77d-0663-47f2-9727-45cbfe10e4c7"
/>


https://github.com/user-attachments/assets/adc5a78a-ada8-45b5-8078-a45cb81477a3

# API and ABI breaking changes

This PR does NOT change any old links. It does add new pages though.

# Expected complexity level and risk

3 - it's a large change. I manually tested the TypeScript Chat App
Tutorial but I have not gone through the Rust and C# quickstarts.
However, we have testing on the quickstarts and this is text only so can
be carefully reviewed.

# 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 through each step of the Chat App TypeScript tutorial to
ensure it is working
- [x] Ran and tested the styles and the functionality of the side bar

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: spacetimedb-bot <spacetimedb-bot@users.noreply.github.com>
Co-authored-by: clockworklabs-bot <clockworklabs-bot@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
2026-01-13 00:14:48 +00:00
Piotr Sarnacki 3c8836b1a3 Templates rework (#3879)
# Description of Changes

We would like to move all of the templates to a central directory

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

---------

Co-authored-by: spacetimedb-bot <spacetimedb-bot@users.noreply.github.com>
2026-01-09 15:09:26 +00:00
bradleyshep b75bf6decf LLM Benchmarking (#3486)
# Description of Changes

Introduce a new **LLM benchmarking app** and supporting code.

* **CLI:** `llm` with subcommands `run`, `routes list`, `diff`,
`ci-check`.
* **Runner:** executes globally numbered tasks; filters by `--lang`,
`--categories`, `--tasks`, `--providers`, `--models`.
* **Providers/clients:** route layer (`provider:model`) with HTTP LLM
Vendor clients; env-driven keys/base URLs.
* **Evaluation:** deterministic scorers (hash/equality, JSON
shape/count, light schema/reducer parity) with clear failure messages.
* **Results:** stable JSON schema; single-file HTML viewer to
inspect/filter/export CSV.
* **Build & guards:** build script for compile-time setup;
* **Docs:** `DEVELOP.md` includes `cargo llm …` usage.

This PR is the initial addition of the app and its modules (runner,
config, routes, prompt/segmentation, scorers, schema/types,
defaults/constants/paths/hashing/combine, publishers, spacetime guard,
HTML stats viewer).

### How it works
1. **Pick what to run**

* Choose tasks (`--tasks 0,7,12`), or a language (`--lang rust|csharp`),
or categories (`--categories basics,schema`).
   * Optionally limit vendors/models (`--providers …`, `--models …`).

2. **Resolve routes**

* Read env (API keys + base URLs) and build the active set (e.g.,
`openai:gpt-5`).

3. **Build context**

   * Start Spacetime
   * Publish golden answer modules
   * Prepare prompts and send to LLM model
   * Attempt to publish LLM module

4. **Execute calls**

* Run the selected tasks within each test against selected models and
languages.

5. **Score outputs**

* Apply deterministic scorers (hash/equality, JSON shape/count, simple
schema/reducer checks).
   * Record the score and any short failure reason.

6. **Update results file**

* Write/update the single results JSON with task/route outcomes,
timings, and summaries.


# API and ABI breaking changes

None. New application and modules; no existing public APIs/ABIs altered.

# Expected complexity level and risk

**4/5.** New CLI, routing, evaluation, and artifact format.

* External model APIs may rate-limit/timeout; concurrency tunable via
`LLM_BENCH_CONCURRENCY` / `LLM_BENCH_ROUTE_CONCURRENCY`.

# Testing

I ran the full test matrix and generated results for every task against
every vendor, model, and language (rust + C#). I also tested the CI
check locally using [act](https://github.com/nektos/act).

**Please verify**

* [ ] `llm run --tasks 0,1,2` (explicit `run`)
* [ ] `llm run --lang rust --categories basics` (filters)
* [ ] `llm run --categories basics,schema` (multiple categories)
* [ ] `llm run --lang csharp` (language switch)
* [ ] `llm run --providers openai,anthropic --models "openai:gpt-5
anthropic:claude-sonnet-4-5"` (provider/model limits)
* [ ] `llm run --hash-only` (dry integrity)
* [ ] `llm run --goldens-only` (test goldens only)
* [ ] `llm run --force` (skip hash check)
* [ ] `llm ci-check`
* [ ] Stats viewer loads the JSON; filtering and CSV export work
* [ ] CI works as intended

---------

Signed-off-by: bradleyshep <148254416+bradleyshep@users.noreply.github.com>
Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: spacetimedb-bot <spacetimedb-bot@users.noreply.github.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
2026-01-06 22:22:57 +00:00
Tyler Cloutier 46f3e07dfc Fixes issues with --delete-data=on-conflict (#3730)
# Description of Changes

Fixes https://github.com/clockworklabs/SpacetimeDB/issues/3729

I genuinely don't know what came over me.

# API and ABI breaking changes

None

# Expected complexity level and risk

1.5 very straightforward but not strictly trivial

# Testing
Adds automated integration tests (written in Rust and run with `cargo
test`, although note this comment from @matklad about integration tests
for the future
https://internals.rust-lang.org/t/running-test-crates-in-parallel/15639/2):

- [x] Can publish an updated module if no migration is required
- [x] Can publish an updated module if auto-migration is required (with
the yes-break flag true/false)
- [x] Cannot publish if a manual migration is required
- [x] Can publish if a manual migration is required but the user
specified `--delete-data`
- [x] Can publish if a manual migration is required by the user
specified `--delete-data=on-conflict`
- [x] No data deletion occurs if no migration is required and
`--delete-data=on-conflict` is specified

---------

Signed-off-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
2025-12-04 21:45:41 +00:00
Noa 020d64c1f1 Split client codegen out into its own crate (#2593)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-04-29 17:54:25 +00:00
Jeffrey Dallatezza 228ec0c8d8 Add the primary key type to typescript's TableRuntimeTypeInfo (#2671) 2025-04-28 21:14:32 +00:00
james gilles eeb3333f1f Implement OnUnhandledReducerError in C# (#2636) 2025-04-23 22:38:58 +00:00
Jeffrey Dallatezza 9f09e8ac53 Use camel case for typescript unique indexes (#2628) 2025-04-21 17:58:02 +00:00
Mazdak Farrokhzad c39f7fa64c Plain enums as index keys with specialized indices (#2506) 2025-04-09 18:52:15 +00:00
Jeffrey Dallatezza 872a8d839c When generating for typescript, convert the primary key to camel case. (#2409) 2025-03-12 22:14:12 +00:00
james gilles 4fc4963f21 Final C# codegen changes (#2303) 2025-02-25 18:57:45 +00:00
Mazdak Farrokhzad b34caf8306 Rust SDK: Deduplicate rows accross queries (#2286)
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2025-02-21 21:12:29 +00:00
Jeffrey Dallatezza fc71275a46 Fix some typos in the ts code gen. (#2287) 2025-02-21 19:10:58 +00:00
james gilles 2f30dc1c2c C# SDK - Emit Event.UnknownTransaction rather than throwing on unknown reducer (#2241) (#2249) 2025-02-11 21:54:06 +00:00
Tyler Cloutier 03fda01fb9 Implemented error arguments in error callbacks (#2229) 2025-02-11 15:48:05 +00:00
Tyler Cloutier d191b8561b DBConnection -> DbConnection for the TypeScript API (#2230) 2025-02-11 02:14:02 +00:00
Phoebe Goldman aedc601145 Rename Address to ConnectionId (#2220)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: James Gilles <jameshgilles@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-02-10 00:40:16 +00:00
Tyler Cloutier e54a28584a Standardized module names and added module-test-cs based on module-test (#2232) 2025-02-09 05:58:19 +00:00
Tyler Cloutier 249910b079 Implemented the new EventContext types in Typescript codegen (#2224) 2025-02-08 18:00:34 +00:00
james gilles 9c92edd861 Rework event contexts in C# SDK (#2226) 2025-02-07 21:29:16 +00:00
Phoebe Goldman 91327d585e Make Timestamp a special SATS type (#1836)
Signed-off-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: James Gilles <jameshgilles@gmail.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-02-07 18:17:53 +00:00
Ingvar Stepanyan 88090ec73a Rewrite C# codegen to the new Lang infra + fixes (#2184)
Co-authored-by: James Gilles <jameshgilles@gmail.com>
2025-02-05 22:07:45 +00:00
Phoebe Goldman 2d90657dbc Rust client SDK: rework EventContext into multiple types (#2189) 2025-02-05 00:50:55 +00:00
Phoebe Goldman 3a126bca5a Rust SDK: remove anyhow, use thiserror w/ structured error types (#2169) 2025-02-05 00:01:37 +00:00
Jeffrey Dallatezza e2ffc07997 Implement incremental subscriptions on the client (#2111)
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-01-31 18:02:50 +00:00
Noa 293aebaef9 Bump to Rust 1.84 (#2001) 2025-01-28 23:11:29 +00:00
Noa cf6ac18eaf Lookup lifecycle reducers by lifecycle flag, not by name (#2132) 2025-01-17 23:21:52 +00:00
Phoebe Goldman 44d7b76d29 Fix defining multiple tables on the same struct in Rust modules (#2103) 2025-01-10 01:58:20 +00:00
Phoebe Goldman a4b46c5ddb Implement the identity host call and ctx.identity() in Rust (#2085) 2025-01-03 19:09:34 +00:00
Phoebe Goldman d9de1e3943 Rust SDK: no more reducer args structs (#2036) 2024-12-04 17:00:27 +00:00
Ingvar Stepanyan 3902f7562e Migrate C# client-side reducer enum to the new syntax (#2033) 2024-12-04 16:41:16 +00:00
Phoebe Goldman 80dff96723 Rust SDK: Actual client-side indices for unique constraints (#1909) 2024-11-29 18:29:08 +00:00
Noa 94c66c97da Don't autogen schedule fields (#1894)
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
2024-11-22 18:39:39 +00:00
Mazdak Farrokhzad ac0053caab Websocket API: Light transaction updates & NoSuccessNotify (#1812)
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
2024-11-04 15:59:11 +00:00
Jeremie Pelletier 1328b5d6a0 C# codegen making state relative to a DbConnection (#1869) 2024-10-30 20:55:30 +00:00
Phoebe Goldman 437eed7760 Rust modules: Revise BTreeIndexBounds (#1815) 2024-10-22 14:49:32 +00:00
Jeremie Pelletier 02b70d5c94 c# client generate (#1707) 2024-10-04 04:12:15 +00:00
Tyler Cloutier fe62e13644 Small fixes to TypeScript codegen (#1800) 2024-10-03 17:10:36 +00:00
Tyler Cloutier 0eb147e132 Implemented TypeScript SDK proposal codegen (#1776) 2024-10-02 06:24:58 +00:00
Mazdak Farrokhzad 1ac741aa6b Generic and optimized WebSocket API (#1761)
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2024-09-30 21:57:00 +00:00
Phoebe Goldman b7d2e3d61d Rework Rust SDK for new API (#1692) 2024-09-30 14:20:55 +00:00
Noa f6bc6dcfe5 Switch Rust codegen to use new ModuleDef (#1675) 2024-09-17 18:32:35 +00:00
Tyler Cloutier 3530498b88 Switched table names to singular (#1684)
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
2024-09-11 11:11:51 -04:00
Noa bdf94f1fb3 Fix table codegen wrt table names (#1689) 2024-09-11 09:39:15 -04:00
Noa 8daab8e20f Impl macro rework (#1314) 2024-09-09 23:30:31 +00:00
Ingvar Stepanyan 607f7ce6b8 Auto-generate C# ModuleDef bindings from Rust (#1680) 2024-09-09 18:22:17 +00:00
james gilles 747eb71830 Make ScheduleAt special + Typespace::is_valid_for_client_code_generation (#1590) 2024-08-22 17:05:04 +00:00
Mazdak Farrokhzad 1e8e18d74b Add support for I256 and U256 (#1477) 2024-08-08 18:40:35 +00:00
Mazdak Farrokhzad 3340ceea8a SATS: Flatten AlgebraicType, getting rid of BuiltinType (#1559)
Signed-off-by: Mazdak Farrokhzad <twingoow@gmail.com>
Signed-off-by: joshua-spacetime <josh@clockworklabs.io>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2024-08-06 18:15:19 +00:00
Ingvar Stepanyan 7500ea33fb C#: remove using SpacetimeDB.ClientApi; (#1546) 2024-07-25 18:43:14 +00:00