Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.0 #245

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft

Release v1.0.0 #245

wants to merge 18 commits into from

Conversation

bfops
Copy link
Collaborator

@bfops bfops commented Feb 12, 2025

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

RReverser and others added 18 commits January 16, 2025 17:29
## Description of Changes

Looks like client API bindings haven't been regenerated in a while, and
this is a necessary precursor to the new subscription work. This PR
fixes the generation script, regenerates the bindings and updates
affected code.

## 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: v1.0.0-rc3

## Testing
*Write instructions for a test that you performed for this PR*

- [x] Ran regular `dotnet test`.
- [x] Checked Unity tests via CI.
## Description of Changes

This unifies various CI task into a single config that checks out the
referenced SpacetimeDB branch only once and using the same PR parsing
code (previously used only in Unity), and then runs all the builds and
tests against it. That is, .NET test, server module and Unity tests are
now all consistently overridden to point to the same SpacetimeDB.

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

- [x] Lots of CI testing and tweaking until all of existing CI tests
started working again; ensured .NET tests are executed as expected
against the specified branch name.
## Description of Changes

As proposed. No upstream codegen changes needed :)

## API

 - [x] This is an API breaking change to the SDK

*If the API is breaking, please state below what will break*
The subscription API is slightly different.

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2111

## Testsuite

SpacetimeDB branch name: jsdt/subscribe-sdk-3

## Testing
So far I have performed manual testing with the chat example. Working on
updating the unity and unit tests.

- [ ] Describe a test for this PR that you have completed
## Description of Changes
Bump the version and include the DLLs from the corresponding NuGet
packages / SpacetimeDB version.

## API

 - [ ] This is an API breaking change to the SDK

I believe not?

## Requires SpacetimeDB PRs
I believe this requires tag `v1.0.0-rc3-hotfix3`

## 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: v1.0.0-rc3-hotfix3

## Testing
Only automated testing, since this itself is just a version bump.

---------

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
Remove the `-hotfix*` part of the version in our trunk branch.

It was a (my) mistake to merge a `-hotfix*` version change. Hotfixes
are, by definition, cherry-picked changes that are going to be released
directly to users without merging.

The consequence of merging this change was that the `SDK Tests` CI job
started failing on SpacetimeDB PRs (e.g. see failures on
clockworklabs/SpacetimeDB#2137), because it
checks out this repo, which then tried to use the `-hotifx3` version of
SpacetimeDB. But the `master` branch of SpacetimeDB is at `1.0.0-rc3`
(no hotfix), because the hotfix was correctly released from a branch
without merging in that repo.

Although this PR reverts the version change, we do still have a tag
`v1.0.0-rc3-hotfix3` that we can use to release the hotfix version (by
`git push -f origin v1.0.0-rc3-hotfix3:master`) if/when desired.

## API

 - [ ] This is an API breaking change to the SDK

No

## Requires SpacetimeDB PRs
Should work with `master`.

## 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
I claim that the CI tests passing with `master` show that this is
correct. The original version change itself passed CI because it was
pointing at a non-`master` branch for testing. I claim it would have
failed if it were tested against SpacetimeDB `master`.

Generally, this might point to a bug in how we've done this CI: We
should probably only allow a PR to merge in this repo if it tests
successfully against SpacetimeDB `master`, even if we want to point it
at other branches to test in the meantime.

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
Revert DLLs, which I should have done in
#223.

See that PR for background on why it was necessary.

## API

 - [ ] This is an API breaking change to the SDK

Kinda, but it's a revert.

## Requires SpacetimeDB PRs
*List any PRs here that are required for this SDK change to work*

## Testsuite
SpacetimeDB branch name: master

## Testing
I would have liked to say that the current CI is sufficient as I did in
the last PR, but now I no longer feel confident.. Currently the repo is
in a somewhat inconsistent state, though, so I think we should merge
this right now as it will not make it _less_ consistent.

I'm very open to suggestions about how to test this properly.

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
Corresponding change to
clockworklabs/SpacetimeDB#2177. See that PR for
more details.

~~Note that this PR only bumps the versions, but does **not** update the
DLLs. This is because SpacetimeDB will likely have further changes, so
the DLLs will just need to be updated again (in principle, they should
be updated every time we push to SpacetimeDB `master`, which isn't
really feasible. For this reason, users should not use `staging` without
having their own copy of the SpacetimeDB repo as well).~~

## API

 - [ ] This is an API breaking change to the SDK

No breaking changes.

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2177

## Testsuite
SpacetimeDB branch name: master

## Testing
- [x] CI passes with that branch name
- [x] The branch name has been changed back to `master` after that PR
merges and CI still passes

---------

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes

Use SpacetimeDB commit hash in the cache key and skip
rebuild/reinstallation altogether if we got an exact hit.

This saves 6-8 minutes off CI time on reruns.

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

- [x] CI testing forth and back until it worked correctly.
## Description of Changes

This is the companion PR for
clockworklabs/SpacetimeDB#2184, please see the
other PR for full description.

On the client side main changes are:

- Regenerate .NET and Unity test client bindings and test snapshot.
- Remove `IDatabaseRow` since V9 multi-tables splits data types from
actual table definitions, so those "table data types" are no longer
special. Just using `IStructuralReadWrite` in its place now.
- Add base index classes as mentioned in the other PR.
- As a sub-improvement, the non-unique index class actually does
indexing instead of iterating over the entire table like we did before.
- Remove internal-but-not-really `InternalInvokeValueDeleted` and
`InternalInvokeValueInserted` methods in favour of private events.

## API

 - [x] This is an API breaking change to the SDK

Removes some technically-visible but internal APIs.

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2184

## 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: ingvar/csharp-new-codegen

## Testing
*Write instructions for a test that you performed for this PR*

- [x] Manually tested Blackholio

---------

Co-authored-by: James Gilles <[email protected]>
## Description of Changes

Unfortunately, none of our tests currently cover this, but while working
on the V9 upgrade, I noticed that this code still relies on `type(Row)`
as a unique table identifier.

That no longer holds with multi-tables as several tables can share the
same `Row` type. In that case, subscription updates would be grouped
incorrectly and always applied to the same first table that uses `Row`
for its data storage.

This PR fixes that by using the table handle itself as a key (compared
by reference).

If transaction updates are already grouped uniquely by table, it should
be possible to simplify this code much further, but I'm not sure if such
guarantee exists, so leaving that untouched.

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

- [x] I did `dotnet test`, but as mentioned in the description, this
requires adding tests for multi-table subscriptions, which I'm afraid I
won't have time to do, so have to leave to follow-up devs.

---------

Co-authored-by: james gilles <[email protected]>
## Description of Changes

C# part of clockworklabs/SpacetimeDB#1836
Needs to be rebased onto
#220
once that is merged.

## API

 - [x] This is an API breaking change to the SDK

ScheduleAt is now constructed in slightly different ways.

## 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: phoebe/timestamp-special-type

## Testing
Will need an update to blackholio as well.
## Description of Changes
clockworklabs/SpacetimeDB#2226

## API

 - [x] This is an API breaking change to the SDK

callbacks are better

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2226

## Testsuite

SpacetimeDB branch name: jgilles/csharp-better-events

## Testing

- [x] quickstart
- [x] blackholio
## Description of Changes
This seems to fix the unity testsuite, which otherwise is failing when
pointed at master.

## API

No breaking changes.

## Requires SpacetimeDB PRs
None

## Testsuite
This is meant to fix pointing at master.

SpacetimeDB branch name: master

## Testing
- [x] Unity testsuite now passes

---------

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes

Companion to [Rename `Address` to
`ConnectionId`](clockworklabs/SpacetimeDB#2220).
See that PR's description for more.

Like all the SDKs, this PR does not change the SDK's behavior; the SDK
still generates a connection ID locally and passes it through the HTTP
API. This is not exposed to users, and can be changed in a follow-up.

Also, use `/usr/bin/env bash` instead of `/bin/bash` in tools, for
portability reasons.

## API

 - [x] This is an API breaking change to the SDK

`Address` is renamed to `ConnectionId`.

## Requires SpacetimeDB PRs

- clockworklabs/SpacetimeDB#2220
- 
## 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: phoebe/rename-address-to-connection-id

## Testing

- [x] Pretty much just automated testing.
- [x] @kazimuth will need to update and run Blackholio.

---------

Co-authored-by: James Gilles <[email protected]>
…#244)

## Description of Changes
as described

## API

no breaks

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2241

## Testsuite

SpacetimeDB branch name: jgilles/unknown_reducer

## Testing

see SpacetimeDB PR
## Description of Changes
Companion PR for the http api glowup.

## API

Not a breaking change; this catches us up to being compatible with a
breakage introduced by
- clockworklabs/SpacetimeDB#2225.

## Requires SpacetimeDB PRs
- clockworklabs/SpacetimeDB#2225

## Testsuite
SpacetimeDB branch name: master

## Testing
Existing CI passes (it was failing without this change since it couldn't
connect).

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
We were not stripping `/` from the end of URIs provided to `Connect`. We
manually append `/...` to the provided addresses, so if we don't start
by stripping trailing `/`s, we end up with `//` in the URI and we get
errors.

Addresses part of
clockworklabs/SpacetimeDB#1551.

## API

No breaking  changes. This fixes an error case.

## Requires SpacetimeDB PRs
None

## Testsuite
SpacetimeDB branch name: master

## Testing
- [x] Tested the quickstart chat client with a host containing a
trailing `/`
```
# start a server, publish the module, send some input
# I also updated one line in `client.csproj` to use `Net8.0` because I no longer have `Net7.0` installed

$ cd examples~/quickstart/client

$ dotnet run
[I] SpacetimeDBClient: Connecting to ws://localhost:3000 quickstart-chat
C200098E is online
Connected
C2007471: hello
C2007471: godo
C2007471: asdf

$ sed -i 's/localhost:3000/localhost:3000\//' Program.cs

$ dotnet run
[I] SpacetimeDBClient: Connecting to ws://localhost:3000 quickstart-chat
C2000601 is online
Connected
C2007471: hello
C2007471: godo
C2007471: asdf

$ git diff
diff --git a/examples~/quickstart/client/Program.cs b/examples~/quickstart/client/Program.cs
index 9eb43b1..289e736 100644
--- a/examples~/quickstart/client/Program.cs
+++ b/examples~/quickstart/client/Program.cs
@@ -7,8 +7,8 @@ using System.Threading;
 using SpacetimeDB;
 using SpacetimeDB.Types;
 
-const string HOST = "http://localhost:3000";
-const string DBNAME = "chatqs";
+const string HOST = "http://localhost:3000/";
+const string DBNAME = "quickstart-chat";
 
 // our local client SpacetimeDB identity
 Identity? local_identity = null;
diff --git a/examples~/quickstart/client/client.csproj b/examples~/quickstart/client/client.csproj
index 48917cc..ab7ce44 100644
--- a/examples~/quickstart/client/client.csproj
+++ b/examples~/quickstart/client/client.csproj
@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <OutputType>Exe</OutputType>
-    <TargetFramework>net7.0</TargetFramework>
+    <TargetFramework>net8.0</TargetFramework>
     <CheckEolTargetFramework>false</CheckEolTargetFramework>
     <ImplicitUsings>disable</ImplicitUsings>
     <Nullable>enable</Nullable>
```

---------

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes

Switches to Bearer authentication, which is the more proper auth schema
to use with tokens.

## API

 - [ ] This is an API breaking change to the SDK

## Requires SpacetimeDB PRs
- clockworklabs/SpacetimeDB#2181

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

---------

Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: rekhoff <[email protected]>
Co-authored-by: James Gilles <[email protected]>
Comment on lines +11 to +162
# 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~

- name: Run .NET tests
run: dotnet test -warnaserror

- name: Verify C# formatting
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
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
key: ${{ steps.checkout-stdb.outputs.commit }}
# Cache Rust deps even if unit tests have failed.
cache-on-failure: true
# Cache the CLI as well.
cache-all-crates: true

- name: Install SpacetimeDB CLI from the local checkout
# 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
# 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

- name: Generate client bindings
working-directory: 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 || {
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
exit 1
}

- name: Check Unity meta files
uses: DeNA/unity-meta-check@v3
with:
enable_pr_comment: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

- name: Start SpacetimeDB
run: |
spacetime start &
disown

- name: Publish module to SpacetimeDB
working-directory: 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
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
cat manifest.json

- uses: actions/cache@v3
with:
path: unity-tests~/client-unity/Library
key: Unity-${{ github.head_ref }}
restore-keys: Unity-

- name: Run Unity tests
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
githubToken: ${{ secrets.GITHUB_TOKEN }}
testMode: playmode
useHostNetwork: true
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium test

Actions Job or Workflow does not set permissions
cat Cargo.toml

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Test Suite' step
Uses Step
uses 'dtolnay/rust-toolchain' with ref 'stable', not a pinned commit hash
uses: dtolnay/rust-toolchain@stable

- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Test Suite' step
Uses Step: cache-rust-deps
uses 'Swatinem/rust-cache' with ref 'v2', not a pinned commit hash
}

- name: Check Unity meta files
uses: DeNA/unity-meta-check@v3

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Test Suite' step
Uses Step
uses 'DeNA/unity-meta-check' with ref 'v3', not a pinned commit hash
restore-keys: Unity-

- name: Run Unity tests
uses: game-ci/unity-test-runner@v4

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium test

Unpinned 3rd party Action 'Test Suite' step
Uses Step
uses 'game-ci/unity-test-runner' with ref 'v4', not a pinned commit hash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants