From 10c7997fb1c0c991fd4c72b4f21fa8d50cfe047f Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 08:42:53 -0700 Subject: [PATCH 01/24] [bfops/csharp-ci]: Update GitHub files for C#/Unity import --- .../workflows/csharp-test.yml | 74 +++++-------------- sdks/csharp/.github/pull_request_template.md | 21 ------ .../.github/workflows/check-pr-base.yml | 31 -------- sdks/csharp/DEVELOP.md | 4 + sdks/csharp/README.md | 3 +- 5 files changed, 25 insertions(+), 108 deletions(-) rename sdks/csharp/.github/workflows/test.yml => .github/workflows/csharp-test.yml (61%) delete mode 100644 sdks/csharp/.github/pull_request_template.md delete mode 100644 sdks/csharp/.github/workflows/check-pr-base.yml diff --git a/sdks/csharp/.github/workflows/test.yml b/.github/workflows/csharp-test.yml similarity index 61% rename from sdks/csharp/.github/workflows/test.yml rename to .github/workflows/csharp-test.yml index ef92098c090..cede0fad1ea 100644 --- a/sdks/csharp/.github/workflows/test.yml +++ b/.github/workflows/csharp-test.yml @@ -3,7 +3,7 @@ name: Test Suite on: push: branches: - - staging + - master pull_request: jobs: @@ -15,53 +15,17 @@ jobs: with: submodules: true - # Grab the SpacetimeDB branch name from the PR description. If it's not found, master will be used instead. - # We'll use this branch name for any integration tests with SpacetimeDB. - - - name: Extract SpacetimeDB branch name or PR link from PR description - id: extract-branch - if: github.event_name == 'pull_request' - env: - description: ${{ github.event.pull_request.body }} - run: | - # Check if description contains a branch name or a PR link - branch_or_pr=$(echo "$description" | grep -oP '(?<=SpacetimeDB branch name:\s).+') - echo "Branch or PR found: $branch_or_pr" - - if [[ -z "$branch_or_pr" ]]; then - branch="master" - elif [[ "$branch_or_pr" =~ ^https://github.com/.*/pull/[0-9]+$ ]]; then - # If it's a PR link, extract the branch name from the PR - pr_number=$(echo "$branch_or_pr" | grep -oP '[0-9]+$') - branch=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - https://api.github.com/repos/clockworklabs/SpacetimeDB/pulls/$pr_number | jq -r '.head.ref') - else - # It's already a branch name - branch="$branch_or_pr" - fi - - echo "branch=$branch" >> $GITHUB_OUTPUT - echo "Final branch name: $branch" - - - name: Checkout SpacetimeDB - uses: actions/checkout@v4 - id: checkout-stdb - with: - repository: clockworklabs/SpacetimeDB - ref: ${{ steps.extract-branch.outputs.branch }} - path: SpacetimeDB~ - # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. - name: Setup dotnet uses: actions/setup-dotnet@v3 with: - global-json-file: SpacetimeDB~/modules/global.json + global-json-file: modules/global.json - name: Override NuGet packages run: | - dotnet pack SpacetimeDB~/crates/bindings-csharp/BSATN.Runtime - dotnet pack SpacetimeDB~/crates/bindings-csharp/Runtime + dotnet pack crates/bindings-csharp/BSATN.Runtime + dotnet pack crates/bindings-csharp/Runtime # Write out the nuget config file to `nuget.config`. This causes the spacetimedb-csharp-sdk repository # to be aware of the local versions of the `bindings-csharp` packages in SpacetimeDB, and use them if @@ -69,31 +33,33 @@ jobs: # This means that (if version numbers match) we will test the local versions of the C# packages, even # if they're not pushed to NuGet. # See https://learn.microsoft.com/en-us/nuget/reference/nuget-config-file for more info on the config file. - ./tools~/write-nuget-config.sh SpacetimeDB~ + cd sdks/csharp + ./tools~/write-nuget-config.sh ../.. - name: Run .NET tests + working-directory: sdks/csharp run: dotnet test -warnaserror - name: Verify C# formatting + working-directory: sdks/csharp run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln # Now, setup the Unity tests. - name: Patch spacetimedb dependency in Cargo.toml - working-directory: unity-tests~/server-rust + working-directory: sdks/csharp/unity-tests~/server-rust run: | sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../SpacetimeDB~/crates/bindings\" \}|" Cargo.toml cat Cargo.toml - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - - name: Cache Rust dependencies uses: Swatinem/rust-cache@v2 id: cache-rust-deps with: - workspaces: unity-tests~/server-rust + workspaces: sdks/csharp/unity-tests~/server-rust key: ${{ steps.checkout-stdb.outputs.commit }} # Cache Rust deps even if unit tests have failed. cache-on-failure: true @@ -104,21 +70,21 @@ jobs: # Rebuild only if we didn't get a precise cache hit. if: steps.cache-rust-deps.outputs.cache-hit == 'false' run: | - cargo install --force --path SpacetimeDB~/crates/cli --locked --message-format=short - cargo install --force --path SpacetimeDB~/crates/standalone --locked --message-format=short + cargo install --force --path crates/cli --locked --message-format=short + cargo install --force --path crates/standalone --locked --message-format=short # Add a handy alias using the old binary name, so that we don't have to rewrite all scripts (incl. in submodules). ln -sf $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime env: # Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice. - CARGO_TARGET_DIR: unity-tests~/server-rust/target + CARGO_TARGET_DIR: sdks/csharp/unity-tests~/server-rust/target - name: Generate client bindings - working-directory: unity-tests~/server-rust + working-directory: sdks/csharp/unity-tests~/server-rust run: bash ./generate.sh -y - name: Check for changes run: | - git diff --exit-code unity-tests~/client-unity/Assets/Scripts/autogen || { + git diff --exit-code sdks/csharp/unity-tests~/client-unity/Assets/Scripts/autogen || { echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch." exit 1 } @@ -136,16 +102,16 @@ jobs: disown - name: Run regression tests - run: bash tools~/run-regression-tests.sh SpacetimeDB~ + run: bash sdks/csharp/tools~/run-regression-tests.sh . - name: Publish unity-tests module to SpacetimeDB - working-directory: unity-tests~/server-rust + working-directory: sdks/csharp/unity-tests~/server-rust run: | spacetime logout && spacetime login --server-issued-login local bash ./publish.sh - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json - working-directory: unity-tests~/client-unity/Packages + working-directory: sdks/csharp/unity-tests~/client-unity/Packages run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? @@ -154,7 +120,7 @@ jobs: - uses: actions/cache@v3 with: - path: unity-tests~/client-unity/Library + path: sdks/csharp/unity-tests~/client-unity/Library key: Unity-${{ github.head_ref }} restore-keys: Unity- @@ -162,7 +128,7 @@ jobs: uses: game-ci/unity-test-runner@v4 with: unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag - projectPath: unity-tests~/client-unity # Path to the Unity project subdirectory + projectPath: sdks/csharp/unity-tests~/client-unity # Path to the Unity project subdirectory githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: playmode useHostNetwork: true diff --git a/sdks/csharp/.github/pull_request_template.md b/sdks/csharp/.github/pull_request_template.md deleted file mode 100644 index 5b1874d9ceb..00000000000 --- a/sdks/csharp/.github/pull_request_template.md +++ /dev/null @@ -1,21 +0,0 @@ -## Description of Changes -*Describe what has been changed, any new features or bug fixes* - -## API - - - [ ] This is an API breaking change to the SDK - -*If the API is breaking, please state below what will break* - -## Requires SpacetimeDB PRs -*List any PRs here that are required for this SDK change to work* - -## Testsuite -*If you would like to run the your SDK changes in this PR against a specific SpacetimeDB branch, specify that here. This can be a branch name or a link to a PR.* - -SpacetimeDB branch name: master - -## Testing -*Write instructions for a test that you performed for this PR* - -- [ ] Describe a test for this PR that you have completed diff --git a/sdks/csharp/.github/workflows/check-pr-base.yml b/sdks/csharp/.github/workflows/check-pr-base.yml deleted file mode 100644 index 0f401c5bc96..00000000000 --- a/sdks/csharp/.github/workflows/check-pr-base.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Git tree checks - -on: - pull_request: - types: [opened, edited, reopened, synchronize] - -permissions: - pull-requests: write - contents: read - -jobs: - check_base_ref: - name: Release branch restriction - runs-on: ubuntu-latest - steps: - - name: Change base to master if needed - if: | - github.event_name == 'pull_request' && - github.event.pull_request.base.ref == 'release/latest' && - ! startsWith(github.event.pull_request.head.ref, 'release/') - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo 'Updating PR '"#${{ github.event.pull_request.number }}"' to use base `master`' - echo 'If you do want to release your changes directly by merging into `release/latest`, your branch must start with `release/`.' - - curl -X PATCH \ - -H "Authorization: Bearer $GITHUB_TOKEN" \ - -H "Accept: application/vnd.github+json" \ - https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} \ - -d '{"base": "master"}' diff --git a/sdks/csharp/DEVELOP.md b/sdks/csharp/DEVELOP.md index e6cb9f31e6a..9f8f56654d2 100644 --- a/sdks/csharp/DEVELOP.md +++ b/sdks/csharp/DEVELOP.md @@ -1,3 +1,7 @@ +# Migration note + +We are in the process of moving from the `com.clockworklabs.spacetimedbsdk` repo to the `sdks/csharp` subdirectory of [SpacetimeDB](https://github.com/clockworklabs/SpacetimeDB). **Any new changes should be made there**. The `com.clockworklabs.spacetimedbsdk` repo will only be updated on release. Apologies in advance for any sharp edges while the migration is in progress. + # Notes for maintainers ## `SpacetimeDB.ClientApi` diff --git a/sdks/csharp/README.md b/sdks/csharp/README.md index 6cd3173b73d..3f9e10a6ba4 100644 --- a/sdks/csharp/README.md +++ b/sdks/csharp/README.md @@ -10,5 +10,4 @@ The Unity SDK uses the same code as the C# SDK. You can find the documentation f There is also a comprehensive Unity tutorial/demo available: - [Unity Tutorial](https://spacetimedb.com/docs/unity/part-1) Doc -- [Unity Demo](https://github.com/clockworklabs/Blackholio) Repo -- \ No newline at end of file +- [Unity Demo](https://github.com/clockworklabs/SpacetimeDB/tree/master/demo/Blackholio) Repo From 0703cddc8ed10aafaa861d0dee497b3be2897239 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 08:54:42 -0700 Subject: [PATCH 02/24] [bfops/csharp-ci]: fix gitmodules? --- sdks/csharp/.gitmodules => .gitmodules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename sdks/csharp/.gitmodules => .gitmodules (74%) diff --git a/sdks/csharp/.gitmodules b/.gitmodules similarity index 74% rename from sdks/csharp/.gitmodules rename to .gitmodules index 50c54dcb4b7..dccbc267c3d 100644 --- a/sdks/csharp/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "SpacetimeDBCircleGame"] - path = unity-tests~ + path = sdks/csharp/unity-tests~ url = https://github.com/clockworklabs/SpacetimeDBCircleGame From 4dd6927a025cb9d596db27dc7514a7e032b87aa5 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 09:18:59 -0700 Subject: [PATCH 03/24] [bfops/csharp-ci]: try to use local Blackholio --- .github/workflows/csharp-test.yml | 22 ++++++++++------------ .gitmodules | 3 --- sdks/csharp/unity-tests~ | 1 - 3 files changed, 10 insertions(+), 16 deletions(-) delete mode 100644 .gitmodules delete mode 160000 sdks/csharp/unity-tests~ diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index cede0fad1ea..409a7a2d6df 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -12,8 +12,6 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - with: - submodules: true # Run cheap .NET tests first. If those fail, no need to run expensive Unity tests. @@ -47,9 +45,9 @@ jobs: # Now, setup the Unity tests. - name: Patch spacetimedb dependency in Cargo.toml - working-directory: sdks/csharp/unity-tests~/server-rust + working-directory: demo/Blackholio/server-rust run: | - sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../SpacetimeDB~/crates/bindings\" \}|" Cargo.toml + sed -i "s|spacetimedb *=.*|spacetimedb = \{ path = \"../../../crates/bindings\" \}|" Cargo.toml cat Cargo.toml - name: Install Rust toolchain @@ -59,7 +57,7 @@ jobs: uses: Swatinem/rust-cache@v2 id: cache-rust-deps with: - workspaces: sdks/csharp/unity-tests~/server-rust + workspaces: demo/Blackholio/server-rust key: ${{ steps.checkout-stdb.outputs.commit }} # Cache Rust deps even if unit tests have failed. cache-on-failure: true @@ -76,15 +74,15 @@ jobs: ln -sf $HOME/.cargo/bin/spacetimedb-cli $HOME/.cargo/bin/spacetime env: # Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice. - CARGO_TARGET_DIR: sdks/csharp/unity-tests~/server-rust/target + CARGO_TARGET_DIR: demo/Blackholio/server-rust/target - name: Generate client bindings - working-directory: sdks/csharp/unity-tests~/server-rust + working-directory: demo/Blackholio/server-rust run: bash ./generate.sh -y - name: Check for changes run: | - git diff --exit-code sdks/csharp/unity-tests~/client-unity/Assets/Scripts/autogen || { + git diff --exit-code demo/Blackholio/client-unity/Assets/Scripts/autogen || { echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch." exit 1 } @@ -105,13 +103,13 @@ jobs: run: bash sdks/csharp/tools~/run-regression-tests.sh . - name: Publish unity-tests module to SpacetimeDB - working-directory: sdks/csharp/unity-tests~/server-rust + working-directory: demo/Blackholio/server-rust run: | spacetime logout && spacetime login --server-issued-login local bash ./publish.sh - name: Patch com.clockworklabs.spacetimedbsdk dependency in manifest.json - working-directory: sdks/csharp/unity-tests~/client-unity/Packages + working-directory: demo/Blackholio/client-unity/Packages run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? @@ -120,7 +118,7 @@ jobs: - uses: actions/cache@v3 with: - path: sdks/csharp/unity-tests~/client-unity/Library + path: demo/Blackholio/client-unity/Library key: Unity-${{ github.head_ref }} restore-keys: Unity- @@ -128,7 +126,7 @@ jobs: uses: game-ci/unity-test-runner@v4 with: unityVersion: 2022.3.32f1 # Adjust Unity version to a valid tag - projectPath: sdks/csharp/unity-tests~/client-unity # Path to the Unity project subdirectory + projectPath: demo/Blackholio/client-unity # Path to the Unity project subdirectory githubToken: ${{ secrets.GITHUB_TOKEN }} testMode: playmode useHostNetwork: true diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index dccbc267c3d..00000000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "SpacetimeDBCircleGame"] - path = sdks/csharp/unity-tests~ - url = https://github.com/clockworklabs/SpacetimeDBCircleGame diff --git a/sdks/csharp/unity-tests~ b/sdks/csharp/unity-tests~ deleted file mode 160000 index c7797b68518..00000000000 --- a/sdks/csharp/unity-tests~ +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c7797b68518fa1b2441adc4dde14b05ad484e8de From 6db99efde727c13ca59fa7e05d7ce90090210e45 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 10:03:13 -0700 Subject: [PATCH 04/24] [bfops/csharp-ci]: try to fix workspace error --- demo/Blackholio/server-rust/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demo/Blackholio/server-rust/Cargo.toml b/demo/Blackholio/server-rust/Cargo.toml index 74ea840f894..55814736b0c 100644 --- a/demo/Blackholio/server-rust/Cargo.toml +++ b/demo/Blackholio/server-rust/Cargo.toml @@ -5,6 +5,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +[workspace] + [lib] crate-type = ["cdylib"] From 2459de8d3b82c55130206e8b82300624856d95ba Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 11:43:37 -0700 Subject: [PATCH 05/24] [bfops/csharp-ci]: fix the git diff of Blackholio --- .github/workflows/csharp-test.yml | 6 +- .../Scripts/autogen/Reducers/CircleDecay.g.cs | 19 ++++- .../autogen/Reducers/CircleRecombine.g.cs | 17 ++++- .../Scripts/autogen/Reducers/Connect.g.cs | 17 ++++- .../autogen/Reducers/ConsumeEntity.g.cs | 17 ++++- .../Scripts/autogen/Reducers/Disconnect.g.cs | 17 ++++- .../Scripts/autogen/Reducers/EnterGame.g.cs | 17 ++++- .../autogen/Reducers/MoveAllPlayers.g.cs | 19 ++++- .../Scripts/autogen/Reducers/PlayerSplit.g.cs | 17 ++++- .../Scripts/autogen/Reducers/Respawn.g.cs | 17 ++++- .../Scripts/autogen/Reducers/SpawnFood.g.cs | 19 ++++- .../Scripts/autogen/Reducers/Suicide.g.cs | 17 ++++- .../autogen/Reducers/UpdatePlayerInput.g.cs | 17 ++++- .../Scripts/autogen/SpacetimeDBClient.g.cs | 69 +++++++++++++++---- .../Assets/Scripts/autogen/Tables/Circle.g.cs | 2 + .../autogen/Tables/CircleDecayTimer.g.cs | 2 + .../autogen/Tables/CircleRecombineTimer.g.cs | 2 + .../Assets/Scripts/autogen/Tables/Config.g.cs | 2 + .../autogen/Tables/ConsumeEntityTimer.g.cs | 2 + .../Assets/Scripts/autogen/Tables/Entity.g.cs | 2 + .../Assets/Scripts/autogen/Tables/Food.g.cs | 2 + .../autogen/Tables/LoggedOutPlayer.g.cs | 2 + .../autogen/Tables/MoveAllPlayersTimer.g.cs | 2 + .../Assets/Scripts/autogen/Tables/Player.g.cs | 2 + .../autogen/Tables/SpawnFoodTimer.g.cs | 2 + .../Assets/Scripts/autogen/Types/Circle.g.cs | 2 + .../autogen/Types/CircleDecayTimer.g.cs | 2 + .../autogen/Types/CircleRecombineTimer.g.cs | 2 + .../Assets/Scripts/autogen/Types/Config.g.cs | 2 + .../autogen/Types/ConsumeEntityTimer.g.cs | 2 + .../Scripts/autogen/Types/DbVector2.g.cs | 2 + .../Assets/Scripts/autogen/Types/Entity.g.cs | 2 + .../Assets/Scripts/autogen/Types/Food.g.cs | 2 + .../autogen/Types/MoveAllPlayersTimer.g.cs | 2 + .../Assets/Scripts/autogen/Types/Player.g.cs | 2 + .../Scripts/autogen/Types/SpawnFoodTimer.g.cs | 2 + 36 files changed, 288 insertions(+), 41 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 409a7a2d6df..ab9204f8df3 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -82,7 +82,11 @@ jobs: - name: Check for changes run: | - git diff --exit-code demo/Blackholio/client-unity/Assets/Scripts/autogen || { + # This was copied from tools/check-diff.sh. + # It's required because `spacetime generate` creates lines with the SpacetimeDB commit + # version, which would make this `git diff` check very brittle if included. + PATTERN='^// This was generated using spacetimedb cli version.*' + git diff --exit-code --ignore-matching-lines="$PATTERN" -- demo/Blackholio/client-unity/Assets/Scripts/autogen || { echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch." exit 1 } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleDecay.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleDecay.g.cs index dc561ad3af5..c447ac50729 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleDecay.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleDecay.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void CircleDecay(CircleDecayTimer timer) public bool InvokeCircleDecay(ReducerEventContext ctx, Reducer.CircleDecay args) { - if (OnCircleDecay == null) return false; + if (OnCircleDecay == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnCircleDecay( ctx, args.Timer @@ -37,7 +50,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class CircleDecay : Reducer, IReducerArgs { - [DataMember(Name = "timer")] + [DataMember(Name = "_timer")] public CircleDecayTimer Timer; public CircleDecay(CircleDecayTimer Timer) @@ -50,7 +63,7 @@ public CircleDecay() this.Timer = new(); } - string IReducerArgs.ReducerName => "CircleDecay"; + string IReducerArgs.ReducerName => "circle_decay"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleRecombine.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleRecombine.g.cs index 5819e86e8a8..c3e7cb8c402 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleRecombine.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/CircleRecombine.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void CircleRecombine(CircleRecombineTimer timer) public bool InvokeCircleRecombine(ReducerEventContext ctx, Reducer.CircleRecombine args) { - if (OnCircleRecombine == null) return false; + if (OnCircleRecombine == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnCircleRecombine( ctx, args.Timer @@ -50,7 +63,7 @@ public CircleRecombine() this.Timer = new(); } - string IReducerArgs.ReducerName => "CircleRecombine"; + string IReducerArgs.ReducerName => "circle_recombine"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Connect.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Connect.g.cs index 7079a258424..03b6448fc3f 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Connect.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Connect.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -17,7 +19,18 @@ public sealed partial class RemoteReducers : RemoteBase public bool InvokeConnect(ReducerEventContext ctx, Reducer.Connect args) { - if (OnConnect == null) return false; + if (OnConnect == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnConnect( ctx ); @@ -31,7 +44,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class Connect : Reducer, IReducerArgs { - string IReducerArgs.ReducerName => "Connect"; + string IReducerArgs.ReducerName => "connect"; } } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/ConsumeEntity.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/ConsumeEntity.g.cs index a06bafd03eb..c730f1fd44c 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/ConsumeEntity.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/ConsumeEntity.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void ConsumeEntity(ConsumeEntityTimer request) public bool InvokeConsumeEntity(ReducerEventContext ctx, Reducer.ConsumeEntity args) { - if (OnConsumeEntity == null) return false; + if (OnConsumeEntity == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnConsumeEntity( ctx, args.Request @@ -50,7 +63,7 @@ public ConsumeEntity() this.Request = new(); } - string IReducerArgs.ReducerName => "ConsumeEntity"; + string IReducerArgs.ReducerName => "consume_entity"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Disconnect.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Disconnect.g.cs index 7943e6018a2..91f7377c06c 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Disconnect.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Disconnect.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -17,7 +19,18 @@ public sealed partial class RemoteReducers : RemoteBase public bool InvokeDisconnect(ReducerEventContext ctx, Reducer.Disconnect args) { - if (OnDisconnect == null) return false; + if (OnDisconnect == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnDisconnect( ctx ); @@ -31,7 +44,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class Disconnect : Reducer, IReducerArgs { - string IReducerArgs.ReducerName => "Disconnect"; + string IReducerArgs.ReducerName => "disconnect"; } } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/EnterGame.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/EnterGame.g.cs index 6db2cc2317d..52dd6e2927b 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/EnterGame.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/EnterGame.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void EnterGame(string name) public bool InvokeEnterGame(ReducerEventContext ctx, Reducer.EnterGame args) { - if (OnEnterGame == null) return false; + if (OnEnterGame == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnEnterGame( ctx, args.Name @@ -50,7 +63,7 @@ public EnterGame() this.Name = ""; } - string IReducerArgs.ReducerName => "EnterGame"; + string IReducerArgs.ReducerName => "enter_game"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/MoveAllPlayers.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/MoveAllPlayers.g.cs index b98d38d2ddb..2bc614a5a49 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/MoveAllPlayers.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/MoveAllPlayers.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void MoveAllPlayers(MoveAllPlayersTimer timer) public bool InvokeMoveAllPlayers(ReducerEventContext ctx, Reducer.MoveAllPlayers args) { - if (OnMoveAllPlayers == null) return false; + if (OnMoveAllPlayers == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnMoveAllPlayers( ctx, args.Timer @@ -37,7 +50,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class MoveAllPlayers : Reducer, IReducerArgs { - [DataMember(Name = "timer")] + [DataMember(Name = "_timer")] public MoveAllPlayersTimer Timer; public MoveAllPlayers(MoveAllPlayersTimer Timer) @@ -50,7 +63,7 @@ public MoveAllPlayers() this.Timer = new(); } - string IReducerArgs.ReducerName => "MoveAllPlayers"; + string IReducerArgs.ReducerName => "move_all_players"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/PlayerSplit.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/PlayerSplit.g.cs index 9063fa32be2..526264c5fa0 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/PlayerSplit.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/PlayerSplit.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void PlayerSplit() public bool InvokePlayerSplit(ReducerEventContext ctx, Reducer.PlayerSplit args) { - if (OnPlayerSplit == null) return false; + if (OnPlayerSplit == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnPlayerSplit( ctx ); @@ -36,7 +49,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class PlayerSplit : Reducer, IReducerArgs { - string IReducerArgs.ReducerName => "PlayerSplit"; + string IReducerArgs.ReducerName => "player_split"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Respawn.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Respawn.g.cs index d43bbdfc3b4..4b3bef3da36 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Respawn.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Respawn.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void Respawn() public bool InvokeRespawn(ReducerEventContext ctx, Reducer.Respawn args) { - if (OnRespawn == null) return false; + if (OnRespawn == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnRespawn( ctx ); @@ -36,7 +49,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class Respawn : Reducer, IReducerArgs { - string IReducerArgs.ReducerName => "Respawn"; + string IReducerArgs.ReducerName => "respawn"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/SpawnFood.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/SpawnFood.g.cs index 825d1ffe7a4..93a85902331 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/SpawnFood.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/SpawnFood.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void SpawnFood(SpawnFoodTimer timer) public bool InvokeSpawnFood(ReducerEventContext ctx, Reducer.SpawnFood args) { - if (OnSpawnFood == null) return false; + if (OnSpawnFood == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnSpawnFood( ctx, args.Timer @@ -37,7 +50,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class SpawnFood : Reducer, IReducerArgs { - [DataMember(Name = "timer")] + [DataMember(Name = "_timer")] public SpawnFoodTimer Timer; public SpawnFood(SpawnFoodTimer Timer) @@ -50,7 +63,7 @@ public SpawnFood() this.Timer = new(); } - string IReducerArgs.ReducerName => "SpawnFood"; + string IReducerArgs.ReducerName => "spawn_food"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Suicide.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Suicide.g.cs index 59dc9b5f2e1..ec98a781441 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Suicide.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/Suicide.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void Suicide() public bool InvokeSuicide(ReducerEventContext ctx, Reducer.Suicide args) { - if (OnSuicide == null) return false; + if (OnSuicide == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnSuicide( ctx ); @@ -36,7 +49,7 @@ public abstract partial class Reducer [DataContract] public sealed partial class Suicide : Reducer, IReducerArgs { - string IReducerArgs.ReducerName => "Suicide"; + string IReducerArgs.ReducerName => "suicide"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/UpdatePlayerInput.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/UpdatePlayerInput.g.cs index d1dfbfd977f..1d4dc7c3613 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/UpdatePlayerInput.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Reducers/UpdatePlayerInput.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -22,7 +24,18 @@ public void UpdatePlayerInput(DbVector2 direction) public bool InvokeUpdatePlayerInput(ReducerEventContext ctx, Reducer.UpdatePlayerInput args) { - if (OnUpdatePlayerInput == null) return false; + if (OnUpdatePlayerInput == null) + { + if (InternalOnUnhandledReducerError != null) + { + switch (ctx.Event.Status) + { + case Status.Failed(var reason): InternalOnUnhandledReducerError(ctx, new Exception(reason)); break; + case Status.OutOfEnergy(var _): InternalOnUnhandledReducerError(ctx, new Exception("out of energy")); break; + } + } + return false; + } OnUpdatePlayerInput( ctx, args.Direction @@ -50,7 +63,7 @@ public UpdatePlayerInput() this.Direction = new(); } - string IReducerArgs.ReducerName => "UpdatePlayerInput"; + string IReducerArgs.ReducerName => "update_player_input"; } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs index 3ba835f5d8c..54064d769c0 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; @@ -14,6 +16,7 @@ public sealed partial class RemoteReducers : RemoteBase { internal RemoteReducers(DbConnection conn, SetReducerFlags flags) : base(conn) => SetCallReducerFlags = flags; internal readonly SetReducerFlags SetCallReducerFlags; + internal event Action? InternalOnUnhandledReducerError; } public sealed partial class RemoteTables : RemoteTablesBase @@ -36,7 +39,10 @@ public RemoteTables(DbConnection conn) public sealed partial class SetReducerFlags { } - public interface IRemoteDbContext : IDbContext { } + public interface IRemoteDbContext : IDbContext + { + public event Action? OnUnhandledReducerError; + } public sealed class EventContext : IEventContext, IRemoteDbContext { @@ -98,6 +104,14 @@ public void Disconnect() /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; + /// + /// Register a callback to be called when a reducer with no handler returns an error. + /// + public event Action? OnUnhandledReducerError + { + add => Reducers.InternalOnUnhandledReducerError += value; + remove => Reducers.InternalOnUnhandledReducerError -= value; + } internal EventContext(DbConnection conn, Event Event) { @@ -165,6 +179,14 @@ public void Disconnect() /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; + /// + /// Register a callback to be called when a reducer with no handler returns an error. + /// + public event Action? OnUnhandledReducerError + { + add => Reducers.InternalOnUnhandledReducerError += value; + remove => Reducers.InternalOnUnhandledReducerError -= value; + } internal ReducerEventContext(DbConnection conn, ReducerEvent reducerEvent) { @@ -239,6 +261,14 @@ public void Disconnect() /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; + /// + /// Register a callback to be called when a reducer with no handler returns an error. + /// + public event Action? OnUnhandledReducerError + { + add => Reducers.InternalOnUnhandledReducerError += value; + remove => Reducers.InternalOnUnhandledReducerError -= value; + } internal ErrorContext(DbConnection conn, Exception error) { @@ -302,6 +332,14 @@ public void Disconnect() /// Get this connection's ConnectionId. /// public ConnectionId ConnectionId => conn.ConnectionId; + /// + /// Register a callback to be called when a reducer with no handler returns an error. + /// + public event Action? OnUnhandledReducerError + { + add => Reducers.InternalOnUnhandledReducerError += value; + remove => Reducers.InternalOnUnhandledReducerError -= value; + } internal SubscriptionEventContext(DbConnection conn) { @@ -439,18 +477,18 @@ protected override Reducer ToReducer(TransactionUpdate update) var encodedArgs = update.ReducerCall.Args; return update.ReducerCall.ReducerName switch { - "CircleDecay" => BSATNHelpers.Decode(encodedArgs), - "CircleRecombine" => BSATNHelpers.Decode(encodedArgs), - "Connect" => BSATNHelpers.Decode(encodedArgs), - "ConsumeEntity" => BSATNHelpers.Decode(encodedArgs), - "Disconnect" => BSATNHelpers.Decode(encodedArgs), - "EnterGame" => BSATNHelpers.Decode(encodedArgs), - "MoveAllPlayers" => BSATNHelpers.Decode(encodedArgs), - "PlayerSplit" => BSATNHelpers.Decode(encodedArgs), - "Respawn" => BSATNHelpers.Decode(encodedArgs), - "SpawnFood" => BSATNHelpers.Decode(encodedArgs), - "Suicide" => BSATNHelpers.Decode(encodedArgs), - "UpdatePlayerInput" => BSATNHelpers.Decode(encodedArgs), + "circle_decay" => BSATNHelpers.Decode(encodedArgs), + "circle_recombine" => BSATNHelpers.Decode(encodedArgs), + "connect" => BSATNHelpers.Decode(encodedArgs), + "consume_entity" => BSATNHelpers.Decode(encodedArgs), + "disconnect" => BSATNHelpers.Decode(encodedArgs), + "enter_game" => BSATNHelpers.Decode(encodedArgs), + "move_all_players" => BSATNHelpers.Decode(encodedArgs), + "player_split" => BSATNHelpers.Decode(encodedArgs), + "respawn" => BSATNHelpers.Decode(encodedArgs), + "spawn_food" => BSATNHelpers.Decode(encodedArgs), + "suicide" => BSATNHelpers.Decode(encodedArgs), + "update_player_input" => BSATNHelpers.Decode(encodedArgs), var reducer => throw new ArgumentOutOfRangeException("Reducer", $"Unknown reducer {reducer}") }; } @@ -489,5 +527,10 @@ protected override bool Dispatch(IReducerEventContext context, Reducer reducer) } public SubscriptionBuilder SubscriptionBuilder() => new(this); + public event Action OnUnhandledReducerError + { + add => Reducers.InternalOnUnhandledReducerError += value; + remove => Reducers.InternalOnUnhandledReducerError -= value; + } } } diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Circle.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Circle.g.cs index 391d3727b78..7492464f557 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Circle.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Circle.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs index db8fe6a8373..d9008d835e2 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleDecayTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleRecombineTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleRecombineTimer.g.cs index aa64283f0fd..f535d853087 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleRecombineTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/CircleRecombineTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Config.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Config.g.cs index 8c8b5a79743..af5b3871de0 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Config.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Config.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/ConsumeEntityTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/ConsumeEntityTimer.g.cs index 335a6674868..070d6e744ca 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/ConsumeEntityTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/ConsumeEntityTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Entity.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Entity.g.cs index 0404666a069..290aeb2b369 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Entity.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Entity.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Food.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Food.g.cs index ee7b5fc4356..2ebfe844a8d 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Food.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Food.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/LoggedOutPlayer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/LoggedOutPlayer.g.cs index 71ac0a7832d..ca36a46d3e1 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/LoggedOutPlayer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/LoggedOutPlayer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/MoveAllPlayersTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/MoveAllPlayersTimer.g.cs index 105dd8e2a14..1fd98eebd24 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/MoveAllPlayersTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/MoveAllPlayersTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Player.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Player.g.cs index 8934ec93194..9b792f6c8e9 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Player.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/Player.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/SpawnFoodTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/SpawnFoodTimer.g.cs index 98d97340c04..34fb4e058f2 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/SpawnFoodTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Tables/SpawnFoodTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Circle.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Circle.g.cs index 2afa3afe79b..e9b886a8ad7 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Circle.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Circle.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleDecayTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleDecayTimer.g.cs index 922691cdbee..632305190dc 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleDecayTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleDecayTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleRecombineTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleRecombineTimer.g.cs index 0c370499a5b..713de4d19f8 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleRecombineTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/CircleRecombineTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Config.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Config.g.cs index c7c0d766860..c331df9b59e 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Config.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Config.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/ConsumeEntityTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/ConsumeEntityTimer.g.cs index cf120601bd0..9e8fe78e7d2 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/ConsumeEntityTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/ConsumeEntityTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/DbVector2.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/DbVector2.g.cs index c8667485ab6..ded362d5cea 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/DbVector2.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/DbVector2.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Entity.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Entity.g.cs index 578a64bdfca..36b59b9eee9 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Entity.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Entity.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Food.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Food.g.cs index 7b56ec0d1a7..9ca34adfda8 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Food.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Food.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/MoveAllPlayersTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/MoveAllPlayersTimer.g.cs index a9232130384..1b095fc06b2 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/MoveAllPlayersTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/MoveAllPlayersTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Player.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Player.g.cs index 5e9176c4293..1ea6f67004f 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Player.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/Player.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/SpawnFoodTimer.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/SpawnFoodTimer.g.cs index 90d0fc058b9..f8357fcf9dd 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/SpawnFoodTimer.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/Types/SpawnFoodTimer.g.cs @@ -1,6 +1,8 @@ // THIS FILE IS AUTOMATICALLY GENERATED BY SPACETIMEDB. EDITS TO THIS FILE // WILL NOT BE SAVED. MODIFY TABLES IN YOUR MODULE SOURCE CODE INSTEAD. +// This was generated using spacetimedb cli version 1.2.0 (commit ). + #nullable enable using System; From 5adaaa0e0c8f719eeb8d0650a9d0bb53d1eb6c5d Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 11:47:29 -0700 Subject: [PATCH 06/24] [bfops/csharp-ci]: fix generated whitespace --- .../Assets/Scripts/autogen/SpacetimeDBClient.g.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs index 54064d769c0..1ced03e5037 100644 --- a/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs +++ b/demo/Blackholio/client-unity/Assets/Scripts/autogen/SpacetimeDBClient.g.cs @@ -394,11 +394,11 @@ Action callback /// /// Subscribe to the following SQL queries. - /// + /// /// This method returns immediately, with the data not yet added to the DbConnection. /// The provided callbacks will be invoked once the data is returned from the remote server. /// Data from all the provided queries will be returned at the same time. - /// + /// /// See the SpacetimeDB SQL docs for more information on SQL syntax: /// https://spacetimedb.com/docs/sql /// From ddb50c058223dc30d59047412a527eb87d91f2bc Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 11:54:35 -0700 Subject: [PATCH 07/24] [bfops/csharp-ci]: fix dangling meta file check --- .github/workflows/csharp-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index ab9204f8df3..235f2fc9f67 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -95,6 +95,7 @@ jobs: uses: DeNA/unity-meta-check@v3 with: enable_pr_comment: ${{ github.event_name == 'pull_request' }} + target_path: sdks/csharp env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" From 18d57689d990d3f9f3176a5baed79ff439d57800 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 11:56:56 -0700 Subject: [PATCH 08/24] [bfops/csharp-ci]: cleanups --- .github/workflows/ci.yml | 56 ------------------------------- .github/workflows/csharp-test.yml | 2 +- 2 files changed, 1 insertion(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0de3213dbb..873613afe19 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -113,62 +113,6 @@ jobs: working-directory: crates/bindings-csharp run: dotnet test -warnaserror - sdk_test: - name: SDK Tests - runs-on: spacetimedb-runner - steps: - - name: Find Git ref - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - PR_NUMBER="${{ github.event.inputs.pr_number || null }}" - if test -n "${PR_NUMBER}"; then - GIT_REF="$( gh pr view --repo clockworklabs/SpacetimeDB $PR_NUMBER --json headRefName --jq .headRefName )" - else - GIT_REF="${{ github.ref }}" - fi - echo "GIT_REF=${GIT_REF}" >>"$GITHUB_ENV" - - - name: Checkout sources - uses: actions/checkout@v4 - with: - ref: ${{ env.GIT_REF }} - - - uses: dsherret/rust-toolchain-file@v1 - - - uses: actions/setup-dotnet@v3 - with: - global-json-file: modules/global.json - - - name: Create /stdb dir - run: | - sudo mkdir /stdb - sudo chmod 777 /stdb - - - name: Checkout C# SDK - uses: actions/checkout@v4 - with: - repository: clockworklabs/spacetimedb-csharp-sdk - ref: master - path: spacetimedb-csharp-sdk - - - name: Setup NuGet override for C# SDK - working-directory: spacetimedb-csharp-sdk - run: | - dotnet pack ../crates/bindings-csharp/BSATN.Runtime - # The SDK package overrides the following crate for use in their tests. - # Even though it doesn't actually depend on it, we still need to pack it - # so dotnet doesn't complain. - dotnet pack ../crates/bindings-csharp/Runtime - ./tools~/write-nuget-config.sh .. - - # clear package caches, so we get fresh ones even if version numbers haven't changed - dotnet nuget locals all --clear - - - name: Run C# SDK tests - working-directory: spacetimedb-csharp-sdk - run: dotnet test - lints: name: Lints runs-on: spacetimedb-runner diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 235f2fc9f67..0d11aedf564 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -1,4 +1,4 @@ -name: Test Suite +name: C#/Unity - Test Suite on: push: From c82412b99edf55067076aeaf90059d44392ec42c Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 12:02:14 -0700 Subject: [PATCH 09/24] [bfops/csharp-ci]: comment --- demo/Blackholio/server-rust/Cargo.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/demo/Blackholio/server-rust/Cargo.toml b/demo/Blackholio/server-rust/Cargo.toml index 55814736b0c..1acb7c7f811 100644 --- a/demo/Blackholio/server-rust/Cargo.toml +++ b/demo/Blackholio/server-rust/Cargo.toml @@ -5,6 +5,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html +# Put this in an empty workspace. This is required because we're nested under the SpacetimeDB root +# dir, which has its own workspace `Cargo.toml`, and this shouldn't think it's a part of that. [workspace] [lib] From 254384d3047e3d122d56238817568856e6f8e8ab Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 15:29:21 -0700 Subject: [PATCH 10/24] [bfops/csharp-ci]: maybe fix path dependency --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 0d11aedf564..fa24ecc4b54 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -118,7 +118,7 @@ jobs: run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git#${{ github.head_ref }}"' manifest.json + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "../../../sdks/csharp"' manifest.json cat manifest.json - uses: actions/cache@v3 From 30f6481a2c40dbbef4ef8196c534923bf9d88ade Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Thu, 17 Jul 2025 15:38:52 -0700 Subject: [PATCH 11/24] [bfops/csharp-ci]: I think fix --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index fa24ecc4b54..c2d736934f2 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -118,7 +118,7 @@ jobs: run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "../../../sdks/csharp"' manifest.json + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "file:../../../../sdks/csharp"' manifest.json cat manifest.json - uses: actions/cache@v3 From a65b20947483b152158be5bbd70b552962b6f078 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:24:21 -0700 Subject: [PATCH 12/24] [bfops/csharp-ci]: try adding a dotnet pack? --- .github/workflows/csharp-test.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index c2d736934f2..3a69fbfa200 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -44,6 +44,10 @@ jobs: # Now, setup the Unity tests. + - name: Pack Unity packages + working-directory: sdks/csharp + run: dotnet pack + - name: Patch spacetimedb dependency in Cargo.toml working-directory: demo/Blackholio/server-rust run: | From b7763fd217ad82b261d76b9acfb2bed13f9321e9 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:31:06 -0700 Subject: [PATCH 13/24] [bfops/csharp-ci]: maybe fix? --- .github/workflows/csharp-test.yml | 4 ++-- demo/Blackholio/client-unity/Packages/manifest.json | 2 +- demo/Blackholio/client-unity/Packages/packages-lock.json | 9 ++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 3a69fbfa200..a8eac8deb75 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -44,9 +44,9 @@ jobs: # Now, setup the Unity tests. - - name: Pack Unity packages + - name: Refresh DLLs working-directory: sdks/csharp - run: dotnet pack + run: dotnet restore - name: Patch spacetimedb dependency in Cargo.toml working-directory: demo/Blackholio/server-rust diff --git a/demo/Blackholio/client-unity/Packages/manifest.json b/demo/Blackholio/client-unity/Packages/manifest.json index 648ae6519da..5af5941fae7 100644 --- a/demo/Blackholio/client-unity/Packages/manifest.json +++ b/demo/Blackholio/client-unity/Packages/manifest.json @@ -1,6 +1,6 @@ { "dependencies": { - "com.clockworklabs.spacetimedbsdk": "https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk.git", + "com.clockworklabs.spacetimedbsdk": "file:../../../../sdks/csharp", "com.unity.collab-proxy": "2.3.1", "com.unity.feature.2d": "2.0.1", "com.unity.ide.rider": "3.0.28", diff --git a/demo/Blackholio/client-unity/Packages/packages-lock.json b/demo/Blackholio/client-unity/Packages/packages-lock.json index 9f516820bd0..fc3a00d65ea 100644 --- a/demo/Blackholio/client-unity/Packages/packages-lock.json +++ b/demo/Blackholio/client-unity/Packages/packages-lock.json @@ -1,11 +1,10 @@ { "dependencies": { "com.clockworklabs.spacetimedbsdk": { - "version": "git@github.com:clockworklabs/com.clockworklabs.spacetimedbsdk.git#staging", + "version": "file:../../../../sdks/csharp", "depth": 0, - "source": "git", - "dependencies": {}, - "hash": "812e7c3e014005d31a5af41097b9c64a04c8c7df" + "source": "local", + "dependencies": {} }, "com.unity.2d.animation": { "version": "9.1.1", @@ -587,4 +586,4 @@ } } } -} \ No newline at end of file +} From b19f09dc051370ba5a4501480b3b8d5181681b91 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:32:09 -0700 Subject: [PATCH 14/24] [bfops/csharp-ci]: add debug info --- .github/workflows/csharp-test.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index a8eac8deb75..49d02c548c5 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -131,6 +131,10 @@ jobs: key: Unity-${{ github.head_ref }} restore-keys: Unity- + - name: Git status + run: | + git status + - name: Run Unity tests uses: game-ci/unity-test-runner@v4 with: @@ -143,3 +147,7 @@ jobs: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} + + - name: Git status + run: | + git status From 69be03978184fb3fd3adade09c932a2fbad76930 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:37:59 -0700 Subject: [PATCH 15/24] [bfops/csharp-ci]: debugging changes --- .github/workflows/csharp-test.yml | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 49d02c548c5..c58c530c3a3 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -34,13 +34,14 @@ jobs: cd sdks/csharp ./tools~/write-nuget-config.sh ../.. - - name: Run .NET tests - working-directory: sdks/csharp - run: dotnet test -warnaserror - - - name: Verify C# formatting - working-directory: sdks/csharp - run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln + # temporarily commented out to speed up debugging + # - name: Run .NET tests + # working-directory: sdks/csharp + # run: dotnet test -warnaserror + # + # - name: Verify C# formatting + # working-directory: sdks/csharp + # run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln # Now, setup the Unity tests. @@ -108,8 +109,9 @@ jobs: spacetime start & disown - - name: Run regression tests - run: bash sdks/csharp/tools~/run-regression-tests.sh . + # temporarily commented out to speed up debugging + # - name: Run regression tests + # run: bash sdks/csharp/tools~/run-regression-tests.sh . - name: Publish unity-tests module to SpacetimeDB working-directory: demo/Blackholio/server-rust From 7f24d3c28a4034d007cf773fe585488180857dfa Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:42:05 -0700 Subject: [PATCH 16/24] [bfops/csharp-ci]: more debug info --- .github/workflows/csharp-test.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index c58c530c3a3..5eb60c12bf8 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -34,6 +34,11 @@ jobs: cd sdks/csharp ./tools~/write-nuget-config.sh ../.. + - name: Git status + run: | + git status + git diff + # temporarily commented out to speed up debugging # - name: Run .NET tests # working-directory: sdks/csharp @@ -85,6 +90,11 @@ jobs: working-directory: demo/Blackholio/server-rust run: bash ./generate.sh -y + - name: Git status + run: | + git status + git diff + - name: Check for changes run: | # This was copied from tools/check-diff.sh. @@ -136,6 +146,7 @@ jobs: - name: Git status run: | git status + git diff - name: Run Unity tests uses: game-ci/unity-test-runner@v4 @@ -153,3 +164,4 @@ jobs: - name: Git status run: | git status + git diff From 7927b6497c36f5b8cfc5c05cbee8299fa0fba636 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 17:46:22 -0700 Subject: [PATCH 17/24] [bfops/csharp-ci]: more debug info --- .github/workflows/csharp-test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 5eb60c12bf8..a58a9f5a1b5 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -54,6 +54,11 @@ jobs: working-directory: sdks/csharp run: dotnet restore + - name: Git status + run: | + git status + git diff + - name: Patch spacetimedb dependency in Cargo.toml working-directory: demo/Blackholio/server-rust run: | @@ -86,6 +91,11 @@ jobs: # Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice. CARGO_TARGET_DIR: demo/Blackholio/server-rust/target + - name: Git status + run: | + git status + git diff + - name: Generate client bindings working-directory: demo/Blackholio/server-rust run: bash ./generate.sh -y From 2ffd78db3bb4abca94f7150dac5b4b9f7c2b3e1c Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:03:51 -0700 Subject: [PATCH 18/24] [bfops/csharp-ci]: don't dotnet restore --- .github/workflows/csharp-test.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index a58a9f5a1b5..ebcd0938217 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -50,10 +50,6 @@ jobs: # Now, setup the Unity tests. - - name: Refresh DLLs - working-directory: sdks/csharp - run: dotnet restore - - name: Git status run: | git status From b24234b0b4723398a521f71c95ca397077fa9a94 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:08:14 -0700 Subject: [PATCH 19/24] [bfops/csharp-ci]: use remote repo path again --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index ebcd0938217..64f4b525c24 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -140,7 +140,7 @@ jobs: run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "file:../../../../sdks/csharp"' manifest.json + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp"' manifest.json cat manifest.json - uses: actions/cache@v3 From 87b4643ac502c0c2dd04db5935e567b68eb0c743 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:10:27 -0700 Subject: [PATCH 20/24] [bfops/csharp-ci]: empty From f884cc3ae643feddd2629beb7604bf6891923f29 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:15:26 -0700 Subject: [PATCH 21/24] [bfops/csharp-ci]: undo debugging changes --- .github/workflows/csharp-test.yml | 50 ++++++------------------------- 1 file changed, 9 insertions(+), 41 deletions(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 64f4b525c24..85cba2c813b 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -34,27 +34,16 @@ jobs: cd sdks/csharp ./tools~/write-nuget-config.sh ../.. - - name: Git status - run: | - git status - git diff - - # temporarily commented out to speed up debugging - # - name: Run .NET tests - # working-directory: sdks/csharp - # run: dotnet test -warnaserror - # - # - name: Verify C# formatting - # working-directory: sdks/csharp - # run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln + - name: Run .NET tests + working-directory: sdks/csharp + run: dotnet test -warnaserror + + - name: Verify C# formatting + working-directory: sdks/csharp + run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln # Now, setup the Unity tests. - - name: Git status - run: | - git status - git diff - - name: Patch spacetimedb dependency in Cargo.toml working-directory: demo/Blackholio/server-rust run: | @@ -87,20 +76,10 @@ jobs: # Share the target directory with our local project to avoid rebuilding same SpacetimeDB crates twice. CARGO_TARGET_DIR: demo/Blackholio/server-rust/target - - name: Git status - run: | - git status - git diff - - name: Generate client bindings working-directory: demo/Blackholio/server-rust run: bash ./generate.sh -y - - name: Git status - run: | - git status - git diff - - name: Check for changes run: | # This was copied from tools/check-diff.sh. @@ -125,9 +104,8 @@ jobs: spacetime start & disown - # temporarily commented out to speed up debugging - # - name: Run regression tests - # run: bash sdks/csharp/tools~/run-regression-tests.sh . + - name: Run regression tests + run: bash sdks/csharp/tools~/run-regression-tests.sh . - name: Publish unity-tests module to SpacetimeDB working-directory: demo/Blackholio/server-rust @@ -149,11 +127,6 @@ jobs: key: Unity-${{ github.head_ref }} restore-keys: Unity- - - name: Git status - run: | - git status - git diff - - name: Run Unity tests uses: game-ci/unity-test-runner@v4 with: @@ -166,8 +139,3 @@ jobs: UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }} UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }} UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }} - - - name: Git status - run: | - git status - git diff From 10543eba27a0ec329dcba1806832bfc3e57a9b08 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:17:02 -0700 Subject: [PATCH 22/24] [bfops/csharp-ci]: use ref again --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 85cba2c813b..0d8710e3133 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -118,7 +118,7 @@ jobs: run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? - yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp"' manifest.json + yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json cat manifest.json - uses: actions/cache@v3 From ec37c6d5128f21b32808f0e1e2824a4e011fc052 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:17:55 -0700 Subject: [PATCH 23/24] [bfops/csharp-ci]: update comment --- .github/workflows/csharp-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 0d8710e3133..33bb5c5e8d1 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -117,7 +117,8 @@ jobs: working-directory: demo/Blackholio/client-unity/Packages run: | # Replace the com.clockworklabs.spacetimedbsdk dependency with the current branch. - # TODO: find out why pointing to a local directory doesn't work - is it because Unity CI action uses Docker? + # Note: Pointing to a local directory does not work, because our earlier steps nuke our meta files, which then causes Unity to not properly respect the DLLs (e.g. + # codegen does not work properly). yq e -i '.dependencies["com.clockworklabs.spacetimedbsdk"] = "https://github.com/clockworklabs/SpacetimeDB.git?path=sdks/csharp#${{ github.head_ref }}"' manifest.json cat manifest.json From 7e3512666cb96f45d8ce01f0bdfe3cc83e8bd686 Mon Sep 17 00:00:00 2001 From: Zeke Foppa Date: Fri, 18 Jul 2025 18:18:34 -0700 Subject: [PATCH 24/24] [bfops/csharp-ci]: fix whitespace --- .github/workflows/csharp-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/csharp-test.yml b/.github/workflows/csharp-test.yml index 33bb5c5e8d1..befeefe728c 100644 --- a/.github/workflows/csharp-test.yml +++ b/.github/workflows/csharp-test.yml @@ -37,7 +37,7 @@ jobs: - name: Run .NET tests working-directory: sdks/csharp run: dotnet test -warnaserror - + - name: Verify C# formatting working-directory: sdks/csharp run: dotnet format --no-restore --verify-no-changes SpacetimeDB.ClientSDK.sln