clockworklabs / clockworklabs/SpacetimeDB
Better detection and error messages for indexes with unsupported key types
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 25.2k
- Forks
- 1.1k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 46
Description
Currently, the UX of restricted index key types is pretty poor. You don't get a compile-time error when creating the index, you just don't have access to the filtering methods. The client SDKs also inconsistently or incorrectly do/don't emit client-side indexes when the module declares an index of unsupported type.
We've seen a few different users in the public Discord stumble on this.
Definition of Done:
- In the Rust module bindings library, it is a hard compile-time error to declare a BTree, unique or primary_key index on (a) column(s) which do(es) not implement
FilterableValue. - In the C# module bindings library, it is a hard compile-time error to declare a BTree, unique or primary_key index on (a) column(s) whose type(s) is/are not "filterable," i.e. the same set of types as in Rust implement
FilterableValue. - In the Rust client SDK, it is possible to
spacetime generatebindings for a module with an index whose types are not filterable. The resulting bindings compile and run without error, but do not contain the ill-typed index. That is,spacetime generatefor the Rust client SDK skips indexes with non-filterable key types. A warning is printed to the console when skipping such an index duringspacetime generate.- This should be unreachable due to the above restrictions, but I expect we'll encounter modules that bypass those restrictions in various ways.
- In the TypeScript client SDK, it is possible to
spacetime generatebindings for a module with an index whose types are not filterable. The resulting bindings compile and run without error, but do not contain the ill-typed index. That is,spacetime generatefor the TypeScript client SDK skips indexes with non-filterable key types. A warning is printed to the console when skipping such an index duringspacetime generate. - In the C#/Unity Client SDK, it is possible to
spacetime generatebindings for a module with an index whose types are not filterable. The resulting bindings compile and run without error, but do not contain the ill-typed index. That is,spacetime generatefor the Rust client SDK skips indexes with non-filterable key types. A warning is printed to the console when skipping such an index duringspacetime generate.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Trace index validation in the Rust and C# module bindings, then follow index handling in spacetime generate for the Rust, TypeScript, and C#/Unity client SDKs. Compare how FilterableValue and filterable types are represented, then use the definition of done to verify compile-time errors, skipped indexes, warnings, and successfully generated bindings.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, rust, typescript, unity
- Domain
- databases, developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100