Skip to content

Case conversion#4263

Open
Shubham8287 wants to merge 147 commits intomasterfrom
shub/case-conversion
Open

Case conversion#4263
Shubham8287 wants to merge 147 commits intomasterfrom
shub/case-conversion

Conversation

@Shubham8287
Copy link
Contributor

@Shubham8287 Shubham8287 commented Feb 11, 2026

Description of Changes

Update the Default casing policy to snake_case for RawModuleDefV10.

Messy PR contains changes at different places, so that CI can pass:

Here are the main changes as follows:

  • bindings-macro & bindings crate: name macro in Indexes for canonical name and supply it to RawModuleDefV10 via ExplicitNames.

  • bindings-typescript:

  • binding-csharp: a single line change to pass sourceName of index instead of null.

  • codegen:

  • schema crate:

    • validate/v9 - Nothing itself should change or changes in v9 validation logic but the file contains a CoreValidator which is shared with validate/v10. No test have t be updated to validate/v9 which ensures we aren't regressing it.

    • validate/v10: This is the main meat, look at the new tests added in bottom to understand what it does.

    • Rest of the files are either test updates or module bindings.

    Testing:

    1. Extensive unit tests have been added to verify generated ModuleDef is correct.
    2. I have done some e2e testing to verify rust codegen with rust and typescript modules.
    3. I would have like to do more testing for other codegens , I am continue doing .

I have removed sql.py smoketest, as that seems to be already migated in new framework and was headache to update.

Expected complexity level and risk

4, It could have side-effect which aren't easily visible.


@Shubham8287 Shubham8287 marked this pull request as draft February 11, 2026 12:20
@Shubham8287 Shubham8287 force-pushed the shub/case-conversion branch 2 times, most recently from 7ee1b81 to 1ba4286 Compare February 11, 2026 13:13
@Shubham8287 Shubham8287 force-pushed the shub/case-conversion branch 2 times, most recently from 73f986b to 7d0ddae Compare February 11, 2026 17:37
@Shubham8287 Shubham8287 changed the base branch from master to shub/table-name-to-accessor February 11, 2026 17:38
@Shubham8287 Shubham8287 force-pushed the shub/case-conversion branch 2 times, most recently from d616ea9 to cbcd089 Compare February 11, 2026 21:07
@Shubham8287 Shubham8287 force-pushed the shub/table-name-to-accessor branch from f5cbb0e to ee62ea2 Compare February 11, 2026 21:08
clockwork-labs-bot and others added 6 commits February 19, 2026 22:57
Branched from `shub/case-conversion` (#4263).

Re-enables the four bench tests that were commented out during the case
conversion work:
- `test_basic_invariants_sqlite`
- `test_basic_invariants_spacetime_raw`
- `test_basic_invariants_spacetime_module_rust`
- `test_basic_invariants_spacetime_module_csharp`

Restores `serial_test` import and `#[serial]` attributes. Only changes
`crates/bench/src/lib.rs`.

Compiles clean locally (`cargo test -p spacetimedb-bench --no-run`).

cc @Shubham8287

---------

Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com>
The case conversion (SnakeCase policy) converts table names like OneU8
to one_u_8 (inserting underscore at letter-digit boundary), but the
hardcoded SQL subscription queries in SUBSCRIBE_ALL and throughout the
test client still used the old names (one_u8, pk_u32, vec_u8, etc.).

This caused all SDK tests to timeout: subscriptions silently matched
nothing, so on_insert callbacks never fired.

Updated all hardcoded SQL table names to match their post-conversion
canonical forms.
The test-client is recompiled with fresh bindings for each module
variant (Rust sdk-test, C# sdk-test-cs, TS sdk-test-ts). The C# and
TS modules use explicit accessor names like 'one_u8', while the Rust
module's 'OneU8' gets case-converted to 'one_u_8'. Hardcoded SQL
can't work for all variants.

Replace all hardcoded table names in SQL queries with lookups against
RemoteModule::ALL_TABLE_NAMES (generated by codegen). A table_name()
helper does underscore-insensitive matching so the same source code
works regardless of case conversion policy.

This fixes the Test Suite failures for csharp:: and typescript:: tests
that were broken by the previous commit's hardcoded name change.
@Shubham8287
Copy link
Contributor Author

This PR have a known bug related to due to camel casing table identifier in typescript bindings, I have @coolreader18 to look into that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-break A PR that makes an API breaking change release-2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

Comments