Skip to content

Conversation

@Shubham8287
Copy link
Contributor

@Shubham8287 Shubham8287 commented Sep 23, 2025

Description of Changes

PR contains:

  • CLI changes for the pre_publish endpoint when publishing a module.
  • The regular --yes flag will not bypasses the break clients warning prompt — an extra confirmation is now required. For CI, a hidden flag --break-clients is added.
  • Added smoketest.
  • Some trivial naming changes in client-api-* crates for consistency reasons.
  • pre_publish route to accept similar Body size limit as publish route.

API and ABI breaking changes

an additive API change, does not break anything.

Expected complexity level and risk

2

Testing

  • Existing smoketests passing for backward compatibility.
  • New smoketest for add columns

@Shubham8287 Shubham8287 requested a review from gefjon September 23, 2025 17:34
@Shubham8287 Shubham8287 force-pushed the shub/update-disconnect-clients branch from 3a0e6bd to 49cfb51 Compare September 24, 2025 12:59
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from cb0d206 to 6ef506d Compare September 24, 2025 20:07
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from c87c871 to 09d9377 Compare September 24, 2025 20:45
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from 47954f5 to a970761 Compare September 26, 2025 13:18
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.

left some nits, but my codeowned changes lgtm

Shubham8287 and others added 2 commits September 26, 2025 22:46
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from 50c6d72 to af44921 Compare September 29, 2025 12:49
@bfops bfops added the release-any To be landed in any release window label Sep 29, 2025
@Shubham8287 Shubham8287 changed the base branch from shub/update-disconnect-clients to master October 1, 2025 16:02
Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
@Shubham8287 Shubham8287 enabled auto-merge October 1, 2025 16:29
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from ee03bd2 to c6a0497 Compare October 1, 2025 16:44
@Shubham8287 Shubham8287 force-pushed the shub/pre-publish-in-cli branch from c6a0497 to b59dc1f Compare October 1, 2025 17:44
@Shubham8287 Shubham8287 added this pull request to the merge queue Oct 1, 2025
Merged via the queue into master with commit 54b07d0 Oct 1, 2025
24 of 26 checks passed
@Shubham8287 Shubham8287 deleted the shub/pre-publish-in-cli branch October 1, 2025 18:53
github-merge-queue bot pushed a commit that referenced this pull request Oct 6, 2025
# Description of Changes

This is the implementation of issue #3191. This adds a Default attribute
to C# module fields.

**Note**: In C#, attribute arguments must be compile-time constants,
which means you can't directly use non-constant expressions like new
expressions, method calls, or dynamic values in attribute constructors.
(Ref:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#2324-attribute-parameter-types)

For this reason, these default values are limited to primitive types,
enums, and strings.
This includes (shown as `C# Type` (`BSATN type`):

* `bool` (`Bool`)
* `sbyte` (`I8`)
* `byte` (`U8`)
* `short` (`I16`)
* `ushort` (`U16`)
* `int` (`I32`)
* `unit` (`U32`)
* `long` (`I64`)
* `ulong` (`U64`)
* `float` (`F32`)
* `double` (`F64`)
* `enum` (`Enum`)
* `string` (`String`)
* `null` (`RefOption`) <- Nullable type

Because of C# limitations, for nullable and complex data types, such as
a struct, can take use `[Default(null)]` to populate values with null
defaults. This allows things like structs to workaround the non-constant
expressions in attribute constructors limitation by allowing these
complex types to still be able to be added as new column tables.

The `int` type can also be in the form of Hex or Binary literals, such
as `[Default(0x2A)]` or `[Default(0b00101010)]`

Both Decimal (like `[Default(3.14m)]`) and Char (like `[Default('A')]`)
are unsupported types in BSATN and will still return `BSATN0001` errors.

# API and ABI breaking changes

Not API breaking.
This change only adds the `[Default(value)]` attribute logic.
Using the `[Default(value)]` attribute with older versions SpacetimeDB
C# modules will result in an error.

# Expected complexity level and risk

2

# Testing

Local testing of this requires use of CLI changes in #3278 

- [x] Regression test of functionality added.
bfops added a commit that referenced this pull request Oct 8, 2025
# Description of Changes
PR contains:

* CLI changes for the `pre_publish` endpoint when publishing a module.
* The regular `--yes` flag will not bypasses the *break clients* warning
prompt — an extra confirmation is now required. For CI, a hidden flag
`--break-clients` is added.
* Added smoketest.
* Some trivial naming changes in `client-api-*` crates for consistency
reasons.
* `pre_publish` route to accept similar Body size limit as `publish`
route.



# API and ABI breaking changes
an additive API change, does not break anything.

# Expected complexity level and risk
2

# Testing
- Existing smoketests passing for backward compatibility.
- New smoketest for add columns

---------

Signed-off-by: Shubham Mishra <shivam828787@gmail.com>
Co-authored-by: Phoebe Goldman <phoebe@clockworklabs.io>
Co-authored-by: Zeke Foppa <196249+bfops@users.noreply.github.com>
bfops pushed a commit that referenced this pull request Oct 16, 2025
# Description of Changes

This is the implementation of issue #3191. This adds a Default attribute
to C# module fields.

**Note**: In C#, attribute arguments must be compile-time constants,
which means you can't directly use non-constant expressions like new
expressions, method calls, or dynamic values in attribute constructors.
(Ref:
https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes#2324-attribute-parameter-types)

For this reason, these default values are limited to primitive types,
enums, and strings.
This includes (shown as `C# Type` (`BSATN type`):

* `bool` (`Bool`)
* `sbyte` (`I8`)
* `byte` (`U8`)
* `short` (`I16`)
* `ushort` (`U16`)
* `int` (`I32`)
* `unit` (`U32`)
* `long` (`I64`)
* `ulong` (`U64`)
* `float` (`F32`)
* `double` (`F64`)
* `enum` (`Enum`)
* `string` (`String`)
* `null` (`RefOption`) <- Nullable type

Because of C# limitations, for nullable and complex data types, such as
a struct, can take use `[Default(null)]` to populate values with null
defaults. This allows things like structs to workaround the non-constant
expressions in attribute constructors limitation by allowing these
complex types to still be able to be added as new column tables.

The `int` type can also be in the form of Hex or Binary literals, such
as `[Default(0x2A)]` or `[Default(0b00101010)]`

Both Decimal (like `[Default(3.14m)]`) and Char (like `[Default('A')]`)
are unsupported types in BSATN and will still return `BSATN0001` errors.

# API and ABI breaking changes

Not API breaking.
This change only adds the `[Default(value)]` attribute logic.
Using the `[Default(value)]` attribute with older versions SpacetimeDB
C# modules will result in an error.

# Expected complexity level and risk

2

# Testing

Local testing of this requires use of CLI changes in #3278 

- [x] Regression test of functionality added.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-any To be landed in any release window

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants