Skip to content

Comments

Add #[spacetimedb::settings] for module-level configuration#4366

Merged
Shubham8287 merged 1 commit intomasterfrom
bot/spacetimedb-settings
Feb 20, 2026
Merged

Add #[spacetimedb::settings] for module-level configuration#4366
Shubham8287 merged 1 commit intomasterfrom
bot/spacetimedb-settings

Conversation

@clockwork-labs-bot
Copy link
Collaborator

@clockwork-labs-bot clockwork-labs-bot commented Feb 20, 2026

Summary

Adds a cross-language #[spacetimedb::settings] mechanism for declaring module-level settings. The first supported setting is CASE_CONVERSION_POLICY, which controls how identifiers are case-converted.

Rust

use spacetimedb::CaseConversionPolicy;

#[spacetimedb::settings]
const CASE_CONVERSION_POLICY: CaseConversionPolicy = CaseConversionPolicy::None;
  • Proc macro validates const name against KNOWN_SETTINGS
  • Generates __preinit__ export for registration
  • Duplicate settings produce a linker error (duplicate symbol)

TypeScript

export const moduleSettings: ModuleSettings = {
  caseConversionPolicy: CaseConversionPolicy.None,
};
  • ModuleSettings interface with typed fields
  • caseConversionPolicy section pushed in rawModuleDefV10()

Stacked on

This PR adds the proper user-facing API on top of the internal mechanism in #4364.

Copy link
Contributor

@Shubham8287 Shubham8287 left a comment

Choose a reason for hiding this comment

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

Looks Good!

@Shubham8287 Shubham8287 changed the base branch from shub/case-conversion to master February 20, 2026 12:49
@Shubham8287 Shubham8287 changed the base branch from master to shub/case-conversion February 20, 2026 12:51
Implements the settings mechanism from the casing policy proposal across
all three languages:

Rust:
  #[spacetimedb::settings]
  const CASE_CONVERSION_POLICY: CaseConversionPolicy = CaseConversionPolicy::None;

TypeScript:
  export default schema({ player }, {
    CASE_CONVERSION_POLICY: CaseConversionPolicy.None,
  });

C#:
  [SpacetimeDB.Settings]
  public const CaseConversionPolicy CASE_CONVERSION_POLICY = CaseConversionPolicy.None;

Implementation details:
- Rust: proc macro validates const name against known settings, generates
  __preinit__ registration, duplicate = linker error
- TypeScript: optional second arg to schema(), CaseConversionPolicy re-exported
- C#: [Settings] attribute + source generator discovers and emits registration

Also adds:
- RawModuleDefV10Builder::set_case_conversion_policy()
- CaseConversionPolicy re-exported from spacetimedb bindings crate
- CaseConversionPolicy section pushed in TS and C# module builders
@clockwork-labs-bot clockwork-labs-bot changed the base branch from shub/case-conversion to master February 20, 2026 12:57
@Shubham8287 Shubham8287 added this pull request to the merge queue Feb 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to a conflict with the base branch Feb 20, 2026
@Shubham8287 Shubham8287 added this pull request to the merge queue Feb 20, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Feb 20, 2026
@Shubham8287 Shubham8287 added this pull request to the merge queue Feb 20, 2026
Merged via the queue into master with commit a89634b Feb 20, 2026
31 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants