Commit Graph

3186 Commits

Author SHA1 Message Date
Mario Montoya 730d49972b Remove duplicate assertSql in smoke test (#3588)
# Description of Changes

Small cleanup of duplicate logic on smoke tests

# Expected complexity level and risk
1
# Testing
- [x] Run smoke tests

Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2025-12-02 08:23:15 +00:00
Cameron Hutchison 62e79fad95 C# Views - Use Name from ViewAttribute instead of Method Name (#3792)
C# Views - Use Name from ViewAttribute instead of Method Name

# Description of Changes

The [documentation for C#
views](https://spacetimedb.com/docs/modules/c-sharp#views) says that
"Views must be declared as Public, **with an explicit Name**, and
[...]". However, the `Name` provided to the `View` attribute is not
being used as the name of the view in the Module or the generated C#
client SDK code. The `ViewDeclaration` actually checks that the `View`
attribute's name is not null or empty, but then proceeds to do nothing
with it.

This PR updates the `ViewDeclaration` to use the `Name` property from
`ViewAttribute`.

For more info - see my bug report in Discord:
https://discord.com/channels/1037340874172014652/1443881580602069043

# API and ABI breaking changes

No breaking change to the API. Though, anyone who has a view name
declared that's different from their method name will have to deal with
that during migration of their modules.

# Expected complexity level and risk

1 - Trivial change

# Testing

I compiled the C# projects under `crates/bindings-csharp`, built the
NuGet packages, and tested them locally with a project using SpacetimeDB
1.10 (CLI and associated packages).

I confirmed that the generated classes now use the value from the `View`
attribute as the `RemoteTableName`. See attached image.

<img width="1429" height="372" alt="Screenshot 2025-11-28 at 3 04 48 PM"
src="https://github.com/user-attachments/assets/1db83c14-b0dc-4bcb-87ac-50e104f4d501"
/>

---------

Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2025-12-02 07:42:25 +00:00
Tyler Cloutier 5f1cb41eb9 Fixes docs links (#3803)
# Description of Changes

This removes all usages of `pathname:///` and replaces them with
`https://spacetimedb.com/`. `pathname:///` was resolving to `/docs` in
some cases and was not verified by our link checker. Note that this
means these links will NOT work in staging.

This is a temporary fix. We should find a way to be able to link out to
the rest of the site without hardcoding the hostname in the future.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- I tested that the links work locally (but obviously they link to the
production site).

---------

Signed-off-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: John Detter <4099508+jdetter@users.noreply.github.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2025-12-02 07:30:49 +00:00
Tamaro Skaljic 87bc15c0b4 Implement DbContext for AnonymousViewContext and ViewContext (#3787)
# Description of Changes

The trait has already been implemented for ReducerContext and TxContext,
but implementation for AnonymousViewContext and ViewContext is still
missing.

## Background why I need this change

In SpacetimeDSL, I currently have the ReducerContext hard-coded as a
prerequisite for creating a DSL instance (see
https://github.com/tamaro-skaljic/SpacetimeDSL/blob/main/src/lib.rs#L9-L33)
.

With the addition of

- ViewContext,
- AnonymousViewContext,
- ProcedureContext, and
- TxContext,

I am now faced with the dilemma that I also have to support SpacetimeDSL
with the other contexts.

I hope to be able to use `spacetimedb::DbContext<DbView =
spacetimedb::Local>` and `spacetimedb::DbContext<DbView =
spacetimedb::LocalReadOnly>` as a common denominator.

(I signed the CLA)

# API and ABI breaking changes

No

# Expected complexity level and risk

1

Signed-off-by: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Co-authored-by: joshua-spacetime <josh@clockworklabs.io>
2025-12-02 07:07:37 +00:00
joshua-spacetime 6cf2372a3c Remove race condition from sdk test (#3804)
# Description of Changes

Moves a reducer call to inside an `on_insert` callback to avoid race
condition.

# API and ABI breaking changes

None

# Expected complexity level and risk

0

# Testing

Fixes a test
2025-12-02 05:53:42 +00:00
joshua-spacetime c49eea31da Fix view rewrite for delta tables (#3801)
# Description of Changes

Applies the same implicit filter for views to delta tables that we
already did for physical tables.

Removes a single condition `scan.delta.is_none()` from the already
existing rewrite rule.

# API and ABI breaking changes

None

# Expected complexity level and risk

0

# Testing

- [x] Rust sdk test
2025-12-01 21:15:32 +00:00
Piotr Sarnacki 1fb8c28e9e Actually report reducer fuel used (#3799)
# Description of Changes

In the `call_reducer_with_tx` function we only reported the WASM fuel
used by view evaulation, but not the stats from the actual reducer call.
This PR fixes it and we now properly record it.

# Expected complexity level and risk

1

# Testing

I've tested the change locally. Before the change the reported metrics
were always zero after running any reducer. Now the usage is reported
properly.
2025-12-01 19:26:13 +00:00
Phoebe Goldman b5f3ce8c2d Add docs for procedures (#3766)
# Description of Changes

In the spirit of our planned move to concept-based documentation rather
than language-based documentation,
I've chosen to add a quick section to the overview, and then a new page
for documentation about procedures. I have not updated any tutorials or
reference pages.

# API and ABI breaking changes

N/a - docs

# Expected complexity level and risk

1 - docs

# Testing

None.

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-11-27 05:00:03 +00:00
John Detter 4588f77599 Update typescript package size limits (#3786)
# Description of Changes

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

I got these errors when I tried sending out the typescript NPM package:

```
  cjs (brotli)
  Package size limit has exceeded by 165 B
  Size limit: 26 kB
  Size:       26.16 kB brotlied
  
  esm (brotli)
  Size limit: 26 kB
  Size:       25.87 kB brotlied
  
  esm (gzip)
  Package size limit has exceeded by 536 B
  Size limit: 30 kB
  Size:       30.54 kB gzipped
  
  esm (uncompressed)
  Package size limit has exceeded by 3.77 kB
  Size limit: 160 kB
  Size:       163.77 kB
  
  esm min (brotli)
  Package size limit has exceeded by 194 B
  Size limit: 14 kB
  Size:       14.19 kB brotlied
  
  esm min (gzip)
  Package size limit has exceeded by 144 B
  Size limit: 16 kB
  Size:       16.14 kB gzipped
  
  esm min (uncompressed)
  Package size limit has exceeded by 1.29 kB
  Size limit: 65 kB
  Size:       66.29 kB
```

# 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

<!--
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] After this change I was able to publish the typescript NPM
package.
2025-11-27 02:50:45 +00:00
John Detter 1d3421745c Split Unity and C# tests into separate jobs (#3779)
# Description of Changes

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

This has 2 benefits:
1. If the Unity test fails because of a license issue then we don't have
to re-run the C# tests again as part of this flow. Re-running the Unity
tests will be much faster if that's the only thing the job is doing.
2. These tests will run faster because they will now run in parallel as
separate CI jobs.

# 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

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] Both tests pass

---------

Signed-off-by: John Detter <4099508+jdetter@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 <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-26 21:33:35 +00:00
Tyler Cloutier 1630f0c553 Fixes reported issues with the TypeScript SDK (#3737)
# Description of Changes

Fixes:

- [This
issue](https://discord.com/channels/1037340874172014652/1398209084699709492/1441556875647647816)
by exporting the `SubscriptionHandle` type with the `REMOTE_MODULE` type
applied.
- [This
issue](https://discord.com/channels/1037340874172014652/1398209084699709492/1441559246213746749)
by converting to `camelCase` for column names in code generation.
- Fixes an issue where `onMyReducer` callbacks were passing arguments as
variadic params, while the types indicated they would be passed as an
object. `onMyReducer((ctx, argA, argB, argC) => {})` vs
onMyReducer((ctx, { argA, argB, argC}) => {})`
- [Fixes an
issue](https://github.com/clockworklabs/SpacetimeDB/issues/3503#issuecomment-3566715928)
where the table type name was used instead of the table name in code
generation for constructing tables.
- [Fixes
issue](https://discord.com/channels/1037340874172014652/1398209084699709492/1441886030436499466)
with `ScheduleAt` being used in non-table types.
- [Fixes
issue](https://github.com/clockworklabs/SpacetimeDBPrivate/issues/2168)
where template projects do not use the correct lifecycle reducer setup

# API and ABI breaking changes

Adds a new export, and fixes casing in code genreation.

# Expected complexity level and risk

2

# Testing

- I have tested that the `SubscriptionHandle` is correctly exported
- I have tested that the constraint name is now output in `camelCase`
- I have tested that `onMyReducer` callbacks now return a single
argument
- I have tested that the table name (and view name) is now used instead
of the type name for code generation
- I have tested that the new lifecycle reducers correctly compile
2025-11-26 21:09:45 +00:00
Noa 7ca16de147 Fix some typescript issues (#3775)
# Description of Changes

Fixes https://github.com/clockworklabs/SpacetimeDBPrivate/issues/2169
and https://github.com/clockworklabs/SpacetimeDBPrivate/issues/2170.

# Expected complexity level and risk

1

# Testing

- [x] The issues no longer occur.

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@aol.com>
2025-11-26 21:08:47 +00:00
Phoebe Goldman d4c80b4de1 Delete duplicated docs folders (#3780)
# Description of Changes

Somehow (apparently after #3494) we wound up with a bunch of duplicate
folders in our repo, both the old title-case names and the new
lower-case names. All of the remaining files in the title-case
directories have their last change in #3343, well before #3494, so I
don't believe we're losing any intermediate changes by deleting them.
I'm not sure how this happened, but it seems to be an easy fix.


# API and ABI breaking changes

N/a

# Expected complexity level and risk

2 - some small possibility that I accidentally deleted an intentional
change that got borked by a merge conflict or something. I don't think I
did, tho, based on the age of the git blame on the files deleted here.

# Testing

None
2025-11-26 19:37:15 +00:00
John Detter 9c6e5a5cbe Set timeout for smoketests (#3772)
# Description of Changes

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

Sets a 2 hour timeout for the smoketests. If the smoketests are taking
more than 2 hours they likely will never finish and we should just time
them out.

# 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

<!--
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]
https://github.com/clockworklabs/SpacetimeDB/actions/runs/19697510980/job/56425630374?pr=3772
2025-11-26 19:08:49 +00:00
Phoebe Goldman ae9bd74eca Disable scheduling procedures (#3768)
# Description of Changes

We've been unable to get scheduled procedures into the initial release
of procedures due to a nondeterministic hang in some of our tests which
we don't have time to debug. As such, this commit disables scheduled
procedures by:

- Changing the `RawModuleDevV9` validator to reject scheduled
procedures.
- Changing the Rust bindings library's typechecking magic so that
scheduled table annotations referencing procedures will cause a type
error.
- Removes some docs from the Rust bindings library which reference
scheduled procedures.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

1

# Testing

Automated tests should be sufficient.

Prior to merging #3774 , CI for this branch merged with master failed in
the intended way: modules which attempted to define scheduled procedures
failed to typecheck.
2025-11-26 18:40:25 +00:00
John Detter 0590f7022d Upgrade to version 1.10.0 (#3769)
# Description of Changes

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

This upgrades the SpacetimeDB version to 1.10.0.

# 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

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

This is just a version bump - not tested.
2025-11-26 17:55:26 +00:00
John Detter d26f3a10a9 Revert "Procedures: fix scheduling (#3704)" (#3774)
This reverts commit b2e37e8008.

# Description of Changes

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

Reverts #3704 which I'm pretty sure contains some sort of bug which is
causing the smoketests to hang.

# 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

<!--
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] CI passing again
2025-11-26 17:06:11 +00:00
Tyler Cloutier dbc3d86b25 First pass at reorganizing the docs and making them nice (#3494)
# Description of Changes

This PR is the first in a series of PRs which are an effort the
reorganize the docs and make it easier for people to get started using
SpacetimeDB.

This PR:

1. Renames all folders to be `kebab-case`. This is because `docIds` are
set based on folder and file names, and there is no way to override that
within a file (all you can change with `id: my-id` is the last component
of the id. Because we want to be able to access docs in react components
we need stable predictable ids.
- This also necessitates setting up a few `_category_.json` files so
that the categories do not show up as kebab case in the sidebar.
2. Adds a few React components with images so it's clearer on how to get
started
3. Reorganizes the quickstarts to be at the top of the side bar and
simplifies the server and client into a single document named for the
language
4. Sets up redirections so the old links to the old documents now point
to the new documents
5. Copies the entirety of `typography.css` from the website into this
repo for the purpose of keeping them identical
6. Makes minor fixes and improvements to the contents of the docs

In a future PR, I intend to:

1. Add a tutorial section to the docs which will include two tutorials:
Blackholio and Chat
2. Turn the chat quickstart documents into the Chat tutorial and
consolidate it into a single file with different language switchers (if
this is feasible)
3. Create a new quickstart section, which has a quickstart guide for
each platform that we support so far, namely:
    - Vanilla TypeScript
    - Vanilla JavaScript
    - Vanilla Rust
    - Vanilla C#
    - React
    - Unity
    - Unreal
4. Update the quickstart guides to do the following (in the future I
will add more platforms with this scheme):
- Use `spacetime dev --template <framework-template>` to create a new
project for the given framework
    - Insert data into the database
    - Add a new `reducer` to the template
    - Add a new `table` to the template
    - Add a new `view` to the template
    - Call the reducer from the client
    - Subscribe to the `view` from the template
5. Break up the current per language module reference files into files
about SpacetimeDB concepts with a `TabGroup` for each language, namely:
    - Modules
    - Tables
    - Reducers
    - Procedures
    - Code generation
    - DbConnection (and the SDK API)
    - Auth
    - etc.
The idea being that we should explain our platform by concept, not by
language. This will also allow us to reuse a lot of prose that is
repeated in the different language documents.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] Tested the documents locally to ensure that they render properly

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-26 15:06:02 +00:00
Mazdak Farrokhzad b2e37e8008 Procedures: fix scheduling (#3704)
# Description of Changes

Reworks how `SchedulerActor::handle_queued` works so that it first
determines the parameters of the call to a reducer or the parameters of
the call to the procedure. This also enables the removal of the special
case `call_scheduled_reducer`.

Fixes #3645.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

A test `schedule_procedure` is added.

---------

Co-authored-by: Noa <coolreader18@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@goldman-tribe.org>
Co-authored-by: rekhoff <r.ekhoff@clockworklabs.io>
2025-11-26 03:56:53 +00:00
John Detter d7d06b1529 [Typescript] Increased size limits for some deps (#3728)
# Description of Changes

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

We got some errors when publishing the typescript release related to the
size limits of these deps. This PR just increases those limits.

```
  cjs (brotli)
  Package size limit has exceeded by 348 B
  Size limit: 25 kB
  Size:       25.35 kB brotlied
  
  esm (brotli)
  Package size limit has exceeded by 5.19 kB
  Size limit: 20 kB
  Size:       25.19 kB brotlied
  
  esm (gzip)
  Package size limit has exceeded by 4.63 kB
  Size limit: 25 kB
  Size:       29.63 kB gzipped
  
  esm (uncompressed)
  Package size limit has exceeded by 8.45 kB
  Size limit: 150 kB
  Size:       158.45 kB
  
  esm min (brotli)
  Package size limit has exceeded by 1.65 kB
  Size limit: 12 kB
  Size:       13.65 kB brotlied
  
  esm min (gzip)
  Package size limit has exceeded by 490 B
  Size limit: 15 kB
  Size:       15.49 kB gzipped
  
  esm min (uncompressed)
  Package size limit has exceeded by 3.51 kB
  Size limit: 60 kB
  Size:       63.51 kB
  
  react esm min (brotli)
  Size limit: 10 kB
  Size:       4.13 kB brotlied
  
  react esm min (uncompressed)
  Size limit: 10 kB
  Size:       4.13 kB brotlied
  
  react esm min (gzip)
  Size limit: 15 kB
  Size:       4.64 kB gzipped
  
  sdk esm min (brotli)
  Package size limit has exceeded by 3.41 kB
  Size limit: 10 kB
  Size:       13.41 kB brotlied
  
  sdk esm min (gzip)
  Package size limit has exceeded by 251 B
  Size limit: 15 kB
  Size:       15.25 kB gzipped
  
  sdk esm min (uncompressed)
  Package size limit has exceeded by 3.41 kB
  Size limit: 10 kB
  Size:       13.41 kB brotlied
  
  Try to reduce size or increase limit in "size-limit" section of package.json
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
Error: Failed to publish package to npm
Error: Process completed with exit code 1.
```

# 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 just fixes the release.

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

- I have not tested this because I want review before trying it on the
release.

<!-- 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! -->
2025-11-26 01:12:09 +00:00
Noa 174f5286d3 [TS] Client-side procedure bindings (#3765)
# Description of Changes

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

# Expected complexity level and risk

2

# Testing

- [x] The types for generated module bindings look right
- [ ] Actually test the client behavior (how?)
2025-11-26 00:59:51 +00:00
clockwork-tien 617499b7c3 Docs: Update docs nav items font weight to 600 (#3721)
# Description of Changes

- Update docs nav items font weight to 600

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

Screenshot:

<img width="1489" height="56" alt="image"
src="https://github.com/user-attachments/assets/175ef382-41a1-40ed-8a25-c38cc4e513f1"
/>

# 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

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

- [ ] <!-- 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 <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-25 22:08:29 +00:00
John Detter 66606d29bc Move docs tests to custom runner (#3699)
# Description of Changes

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

Just moving more jobs to the custom runner.

|Test|Before|After|% Change|
|---|---|---|---|
|Docs - Build + Test|2m|1m|No change|
|Docs - Publish|2m|<2m|No change|

# 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

1 - This is very low 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

I ran a publish test and it worked just fine:
<https://github.com/clockworklabs/SpacetimeDB/actions/runs/19515454265/job/55865908554>

- [x] CI still passes

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-25 22:06:32 +00:00
Zeke Foppa 462cac9af7 CI - Migrate off of spacetimedb-runner (#3763)
# Description of Changes

Move anything running on `spacetimedb-runner` to
`spacetimedb-new-runner`

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] CI passes

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-25 20:16:23 +00:00
Phoebe Goldman 507b087dd8 Add metrics for recording HTTP requests performed by procedures. (#3745)
# Description of Changes

This commit adds several new metrics to `DB_METRICS` for tracking
procedures' HTTP requests:

- `procedure_http_request_size_bytes`.
- `procedure_http_response_size_bytes`.
- `procedure_num_http_requests`.
- `procedure_num_successful_http_requests`.
- `procedure_num_failed_http_requests`.
- `procedure_num_timeout_http_requests`.
- `procedure_num_in_progress_http_requests`.

See help strings in `crates/datastore/src/db_metrics/mod.rs` for details
on what each of these tracks.

Closes #3712 .

# API and ABI breaking changes

N/a - I don't think we count metrics as a stable API.

# Expected complexity level and risk

2, I guess? If we intend to use these for billing, some of the choices
I've made about tracking may impact our business.

# Testing

None; I don't know how to test Prometheus metrics.

Co-authored-by: Noa <coolreader18@gmail.com>
2025-11-25 17:40:13 +00:00
joshua-spacetime 0a3dda7f4e Add rust sdk tests for views (#3755)
# Description of Changes

Rust SDK test suite for views

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

This patch only adds tests, it does not change functionality.
2025-11-25 17:13:03 +00:00
rekhoff 60e4a640e8 C# module bindings for Procedures (#3732)
# Description of Changes

Implements the C# module bindings for Procedures (#3510)

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

- [X] Locally tested against existing C# Procedures regression test
client (minus the Transaction and HTTP portions, as those are not in
this change).
2025-11-25 16:50:54 +00:00
Mazdak Farrokhzad ed2a18cff7 Bump hashbrown, foldhash; Fix some compile errors in master (#3722)
# Description of Changes

There were mentions of `hashbrown` in the repo that did not go through
`spacetimedb_data_structures::map`.
This caused compile errors on master when running certain tests locally.
These have been replaced with the proper imports.

The PR also bump hashbrown to 0.16.1 and foldhash to 0.2.0.

# API and ABI breaking changes

None

# Expected complexity level and risk

2

# Testing

Covered by existing tests.
2025-11-25 12:17:24 +00:00
joshua-spacetime 75d35d324b Fix realtime update for views (#3747)
# Description of Changes

View tables have private metadata columns that need to be dropped before
sending results to clients. Before this patch we dropped these columns
for sql queries and initial subscriptions, but we didn't drop them after
incremental update which is what this patch does.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] Smoketest
2025-11-25 06:26:44 +00:00
Noa fd524cf275 [TS] Anonymous transactions (#3743)
# Description of Changes

Mirrors the Rust API.

# Expected complexity level and risk

2

# Testing

- [x] Automated procedure testing now enabled for typescript (from
`sdks/rust/tests`)
2025-11-25 02:20:57 +00:00
Noa cb3ac50bdf [TS] Http procedure API (#3731)
# Description of Changes

Provides a fetch-alike API on `ctx.http`. I guess it could just be
`ctx.fetch()` instead of `ctx.http.fetch()`, but I'm not sure if that's
a good idea.

# Expected complexity level and risk

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

- [x] Need to verify that this actually works
- [ ] <!-- maybe a test you want a reviewer to do, so they can check it
off when they're satisfied. -->
2025-11-25 01:26:27 +00:00
Phoebe Goldman b17e0dbe6c Rename the /database/procedure route to be unstable (#3723)
# Description of Changes

Title.

Closes #3644 .

# API and ABI breaking changes

Moves an unreleased HTTP route to make it explicitly unstable.

# 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] Used `curl` to hit the previous, not-unstable-looking route, got a
404.
- [x] Used `curl` to hit the new, obviously-unstable route, got a proper
response.
2025-11-24 23:27:35 +00:00
Zeke Foppa 8552048aca CI - Clearer CTA in discord post (#3738)
# Description of Changes

Our automated discord posts have a more explicit call to action for the
PR author.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

Did a test post and it looks fine

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-24 20:48:55 +00:00
Zeke Foppa f071c213d3 CI - CLI doc check shouldn't fail on Cargo.lock diff (#3739)
# Description of Changes

Stop the CLI doc check from failing on `Cargo.lock` diffs, which it was
doing before.

# API and ABI breaking changes

CI only.

# Expected complexity level and risk

1

# Testing

- [x] CI still fails elsewhere if `Cargo.lock` needs updating

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-24 20:11:37 +00:00
Noa 72f34a349f [TS] Implement basic procedure calling (#3649)
# Description of Changes

Implements `__call_procedure__` in the TS bindings and host.

# Expected complexity level and risk

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

- [ ] <!-- 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-11-24 19:18:33 +00:00
Zeke Foppa 5113488cf2 Revert "Remove the dependency on git ls-files from cli/build.rs (#3568) (#3741)
# Description of Changes

This reverts commit 53f692dec6 (#3568)

That PR broke the build if any of the directories used as templates are
not clean. It spammed lots of errors like:
```
error: `C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/client.pdb` wasn't a utf-8 file
 --> C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/client.pdb:0:49
  |

error: `C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/ref/client.dll` wasn't a utf-8 file
 --> C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/ref/client.dll:0:3
  |

error: `C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/refint/client.dll` wasn't a utf-8 file
 --> C:\Users\boppy\clockwork\SpacetimeDB\crates\cli/.templates/parent_parent_sdks_csharp_examples~_quickstart-chat_client/obj~/Debug/net8.0/refint/client.dll:0:3
```

# API and ABI breaking changes

None.

# Expected complexity level and risk

1

# Testing

- [x] `cargo build` passes on my repo now, which it wasn't before this
commit

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-24 19:09:19 +00:00
Phoebe Goldman 64606ace26 Print internal error when a procedure call fails in sdk test client (#3725)
# Description of Changes

And also add a `log::warn` call next to a `tracing::warn` call, since
our tests don't seem to report tracing output.

In response to suspicious test flake
https://github.com/clockworklabs/SpacetimeDB/actions/runs/19577977435/job/56068366154?pr=3409
.

# API and ABI breaking changes

N/a

# Expected complexity level and risk

1

# Testing

N/a
2025-11-24 17:33:00 +00:00
Piotr Sarnacki 53f692dec6 Remove the dependency on git ls-files from cli/build.rs (#3568)
# Description of Changes

We technically don't need to `git ls-files` when getting the CLI
templates because when we compile the release builds we work with a
clean git clone, thus it's unlikely any untracked files will be created
in the templates directory.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

- [x] I've manually checked that the init command still generates the
templates properly
2025-11-24 15:16:06 +00:00
Piotr Sarnacki 0491b5e8a2 Add spacetime_worker_reducer_returned_errors_total metric (#3613)
# Description of Changes

Currently, we have a metric for reducer panics called
`spacetime_worker_wasm_instance_errors_total`. This commit adds a metric
for tracking errors returned from the module, like for example an Err
result in Rust, or throwing a SenderError in TypeScript

This will be needed for the web database overview dashboard, but it
should be useful for tracking sender errors in general.

# Expected complexity level and risk

1

# Testing

- [x] I've tested the change locally verifying the counter increments
when an instance returns an error

---------

Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-11-24 14:13:19 +00:00
Piotr Sarnacki 827bb9b54f Add metrics for subscription queries (#3661)
# Description of Changes

We have some metrics measuring various lower level things like index
scans, but at the moment we have no easy way to figure out which columns
might need an index. This commit introduces three new metrics that
provide that information by labeling count, latency, and number of rows
canned along with the scan type (index scan, table scan, mixed scan) and
info about unindexed columns.
# API and ABI breaking changes

None

# Expected complexity level and risk

2

I'm honestly not sure. I don't think it's overly complex, but it adds
some overhead in the subscriptions initial query path.

# Testing

- [x] I've tested the changes locally
2025-11-24 12:59:14 +00:00
Shubham Mishra 582c846c11 Views: index readsets (#3706)
# Description of Changes
Precise index readsets

fixes #https://github.com/clockworklabs/SpacetimeDBPrivate/issues/2118

# API and ABI breaking changes
NA

# Expected complexity level and risk
2.5

Potential to regress performance.

# Testing
Updated smoketests.
2025-11-22 07:37:32 +00:00
Jason Larabie d913998f40 Add Unreal client SDK procedures (#3667)
# Description of Changes

Closes: #3535
Updated the Unreal SDK to handle procedures and procedure callbacks as
closely matched to Rust + C#.

# API and ABI breaking changes

N/A

# Expected complexity level and risk

2 - This adds a new testing frame that should be removed once procedures
are handled in /modules/sdk-test.

# Testing

Added a mirror of /sdks/unreal/tests/TestClient to use the new
/modules/sdk-test-procedure which adds complexity we'll want to remove.

- [x] Add Unreal client test of sdk-test-procedure
2025-11-22 04:39:20 +00:00
John Detter 71ff927711 Attach artifacts workflow (#3724)
# Description of Changes

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

This adds a github actions workflow for attaching artifacts to a
release. After this PR merges it can manually be invoked in the github
actions page.

# 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

1 - This can't really break anything other than the release artifacts

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

It worked when I tested it just now. Look at the release here:
https://github.com/clockworklabs/SpacetimeDB/releases
Plus you can check the job output here:
https://github.com/clockworklabs/SpacetimeDB/actions/runs/19578784486/job/56071106846?pr=3724

---------

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-22 03:36:01 +00:00
John Detter 77886a50a9 Upgrade to version 1.9.0 (#3709)
# Description of Changes

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

Upgrade to version 1.9.0.

# API and ABI breaking changes

None - just a version upgrade.

<!-- 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] I verified that the license has been updated
- [x] The version number looks correct (1.9.0)

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-22 01:22:40 +00:00
Jason Larabie 78c28d4936 Add C# client SDK procedures (#3666)
# Description of Changes

Closes: #3533 
Updated the C# SDK to handle procedures and procedure callbacks in a
similar fashion to the Rust client as well as added the codegen to
support it.

# API and ABI breaking changes

N/A

# Expected complexity level and risk

2 - This adds a new testing frame that should be removed once procedures
are handled with C# module bindings

# Testing

Added /sdks/csharp/examples~/regression-tests/procedure-client to match
modules/sdk-test-procedure which we can roll into the standard
regression-tests once C# supports the procedure attribute.

- [x] Add C# client test of sdk-test-procedure

---------

Signed-off-by: Jason Larabie <jason@clockworklabs.io>
2025-11-21 19:39:21 +00:00
Noa de142d4af9 HTTP followup: remove http dep from spacetimedb_lib (#3719)
# Description of Changes

Follow up to #3684. Moves `Error` and `Timeout` out of lib, so that we
don't have to implement `SpacetimeType` for them, and then removes the
http dependency altogether, so that `lib` can be leaner. I also got rid
of the separate `HttpValue` type, since it only really exists to mirror
the `http` crate and typescript won't make use of it.

# Expected complexity level and risk

1

# Testing

n/a - just code movement.
2025-11-21 06:01:21 +00:00
John Detter dc881f2bc9 Use custom runner for building CLI (#3716)
# Description of Changes

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

- This has 2 benefits:
1. `ubuntu-latest` recently changed to 24.04 instead of 22.04 so that
broke the last CLI on some systems. This will fix that issue.
2. Performance - this should build much much faster.

# 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

2 - if the CLI fails to build this might be why.

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

- [x] Tested via today's release:
https://github.com/clockworklabs/SpacetimeDB/actions/runs/19550648024/job/55980960439
2025-11-20 21:30:43 +00:00
Zeke Foppa 2902441898 CI - No discord ping for skipped checks (#3718)
# Description of Changes

I thought this was covered by the `NEUTRAL` case, but apparently
`SKIPPED` is separate.

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

We'll see when it merges 🤷

Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
2025-11-20 21:11:45 +00:00
Phoebe Goldman 7df8719b61 Add procedure HTTP request API for WASM modules and the Rust module bindings library (#3684)
# Description of Changes

Closes #3517 .

With this PR, procedures (at least, those defined in Rust modules) can
perform HTTP requests! This is performed through a new field on the
`ProcedureContext`, `http: HttpClient`, which has a method `send` for
sending an `http::Request`, as well as a convenience wrapper `get`.

Internally, these methods hit the `procedure_http_request` ABI call /
host function, which uses reqwest to perform an HTTP request. The
request is run with a user-configurable timeout which defaults and is
clamped to 500 ms.
Rather than exposing the HTTP stream to modules, we download the entire
response body immediately, within the same timeout.

I've added an example usage of `get` to `module-test` which performs a
request against `localhost:3000` to read its own schema/moduledef.

This PR also makes all procedure-related definitions in the Rust module
bindings library `#[cfg(feature = "unstable")]`, as per #3644 . The
rename of the `/v1/database/:name/procedure/:name` route is not included
in this PR, so this does not close #3644 .

Left as TODOs are:
- Metrics for recording request and response size.
- Improving performance by stashing a long-lived `reqwest::Client`
someplace.
  Currently we build a new `Client` for each request.
- Improving performance (possibly) by passing the request-future to the
global tokio executor
  rather than running it on the single-threaded database executor.

# API and ABI breaking changes

Adds new APIs, which are marked as unstable. Adds a new ABI, which is
not unstable in any meaningful way (we can't really do that). Marks
unreleased APIs as unstable. Does not affect any pre-existing
already-released APIs or ABIs.

# Expected complexity level and risk

3 or so: networking is scary, and even though we impose a timeout which
prevents these connections from being truly long-lived, they're still
potentially long-lived on the scale of Tokio futures. It's possible that
running them on the database core is problematic in some way, and so
what I've left as a performance TODO could actually be a
concurrency-correctness issue.

# Testing

- [x] Manually wrote and executed some procedures which make HTTP
requests.
- [x] Added two automated tests to the `sdk-test` suite,
`procedure::http_ok` and `procedure::http_err`, which make successful
and failing requests respectively, then return its result. A client then
makes some assertions about the result.

---------

Co-authored-by: Noa <coolreader18@gmail.com>
2025-11-20 20:47:35 +00:00
Tyler Cloutier 6d7b0d87ce Added staging to allowable issuers (#3714)
# Description of Changes

This modifies the environment variable that we pass in for requiring
SpacetimeAuth to publish so that we can put different issuer values for
live and staging.

# API and ABI breaking changes

This requires a new environment variable or it skips this requirement.

# Expected complexity level and risk

1

# Testing

I have not tested this change locally.

---------

Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
2025-11-20 20:32:21 +00:00