Skip to content

Conversation

@mamcx
Copy link
Contributor

@mamcx mamcx commented Oct 30, 2025

Description of Changes

Closes #3290.

Adds a new "special" type to SATS, UUID, which is represented as the product { __uuid__: u128 }. Adds versions of this type to all of our various languages' module bindings libraries and client SDKs, and updates codegen to recognize it and output references to those named library types. Adds methods for creating new UUIDs according to the V4 (all random) and V7 (timestamp, monotonic counter and random) specifications.

API and ABI breaking changes

We add a new type

Expected complexity level and risk

2

it impacts all over the code

Testing

  • Extends the Rust and Unreal SDK tests, and the associated module-test modules in Rust, C# and TypeScript, with uses of UUIDs.
  • Extends the C# SDK regression tests with uses of UUIDs.
  • Extends the TypeScript test suite with tests with uses of UUIDs.

@mamcx mamcx self-assigned this Oct 30, 2025
@mamcx mamcx added enhancement New feature or request release-any To be landed in any release window Do not merge Do not merge PRs with this label without coordinating further labels Oct 30, 2025
@mamcx mamcx force-pushed the mamcx/uuid-type branch 6 times, most recently from 17d38a5 to 21c25de Compare November 20, 2025 19:17
@JasonAtClockwork
Copy link
Contributor

I've rebased my changes and added them to the branch; this reworks the Unreal C++ side of things for UUID to introduce a new type, adds tests to the TestClient that confirms values and matches all the changes up with the Unreal codegen. If you have any questions don't hesitate to reach out!

@mamcx mamcx force-pushed the mamcx/uuid-type branch 4 times, most recently from 15d7a9d to 7328782 Compare December 3, 2025 20:52
@JasonAtClockwork
Copy link
Contributor

@rekhoff - I'll need your eyes on the Unreal changes as they were significant enough to add the new UUID object and integration tests.

Copy link
Contributor

@JasonAtClockwork JasonAtClockwork left a comment

Choose a reason for hiding this comment

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

I've gone through the Rust, TypeScript, and C# updates as well as retested my Unreal changes and it's looking solid but there seems to be missing integration tests for both TypeScript and C#. Rust looks solid but we'll want someone with more experience to review that.

For TypeScript I'm not sure how our testing framework is set up so I could be wrong. Maybe Noa can help guide here.

For C# sadly we're not hooked directly into the sdk-test or sdk-test-cs but we should add integration test for Uuid into /sdks/csharp/~examples/regression-tests to make sure there is coverage. Myself or Ryan can help here if it isn't clear how to plug in and run those.

github-merge-queue bot pushed a commit that referenced this pull request Dec 10, 2025
# Description of Changes

As the title says, required for
#3538.

# Expected complexity level and risk

1

# Testing

Will be done on the `uuid` pr.

---------

Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
@mamcx mamcx force-pushed the mamcx/uuid-type branch 3 times, most recently from ef735c9 to a68fd5f Compare December 11, 2025 21:16
@mamcx mamcx removed the Do not merge Do not merge PRs with this label without coordinating further label Dec 11, 2025
@mamcx mamcx marked this pull request as ready for review December 12, 2025 17:19
@mamcx mamcx requested a review from bfops as a code owner December 12, 2025 17:19
@mamcx mamcx requested a review from jdetter as a code owner December 12, 2025 17:19
Copy link
Contributor

@JasonAtClockwork JasonAtClockwork left a comment

Choose a reason for hiding this comment

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

C# + Unreal looks good to me though I highly advise another pair of eyes before merging.

@gefjon
Copy link
Contributor

gefjon commented Dec 18, 2025

From Wikipedia:

remaining 74 bits are random seeded counter (optional, at least 12 bits but no longer than 42 bits) and random.

It looks like we should be putting the counter in the low bits, not the timestamp.

@gefjon
Copy link
Contributor

gefjon commented Dec 18, 2025

Plan is to move the counter part of the generated UUIDv7 into the space reserved for the counter, and not increment the timestamp part. We'll store the source for the counter in the ReducerContext or ProcedureContext.

@mamcx mamcx force-pushed the mamcx/uuid-type branch 4 times, most recently from 6fe9cef to ba86593 Compare December 25, 2025 17:44
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.

This is looking very good, I think we're very close to merging. Thanks for all your hard work.

@rekhoff
Copy link
Contributor

rekhoff commented Dec 29, 2025

@rekhoff - I'll need your eyes on the Unreal changes as they were significant enough to add the new UUID object and integration tests.

I reviewed both the C# and the Unreal code. I think you caught the concerns. The Unreal tests could provide better coverage, they are fairly light at the moment. I did load up the Unreal TestClient and manually check a few different behaviors of the UUID, including adding them to blueprints. They where simple tests, but no issues found.

Copy link
Contributor

@rekhoff rekhoff left a comment

Choose a reason for hiding this comment

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

Signing off approval for the C# and as secondary on the Unreal changes.

@mamcx mamcx force-pushed the mamcx/uuid-type branch 2 times, most recently from 00d3c8c to b5ba0bb Compare December 30, 2025 21:27
mamcx and others added 3 commits December 30, 2025 18:02
Fix uuid parsing and to_string in ts and c#

Apply suggestions from code review

Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Signed-off-by: Mario Montoya <mamcx@elmalabarista.com>
Copy link
Collaborator

@jdetter jdetter left a comment

Choose a reason for hiding this comment

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

I'm just reviewing as a CLI crate owner - the updates here are only within the tests and the updates look correct.

One request: could we update the PR description with the latest info for this PR in its current state before it merges? Thanks 👍

@gefjon gefjon enabled auto-merge December 31, 2025 22:18
@gefjon gefjon disabled auto-merge December 31, 2025 22:18
@gefjon gefjon added this pull request to the merge queue Jan 2, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 2, 2026
@gefjon gefjon added this pull request to the merge queue Jan 2, 2026
Merged via the queue into master with commit 8fb0bcf Jan 2, 2026
40 of 42 checks passed
@coolreader18 coolreader18 mentioned this pull request Jan 6, 2026
1 task
github-merge-queue bot pushed a commit that referenced this pull request Jan 7, 2026
# Description of Changes

#3538 added a `uuid_counter` field to ReducerCtx, which has no need to
be public. Implementing ReducerCtx as a class allows us to encapsulate
better, and lets us enumerate exactly the data that it needs to hold so
that the runtime could possibly optimize it.

# Expected complexity level and risk

1: straightforward switch

# Testing

- [x] Automated testing is sufficient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add UUID built-in convenience type to SpacetimeDB

6 participants