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

Migrate C# client-side reducer enum to the new syntax #2033

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

RReverser
Copy link
Member

@RReverser RReverser commented Dec 3, 2024

Description of Changes

As per https://github.com/clockworklabs/SpacetimeDBPrivate/pull/1198.

This makes reducers use the same codegen structure as tables and other tuple types, but nests them inside a Reducer class as subclasses for pattern-matching, like we allow on tagged enums.

The reason we don't use a tagged enum here anymore is because we don't need BSATN sum type support for the Reducer enum, and it imposes unnecessary restrictions like max 256 elements.

While testing the changes, simplified the C# CI a bit by reusing the tools~/write-nuget-config.sh script from the C# SDK repo instead of duplicating its logic.

API and ABI breaking changes

API breaking change for the client.

Expected complexity level and risk

2 - a breaking change, but shouldn't affect too much client code.

Testing

Waiting for CI to test it against client SDK, it's a bit quicker than manual.

  • Write a test you've completed here.
  • Write a test you want a reviewer to do here, so they can check it off when they're satisfied.

@RReverser RReverser force-pushed the ingvar/client-reducer-enum branch 2 times, most recently from 8e69576 to 3970543 Compare December 3, 2024 16:40
As per clockworklabs/SpacetimeDBPrivate#1198.

This makes reducers use the same codegen structure as tables and other tuple types, but nests them inside a `Reducer` class as subclasses for pattern-matching, like we allow on tagged enums.

The reason we don't use a tagged enum here anymore is because we don't need BSATN sum type support for the Reducer enum, and it imposes unnecessary restrictions like max 256 elements.
@RReverser RReverser force-pushed the ingvar/client-reducer-enum branch from 3f5a30c to cbe8de0 Compare December 3, 2024 18:16
Copy link
Contributor

@gefjon gefjon left a comment

Choose a reason for hiding this comment

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

I have no way to test this, but it appears reasonable. I'd like clarity on the CI changes before you merge, but otherwise this looks good to go.

Copy link
Collaborator

@bfops bfops left a comment

Choose a reason for hiding this comment

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

Approving CLI changes as a codeowner. I didn't really review; the changes are in C#-specific code that probably should be in an un-owned file anyway.

RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 4, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 4, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 4, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
@RReverser RReverser added this pull request to the merge queue Dec 4, 2024
Merged via the queue into master with commit 3902f75 Dec 4, 2024
9 checks passed
@RReverser RReverser deleted the ingvar/client-reducer-enum branch December 4, 2024 17:02
bfops pushed a commit that referenced this pull request Dec 6, 2024
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 11, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 11, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 11, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
RReverser added a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 11, 2024
Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants implemented via subclassing are shown as expected.
cloutiertyler pushed a commit to clockworklabs/com.clockworklabs.spacetimedbsdk that referenced this pull request Dec 12, 2024
## Description of Changes

Counterpart to clockworklabs/SpacetimeDB#2033.

Also updated test settings to make sure that sum type variants
implemented via subclassing are shown as expected.

## 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 against a specific SpacetimeDB branch in the
testsuite, 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
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.

3 participants