Skip to content

Conversation

@RReverser
Copy link
Contributor

@RReverser RReverser commented Aug 21, 2023

Description of Changes

(This is reopened #72 with some fixes.)

As we're adding more variants, it's getting harder to keep track of the "A implies B" relationships between enum variants and to correctly do checks like "is this column autoinc" in different places.

Using bitflags makes expressing those relationships more natural and checking simpler - e.g. you can just do contains(AUTO_INC) as a single bit operation instead of having to remember and list all possible variants that imply autoinc, especially if we're going to add more flags in the future.

Initially I was going to make this change just in C# module generator and convert between ABI enum and bitflags over there, but it seems better to do this at ABI level so it simplifies Rust handling as well.

API

  • This is a breaking change to the module ABI
  • This is a breaking change to the module API
  • This is a breaking change to the ClientAPI
  • This is a breaking change to the SDK API

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

As we're adding more variants, it's getting harder to keep track of the "A implies B" relationships between enum variants and to correctly do checks like "is this column autoinc" in different places.

Using bitflags makes expressing those relationships more natural and checking simpler - e.g. you can just do `contains(AUTO_INC)` as a single bit operation instead of having to remember and list all possible variants that imply autoinc, especially if we're going to add more flags in the future.

Initially I was going to make this change just in C# module generator and convert between ABI enum and bitflags over there, but it seems better to do this at ABI level so it simplifies Rust handling as well.
Copy link
Contributor

@kulakowski kulakowski left a comment

Choose a reason for hiding this comment

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

Approved but I don't know when a good time for an ABI breaking change is right now.

@RReverser
Copy link
Contributor Author

We probably need to come up with some strategy to update C# dep when we change ABI. If this PR is merged now, that will make all the C# deps incompatible. The only way I can think of to avoid that would be to bump C# dep to 0.7.* and reference it in this same PR, so that both changes are merged at the same time. But that leaves spacetime-web which has its own project template that references 0.6.* C# deps...

I'm not sure what strategy is to update all of them together, in a way that ABI used by the website is compatible with that of the backend.

@mamcx mamcx merged commit cc632ef into master Aug 29, 2023
@RReverser RReverser deleted the column-attr-bitflags branch September 2, 2023 11:32
RReverser added a commit that referenced this pull request Sep 12, 2023
This bumps C# dependency to be compatible with #212 when the next version of SpacetimeDB is released.
@RReverser RReverser mentioned this pull request Sep 12, 2023
4 tasks
bfops pushed a commit that referenced this pull request Jul 17, 2025
* Standalone guide

* Several improvements

* Title update

* Updated nav.js

* Guide updated

* Small fix

* Guide working again after `--root-dir` change

* Finished + tested

* Apply suggestions from code review



* Updates after review

* Update navigation

* Apply suggestions from code review

* Update docs/deploying/spacetimedb-standalone.md

* Update docs/deploying/spacetimedb-standalone.md

---------

Co-authored-by: John Detter <no-reply@boppygames.gg>
Co-authored-by: Mazdak Farrokhzad <twingoow@gmail.com>
bfops added a commit that referenced this pull request Jul 17, 2025
## Description of Changes

`WithCredentials` was designed for our old auth model, where tokens were
always issued by the SpacetimeDB host alongside an `Identity`, and
therefore the bearer always knew their `Identity`.

In our new auth model, a client may have a valid auth-able JWT but not
know what `Identity` it will result in,
as the `Identity` is computed based on the hash of some of the token's
contents, and this hashing algorithm is not included in our client SDKs.
As such, this PR revises `WithCredentials` to `WithToken`, which just
accepts the token.

## API

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

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

`WithCredentials` is renamed and its signature changes.

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

- [ ] @cloutiertyler should test this with the Unity tutorial, if
possible.

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops added a commit that referenced this pull request Aug 7, 2025
## Description of Changes

`WithCredentials` was designed for our old auth model, where tokens were
always issued by the SpacetimeDB host alongside an `Identity`, and
therefore the bearer always knew their `Identity`.

In our new auth model, a client may have a valid auth-able JWT but not
know what `Identity` it will result in,
as the `Identity` is computed based on the hash of some of the token's
contents, and this hashing algorithm is not included in our client SDKs.
As such, this PR revises `WithCredentials` to `WithToken`, which just
accepts the token.

## API

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

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

`WithCredentials` is renamed and its signature changes.

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

- [ ] @cloutiertyler should test this with the Unity tutorial, if
possible.

---------

Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
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.

4 participants