Skip to content

Conversation

rekhoff
Copy link
Contributor

@rekhoff rekhoff commented Mar 21, 2025

Adds a test to com.clockworklabs.spacetimedbsdk that checks if the BTreeIndexBase class Column implements the IComparable interface. This is the implementation side of issue clockworklabs/SpacetimeDB#2362.

API

  • This is an API breaking change to the SDK

Requires SpacetimeDB PRs

No specific PR are required for this change.

Testsuite

SpacetimeDB branch name: master

Testing

  • Ran dotnet test, all checks pass.

jdetter and others added 30 commits November 2, 2022 12:01
Add sslEnabled option to Connect function
* Fix compilation issue with master

* Initial push for SATS (still WIP)

* Small build fix

* Small update

* Updates from meeting with Tyler

* Fixed issues with LayoutExplicit and added some missing functions

* AlgebraicValue cleanup

* Copied changes from BitCraftMini

* Removed TypeDef

---------

Co-authored-by: Clockwork Labs <[email protected]>
Co-authored-by: Tyler Cloutier <[email protected]>
Co-authored-by: John Detter <[email protected]>
* Upload script to help deploying to our partners

* You have to specify hosts individually

* Small fix

* Another small fix - tested + working

---------

Co-authored-by: John Detter <[email protected]>
* Serialize byte arrays as hex

* Fix namespace

* Small fix

---------

Co-authored-by: John Detter <[email protected]>
* First pass

* Committing meta file

* Removed option type - unneeded

* Implementing new some converter

* Some converter updates

* Tons of fixes here

* Cleaned up the some/enum serialization implementation

---------

Co-authored-by: John Detter <[email protected]>
* Several updates to the way ClientCache + processing updates works

* Client cache changes working

* Removed log statements

---------

Co-authored-by: John Detter <[email protected]>
* Copied changes from BitCraft

* Applied state diff changes

* State diffs complete

* Compilation fix

* Fix build issues

---------

Co-authored-by: John Detter <[email protected]>
* Pulled SpacetimeUnitySDK from the BitCraft project

* Removed unused logs

* Removed primary key functionality

* Fix compilation issues with older version of C#

* Primary key client implementation

* Another row update fix

---------

Co-authored-by: John <[email protected]>
* Pulled SpacetimeUnitySDK from the BitCraft project

* Removed unused logs

* Removed primary key functionality

* Fix compilation issues with older version of C#

---------

Co-authored-by: John <[email protected]>
* Adding event parameter to table callbacks

* Reverted a namespace change

---------

Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: Derek Brinkmann <[email protected]>
* Add onSubscriptionUpdate callback

* Remove unnecesary onTransactionComplete

---------

Co-authored-by: Derek Brinkmann <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks

* Reducer arguments in table events

* Removed redundant onSubscriptionUpdate

---------

Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks

* Reducer arguments in table events

* Adding OnBeforeDelete event to tables

* Renaming ReducerCallInfo to ReducerEvent

* Removed extra onSubscriptionUpdate

---------

Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
* Deserializing reducer args before table updates so they can be accessed from callbacks

* Reducer arguments in table events

* Adding OnBeforeDelete event to tables

---------

Co-authored-by: Steve <[email protected]>
Co-authored-by: John Detter <[email protected]>
kazimuth and others added 21 commits February 7, 2025 22:03
## 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]>
## Description of Changes
This updates the CI check protecting the release branch, as part of
#226
(see that ticket for more details).

Once this is merged, it will need to be cherrypicked into our release
branch in order to take effect there.

The check itself has also been renamed. I have already updated the
branch protection rules to look for the new name.

## API

No code changes.

## Requires SpacetimeDB PRs
None

## Testsuite
SpacetimeDB branch name: master

## Testing
The previous behavior was well-tested, and I've just changed some
strings here, so I have not done further testing. It does pass on this
branch though.

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
Add SubscribeMulti and UnsubscribeMulti from upstream.
Fix unsubscribe bug found by testing against Bitcraft: Calling
`UnsubscribeThen` with any (non-null) callback would result in an
exception incorrectly telling the user that `Unsubscribe` had been
called twice.
Multiplicity support is implemented with unit tests + manual testing of
quickstart-chat.
Also, rows in the client cache are now looked up by primary key if
available, which I suspect is going to be a large performance boost.

## API

 - [x] 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: jgilles/final-cs-codegen-changes

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

- [x] unit tests
- [ ] Working with Ryan to add a test suite.
- [x] blackholio
## Description of Changes

Updates comment on `SubscribeToAllTables` since undefined behavior is not possible anymore.

No code changes made in this patch.

## API

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

*If the API is breaking, please state below what will break*

## Requires SpacetimeDB PRs

N/A

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

No code changes made in this patch.
## Description of Changes

Adds closing `</summary>` to end of comment.

## API

No breaking changes

## Requires SpacetimeDB PRs

N/A

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

Just fixing a comment. No tests required.
…ument. (#258)

# Description of Changes
Update the C# server and client SDK quickstart-chat example to match the
code presented in the tutorial, as of
clockworklabs/spacetime-docs#170 .
Also renamed the directory from `quickstart` to `quickstart-chat` in
order to be more specific.

# API and ABI breaking changes

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

# Expected complexity level and risk

1

## Requires SpacetimeDB PRs
SpacetimeDB branch name: master
com.clockworklabs.spacetimedbsdk: master

# Testing

*Describe any testing you've done, and any testing you'd like your
reviewers to do,
so that you're confident that all the changes work as expected!*

- [x] Ran `quickstart-chat` C# server and C# client locally and:
  - Set my name.
  - Sent a message.
  - Restarted and viewed the message backlog.
  - Sent a few more messages.
- Exited, deleted my local token, restarted and connected as a new
identity.
  - Set my new identity's name.
  - Sent a message as my new identity.

---------

Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: james gilles <[email protected]>
## Description of Changes
Just link to the existing docs.

## API

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

*If the API is breaking, please state below what will break*

## Requires SpacetimeDB PRs

## Testsuite

SpacetimeDB branch name: master

## Testing
## Description of Changes
This just bumps our package versions to be 1.0.0.

## API

No breaking changes

## Requires SpacetimeDB PRs
clockworklabs/SpacetimeDB#2283

## Testsuite
SpacetimeDB branch name: bfops/bump-version

## Testing
Existing CI only.

---------

Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: John Detter <[email protected]>
Co-authored-by: John Detter <[email protected]>
## Description of Changes
Relaxed this version number from `1.0.0` to `1.0.*`

## API
No breaking changes.

## Requires SpacetimeDB PRs
None

## Testsuite

SpacetimeDB branch name: master

## Testing
Existing CI should run `dotnet test` and confirm that this is not
broken.

---------

Co-authored-by: Zeke Foppa <[email protected]>
## Description of Changes
*Describe what has been changed, any new features or bug fixes*

I've already pushed this out to nuget here:
<https://www.nuget.org/packages/SpacetimeDB.ClientSDK>

- We want to update our REAME on nuget.org because the README that we
released as part of 1.0.1 was very much out of date.

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

NA

## 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] The README is updated.

Co-authored-by: John Detter <[email protected]>
Adds an additional test of the `GenericEqualityComparer` function for
`Integer`, `String`, `Byte Array`, `Identity`, `User` and `TaggedEnum` type
comparisons.

This PR resolves additional checks as reported in by [Issue
230](#230)
that where not-yet covered elsewhere.

## API

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

## Requires SpacetimeDB PRs
No other PR are needed for this to work.

## Testsuite
SpacetimeDB branch name: master

## Testing
- [X] Locally ran `dotnet test` against the `tests.csproj` project and
it passed all tests
## Description of Changes
Updated two README docs:
* README.md - Updated links to point to Blackholio repo and tutorial
docs.
* README.dotnet.md - Updated to point to new URL paths for C# SDK
Quickstart and Reference docs.

## API

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

## Requires SpacetimeDB PRs
N/A - Docs only change

## Testsuite
N/A - Docs only change

SpacetimeDB branch name: master

## Testing

- [X] Clicked on each new link and confirm the browser can locate the
new locations.

---------

Co-authored-by: Zeke Foppa <[email protected]>
Co-authored-by: John Detter <[email protected]>
## Description of Changes
I don't know if the DLLs need updating, but updated the DLLs just in
case.

## API

Incorporate any chances in SpacetimeDB 1.0.1. There should be no
breaking changes.

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

## Testsuite
SpacetimeDB branch name: release/v1.0.1

## Testing
None. Will test in release.

---------

Co-authored-by: Zeke Foppa <[email protected]>
Updates package version to 1.0.1

## API

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

## Requires SpacetimeDB PRs
No specific PR needed

## Testsuite

SpacetimeDB branch name: release/v1.0.1

## Testing

- [X] Confirmed Unity sees version as 1.0.1 after change
@rekhoff rekhoff requested a review from kazimuth March 24, 2025 15:21
Copy link
Contributor

@kazimuth kazimuth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests make sense, interesting use of reflection. Have one request.

Comment on lines +88 to +105
public sealed class UserHandle : RemoteTableHandle<EventContext, User>
{
protected override string RemoteTableName => "user";

public sealed class IdentityIndex : BTreeIndexBase<SpacetimeDB.Identity>
{
protected override SpacetimeDB.Identity GetKey(User row) => row.Identity;

public IdentityIndex(UserHandle table) : base(table) { }
}

public readonly IdentityIndex Identity;

internal UserHandle(DbConnection conn) : base(conn)
{
Identity = new(this);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code won't catch problems that occur if the code generation changes in the future. To catch such problems, we'd need to write the same test against generated code. For example, we could add an index to the Message.Sender field in quickstart-chat -- these tests have access to the quickstart-chat generated code.

If you want to do that, it would be great; if not, I'm willing to merge this, but would appreciate a comment saying why this class is here. // Copy of generated code for a BTreeIndex; TODO: update if that code changes is messy but at least documents what is going on.

@bfops
Copy link
Collaborator

bfops commented Aug 8, 2025

Migrated to clockworklabs/SpacetimeDB#3142, as we are merging this repo into that one.

@bfops bfops closed this Aug 8, 2025
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.