Commit Graph

2527 Commits

Author SHA1 Message Date
John Detter dac1883ae8 Fixed some small formatting issues 2025-10-21 12:12:24 +02:00
Julien Lavocat 7909f1adb2 Rename everything to lowercase 2025-10-21 12:12:24 +02:00
Julien Lavocat 667928586d Align CLI with other JS projects 2025-10-21 12:12:24 +02:00
Julien Lavocat a58ce2acc5 Add unreal reference 2025-10-21 12:12:24 +02:00
Julien Lavocat 4f1543bcd5 Add publish workflow 2025-10-21 12:12:24 +02:00
Julien Lavocat a71dd402f9 Manual fix of remaning links 2025-10-21 12:12:19 +02:00
Julien Lavocat bd866dff1d Fix broken links using sed 2025-10-21 12:12:19 +02:00
Julien Lavocat b8078dd872 Fix broken links 2025-10-21 12:12:19 +02:00
Julien Lavocat 1aead50b56 Fix footer still existing somehow 2025-10-21 12:12:19 +02:00
Julien Lavocat 9618ed2ec4 Migrate all images 2025-10-21 12:12:19 +02:00
Julien Lavocat 304caf9bf7 Add CI checks 2025-10-21 12:12:19 +02:00
Julien Lavocat bc85f5ea9b CSS improvements 2025-10-21 12:12:19 +02:00
Julien Lavocat ca9cd7bc14 Pages now have the same URL as live docs 2025-10-21 12:12:19 +02:00
Julien Lavocat fd06ce13b2 Improve navbar, use algolia 2025-10-21 12:12:19 +02:00
Julien Lavocat 24d701623f Add docs for docs :D 2025-10-21 12:12:19 +02:00
Julien Lavocat 3e227cbbff Migrate Unreal tutorial 2025-10-21 12:12:19 +02:00
Julien Lavocat 2427425905 Bring back cursor rules 2025-10-21 12:12:11 +02:00
Julien Lavocat 10cc004bcc Add remaning docs except Unreal Tutorial 2025-10-21 12:12:11 +02:00
Julien Lavocat f8efb27b5b Complete Unity Tutorial 2025-10-21 12:12:11 +02:00
Julien Lavocat 53517e1ee9 Finish part 3 of the unity tutorial 2025-10-21 12:12:11 +02:00
Julien Lavocat 0b43756a8e Update previous tutorial to new version 2025-10-21 12:12:11 +02:00
Julien Lavocat ca775700c0 Add links to navbar 2025-10-21 12:12:11 +02:00
Julien Lavocat 812b6e5173 Import migrated docs from poc 2025-10-21 12:12:11 +02:00
Julien Lavocat c20c30524b Remove old docs 2025-10-21 12:12:01 +02:00
joshua-spacetime c724a4e35d add rust-src to the toolchain and update trybuild test output (#3440)
# Description of Changes

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

Adds `rust-src` to the toolchain and updates the expected output of the
`trybuild` tests.

`rust-src` places the entire source code of the rust stdlib under the
local toolchain directory. `rust-analyzer` uses it for "go to
definition" (among other things) in the stdlib. When included in the
toolchain, rustc can provide code frames that it can't otherwise.

The reason for its addition is that if anyone includes it in their local
toolchain, the error messages produced by rustc when running the `ui`
tests will be slightly different (have some more information) than when
run in CI. Hence those tests will fail locally but not in CI. Rather
than removing `rust-src` locally so that the tests will pass, I've opted
to just add it to the toolchain so that everyone runs with it by
default, including in CI.

# API and ABI breaking changes

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

None

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

0

# 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] Updated rustc tests
2025-10-21 02:03:07 +00:00
Mazdak Farrokhzad 5ec2cc38e5 V8: prepare for JS workers (#3395)
# Description of Changes

This PR refactors various things in preparation for adding JS workers.
The changes are useful on their own without said workers and they are
also their own PR for ease of review.

1. Move all budget/timeout/energy/log-long-running logic to its own
module.
2. Extract some functions.
3. `register_hooks` now validates early that `__call_reducer__` and
`__describe_module__` exist and are functions. Validation beyond this is
not possible with V8.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Mostly covered by existing tests...
Also, future work.
2025-10-21 00:54:50 +00:00
joshua-spacetime 8d1298b76d Add module def types for views (#3427)
# Description of Changes

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

Adds type definitions for `RawViewDefV9` and `ViewDef`. Also validates
these module defs and populates the system tables:
- `st_table`
- `st_column`
- `st_view`
- `st_view_param`
- `st_view_column`

# API and ABI breaking changes

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

None

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

2

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

Integration tests to follow when views are added to
`__describe_module__`

---------

Signed-off-by: joshua-spacetime <josh@clockworklabs.io>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2025-10-20 21:48:05 +00:00
Tyler Cloutier 3309404c1b Fixed the react router issue and added a new test app to test for it (#3428)
# Description of Changes

This PR fixes https://github.com/clockworklabs/SpacetimeDB/issues/3359.
Additionally I have add a new test app to test for this issue and I
changed a perl script to be portable on windows.

The issue was that `useTable` had it's own `isActive` state that it was
incorrectly maintaining, when it should just have been using the
connections `isActive` state directly.

This fixes a critical bug and should be pushed ASAP.

# API and ABI breaking changes

None, fixes a critical bug.

# Expected complexity level and risk

2, quite straightforward fix after figuring it out.

# Testing

- [x] I added a test app and tested the fix in my browser.

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-20 21:23:53 +00:00
Phoebe Goldman ab3554576b Add a nix flake (#3422)
# Description of Changes

Recently, my hacked-together env stopped working, probably due to our
switching linkers. This pushed me to write a proper Nix packaging for
SpacetimeDB, complete with flake and development environment.

Some things I haven't been able to figure out (or in some cases, just
haven't bothered with):

- Unreal.
- C# WASI SDK.
- Exposing Git commit hash for `spacetime --version`.
- Making the Rust SDK's reauth test work. This test tries to write a
file in the home directory, which is inaccessible in the Nix sandbox.

# API and ABI breaking changes


It's a new thing we have to maintain if we're exposing it to users, but
I need to maintain it anyways to be able to develop Spacetime, so...

# Expected complexity level and risk

1

# Testing

- [x] Ran `nix flake check` locally.
- [x] Ran `nix build` locally and then did `spacetime start`, got an
apparently-responsive SpacetimeDB.
- [x] Ran `nix develop` locally, then `cargo build` and `cargo test` in
the dev shell.

---------

Co-authored-by: Jeffrey Dallatezza <jeffreydallatezza@gmail.com>
2025-10-20 17:44:50 +00:00
Zeke Foppa 1b3545361d Weaken minimum dotnet version (#3418)
# Description of Changes

Relax the patch version requirement in `global.json`, because `8.0.400`
isn't available on Linux.

# API and ABI breaking changes

No.

# Expected complexity level and risk

1

# Testing

I've been using this modification for a long time and we've never had
people complain about bad C# DLLs or anything.

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-20 17:17:36 +00:00
Tyler Cloutier 6a94092032 Initial TypeScript reference docs (#3407)
# Description of Changes

This PR adds a new TypeScript reference doc at
`/docs/modules/typescript`.

# API and ABI breaking changes

None

# Expected complexity level and risk

1, just docs

# Testing

- [ ] I have carefully reviewed the changes and believe that all code
represented here should compile.

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
2025-10-20 16:41:59 +00:00
Jeffrey Dallatezza dbc49b1fd6 Add AuthCtx to ReducerContext for rust (#3288)
# Description of Changes

This exposes client credentials in reducer calls for rust.

# API and ABI breaking changes

API Changes:

The main API change is the addition of `AuthCtx` and the `sender_auth`
in `ReducerContext`. This also adds JwtClaims, which has some helpers
for getting commonly used claims.

ABI Changes:

This adds one new functions `get_jwt`. This uses
`st_connection_credentials` to look up the credentials associated with a
connection id.

This adds ABI version 10.2.

# Expected complexity level and risk

2. This adds new ABI functions

# Testing

I've done some manual testing with modified versions of the quickstart.
We should add some examples that use the new API.
2025-10-17 21:03:54 +00:00
joshua-spacetime 542d26d7ff add system tables for views (#3419)
# Description of Changes

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

This patch defines the system table schemas for views and allocates IDs
for them. It **does not** populate these tables.

# API and ABI breaking changes

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

None

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

Tests will be added in the patch that populates these tables
2025-10-17 19:01:22 +00:00
Zeke Foppa 0d2a0edd0c Fix CLI package._json version (#3423)
# Description of Changes

We didn't fix this after merging the 1.6.0 version bump into the
TypeScript PR.

I had originally fixed this in the release branch, but that patch got
lost once I recreated the branch, so we should release an updated CLI
(probably just update the existing GH release).

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Existing CI only

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
2025-10-17 17:27:46 +00:00
Phoebe Goldman 0a6aa7c5d9 ModuleDef and schema changes to support procedures (#3392)
# Description of Changes

This commit extends various schema and schema-adjacent structures to
describe procedures, a new kind of database function which are allowed
to perform side effects.

This includes extending `RawModuleDefV9` with a way to register
`RawProcedureDefV9`s in the `misc_exports`, preserving compatibility
with modules that predate procedures.

The module validation path is reorganized somewhat to validate various
properties related to procedures while preserving code clarity and
maintainability.

Additionally, the `ArgsTuple` machinery for ser/de-ing reducer arguments
using the argument type as a seed is extended to also support procedure
arguments.

All of this is currently unused.

# API and ABI breaking changes

Additive and backwards-compatible additions to `RawModuleDefV9` and
friends.

# Expected complexity level and risk

2 - some minor complexity in schema validation which may have gotten
borked in a merge at some point.

# Testing

Unsure what tests would be useful, open to suggestions from reviewers.

- [ ] <!-- 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. -->
2025-10-17 17:22:14 +00:00
Tyler Cloutier c2439ceb8a Fixed a circular import that was not detected in the TypeScript SDK (#3421)
# Description of Changes

Alessandro ran into a stack overflow trying to use the TypeScript SDK
from Remix (Node.js). We debugged it to be a circular import of
`BinaryWriter` due to a barrel import. This fixes that issue.

# API and ABI breaking changes

This is technically an API breaking change because anyone who was
importing `BinaryWriter` or `BinaryReader` from `spacetimedb/sdk` will
now have to import it from `spacetimedb` or `spacetimedb/lib`.

# 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] Alessandro and I have tested this change.
2025-10-17 16:49:54 +00:00
Noa bf177c534b Fix windows linker errors (#3416)
# Description of Changes

My guess as to the problem was that there were static libs in the
dependency graph that were wanting to statically link to libc functions,
but rustc didn't know we wanted to link libc statically - so adding
`+crt-static` fixes it.

# 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] Builds successfully on windows now.
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->
2025-10-16 22:47:46 +00:00
Mazdak Farrokhzad a02d8ba8f0 Notify user in CLI that js/ts is beta quality (#3415)
# Description of Changes

Notify user in CLI that js/ts is beta quality.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

N/A
2025-10-16 16:26:13 +00:00
Noa bb43213245 Typescript module API (#3327)
# Description of Changes

Currently based on #3361 

Implements most of the TS module API (not yet a function for type
aliases).

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

# 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] Extremely basic module stuff works
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->

---------

Signed-off-by: Noa <coolreader18@gmail.com>
Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
Co-authored-by: = <cloutiertyler@gmail.com>
Co-authored-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: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-16 14:58:50 +00:00
Zeke Foppa d4837c37ab Bump versions to 1.6.0 (#3413)
# Description of Changes

Bumping versions to 1.6.0 in preparation for upcoming release.

# API and ABI breaking changes

None

# Expected complexity level and risk

1
# Testing

- [x] Existing CI only

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-16 01:26:35 +00:00
samuel.engstrom@arvikasoft.se 3075ca4fba Add forgotten variance to table_index::can_merge (#3391)
TableIndex merge logic to was missing  variants.

# Description of Changes

This pull request fixes an issue where the TableIndex::can_merge
function was missing match variants.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1 / 5 (Trivial)
This is a very low-risk change. It simply adds a few lines to a match
statement

# Testing

Manual testing confirm that creating two tables with indices with the
for the missing variants no longer causes a panic.
2025-10-15 17:05:54 +00:00
Phoebe Goldman e77b62f475 Also capture a snapshot every new commitlog segment (#3405)
# Description of Changes

We've run into a problem on Maincloud caused by a database that was
writing a relatively small number of very large transactions. This was
accruing many commitlog segments consuming hundreds of gigabytes of
disk, but had not ever taken a snapshot, or compressed or archived any
data, as the database had not progressed past one million transactions.

With this PR, we take a snapshot every time the commitlog segment
rotates. We still also snapshot every million transactions.

One BitCraft database we looked at had 2.5 million transactions per
commitlog segment, meaning that this change will not meaningfully affect
the frequency of snapshots. The offending Maincloud database, however,
had only 50 transactions per segment!

# API and ABI breaking changes

N/a

# Expected complexity level and risk

3: Hastily made changes to finnicky code across several crates.

# Testing

I am unsure how to test these changes.

- [ ] <!-- 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. -->
2025-10-15 15:18:15 +00:00
Zeke Foppa 92cd2604ad Windows - Set linker = "lld-link" (#3406)
# Description of Changes

See the inline comments for the motivation. This was originally
introduced to our Windows CI in #3351. This PR moves it from CI to
general Windows target builds, since it seems like Windows builds are
now generally having this issue.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] Windows CI still passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-15 03:09:55 +00:00
Jason Larabie b7efd17ac5 Remove use of DDC during CI tests (#3367)
# Description of Changes

Removes the use of the Derived Data Cache during CI, will in

# API and ABI breaking changes

None

# Expected complexity level and risk

1 - Small change for CI

# Testing

- [x] Re-ran tests on both Linux + Windows with the change
2025-10-14 18:27:28 +00:00
Jason Larabie 318049aca9 Fix for Unreal codegen for Optional fields (#3360)
# Description of Changes

- Fixed logic issue around Option<Vec<Option<>>> applying the wrong
types for primitives and dropping Optional
- Fixed an issue with enum vs enum variants wrapped in Option<>
producing the incorrect Unreal type
- Removed unnecessary and incorrect header bindings
- Type fix in the tests around the Optional Int32

# API and ABI breaking changes

No breaking changes 

# Expected complexity level and risk

2 - Reworked incorrect optional lookups which can happen recursively

# Testing

I built out a few simple and complex objects in a Rust module to
triple-check possible cases beyond what the test framework calls out.

- [x] Tested many combinations from a Rust module to an Unreal project
- [x] Ran and updated Unreal test cases as necessary
2025-10-14 17:50:29 +00:00
Tyler Cloutier 4d48ca208d Removed errant console.log/print statements (#3402)
# Description of Changes

`console.log` debugging statements accidentally made it into the
release.

# API and ABI breaking changes

None

# Expected complexity level and risk

1, trivial

# Testing
- [x] Automated testing only
2025-10-14 15:31:19 +00:00
Mario Montoya 5f3f17cb5b Fix python example to not advise to use ~/token.py (#3393)
# Description of Changes

Python is funny, if a file `token.py` is created and another script run
on the same dir, it will cause python to block:

```python
python3-3.13.7/lib/python3.13/tokenize.py", line 35, in <module>
    from token import *
  File "/Users/mamcx/token.py", line 3, in <module>
    text = sys.stdin.read()
```

By coincidence the docs on `pg wire` use this name. Changed to one that
don't cause the trouble.

# Expected complexity level and risk
1

# Testing

- [x] Created another script and run it, see it blocks because this...
2025-10-10 18:52:50 +00:00
Noa 207e559859 Noa/ts module host changes (#3388)
# Description of Changes

Host-side changes extracted from #3327 

I added AUTO_INC_OVERFLOW even though we don't currently ever return it,
in order to future-proof so it's already there when we start emitting
it.

Prepublish was failing because it was expecting a wasm module
unconditionally, so now it takes ?host_type.

I tweaked JS deser to accept null/undefined when the unit type or an
option type is expected.

I switched to bsatn, because the native sats->js translator wasn't
matching what js was expecting.

I renamed the sys module: my thinking is that `spacetime:` as a scheme
will help disambiguate it, and maybe it could also be used for IMC in
the future or something? And I believe we had discussed wanting this to
be versioned, similar to wasm imports.

Trying to get a borrowed str from deserialize_js doesn't work, because
v8 strings don't store utf8.

# 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] All this was done in the course of getting an actual typescript
module to successfully publish.
2025-10-10 18:25:26 +00:00
Zeke Foppa b34f37b3bd Misc cleanups in tools/upgrade-version (#3370)
# Description of Changes

* Make sure the user provides at least one of `--rust-and-cli`,
`--typescript`, or `--csharp`, since providing none of them is a no-op
as of #3308
* Do a semver-parsing of the arg before doing anything, and use that
parsed version everywhere
* Consolidate some version strings that we were computing in a few
places

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] Running `cargo bump-versions 1.5.0 --typescript --rust-and-cli
--csharp` only shows a diff in the change dates

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-10 17:27:39 +00:00
Zeke Foppa 0b67dd23a8 CI - Check that C# bindings are up to date (#3362)
# Description of Changes

Check that our generated C# files are up-to-date in our CI.

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] CI all passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-10-10 17:12:33 +00:00