Skip to content

docs: fix daily docs audit findings - #5516

Open
clockwork-labs-bot wants to merge 53 commits into
masterfrom
bot/docs-audit
Open

docs: fix daily docs audit findings#5516
clockwork-labs-bot wants to merge 53 commits into
masterfrom
bot/docs-audit

Conversation

@clockwork-labs-bot

@clockwork-labs-bot clockwork-labs-bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Keep scripted --delete-data examples explicit while leaving interactive examples concise.
  • Clarify generated C# reducer result callbacks, including the chat tutorial wording for conn.Reducers.On... events.
  • Update C# reducer examples to use generated PascalCase method/event names.
  • Align scheduled-function docs with the TypeScript/C# skill guidance: TypeScript scheduled callbacks use (): any => ..., TypeScript scheduled table fields use snake_case in snake_case tables, and the C# scheduled-table example names ScheduledAt explicitly.
  • Update current Rust and C++ docs snippets to use the 2.x sender APIs (ctx.sender() / ctx.sender()) and the current Rust spacetimedb::Identity import.
  • Fix the new TypeScript submodules docs to use current exported reducer syntax and a snake_case canonical view name while preserving camelCase generated client accessors.
  • Align the reducer-context TypeScript scheduled-task example with snake_case scheduled table fields.
  • Update Unreal client docs to use current generated callback forms: reducer result delegates use .AddDynamic(...), and disconnect callbacks receive (UDbConnection*, const FString&).

Validation

  • git diff --check
  • pnpm --dir docs typecheck

@clockwork-labs-bot clockwork-labs-bot changed the title docs: update delete-data flag examples docs: fix daily docs audit findings Jul 11, 2026
Comment thread docs/docs/00100-intro/00100-getting-started/00400-key-architecture.md Outdated
Comment thread docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md Outdated
Comment thread docs/docs/00200-core-concepts/00200-functions/00300-reducers/00300-reducers.md Outdated
Comment thread docs/docs/00200-core-concepts/00300-tables/00210-file-storage.md Outdated
Comment thread docs/docs/00300-resources/00100-how-to/00600-migrating-to-2.0.md Outdated

```typescript
const damageEvent = table({
const damage_event = table({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No snake_case in TypeScript.

- `--server`: target server
- `--break-clients`: allow breaking changes
- `--delete-data`: clear database data
- `--delete-data=<mode>`: clear database data (`always`, `on-conflict`, or `never`)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this a generated file?

);

const spacetimedb = schema({ players, playerLevels });
const spacetimedb = schema({ players, player_levels });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

(ctx) => {
const out: Array<{ id: bigint; name: string; level: bigint }> = [];
for (const playerLevel of ctx.db.playerLevels.level.filter(2n)) {
for (const playerLevel of ctx.db.player_levels.level.filter(2n)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


// Track which chunks each player is subscribed to
const playerChunk = table(
const player_chunk = table(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

if (!player) return [];

const chunk = ctx.db.playerChunk.playerId.find(player.id);
const chunk = ctx.db.player_chunk.playerId.find(player.id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

);

const playerLevels = table(
const player_levels = table(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

);

const spacetimedb = schema({ players, playerLevels });
const spacetimedb = schema({ players, player_levels });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

t.array(playerLevels.rowType),
(ctx) => ctx.from.playerLevels
t.array(player_levels.rowType),
(ctx) => ctx.from.player_levels

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

export const levels_for_high_scorers = spacetimedb.anonymousView(
{ name: 'levels_for_high_scorers', public: true },
t.array(playerLevels.rowType),
t.array(player_levels.rowType),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

return ctx.from.players
.where(p => p.score.gte(1000n))
.rightSemijoin(ctx.from.playerLevels, (p, pl) => p.id.eq(pl.player_id))
.rightSemijoin(ctx.from.player_levels, (p, pl) => p.id.eq(pl.player_id))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

import { table, t, schema } from 'spacetimedb/server';

const userAvatar = table(
const user_avatar = table(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

);

const spacetimedb = schema({ userAvatar });
const spacetimedb = schema({ user_avatar });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

}, (ctx, { userId, mimeType, data }) => {
// Delete existing avatar if present
ctx.db.userAvatar.userId.delete(userId);
ctx.db.user_avatar.userId.delete(userId);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


// Insert new avatar
ctx.db.userAvatar.insert({
ctx.db.user_avatar.insert({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


// Private table with sensitive data
const userAccount = table(
const user_account = table(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

);

const spacetimedb = schema({ userAccount });
const spacetimedb = schema({ user_account });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

(ctx) => {
// Look up the caller's account by their identity (unique index)
const user = ctx.db.userAccount.identity.find(ctx.sender);
const user = ctx.db.user_account.identity.find(ctx.sender);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


const spacetimedb = schema({
damageEvent,
damage_event,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


// Publish the event
ctx.db.damageEvent.insert({
ctx.db.damage_event.insert({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

```typescript
// 2.0 server -- explicitly publish events via an event table
const damageEvent = table({ event: true }, {
const damage_event = table({ name: 'damage_event', event: true }, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

// schema() takes an object: schema({ damageEvent }), never schema(damageEvent)
const spacetimedb = schema({ damageEvent });
// schema() takes an object: schema({ damage_event }), never schema(damage_event)
const spacetimedb = schema({ damage_event });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


export const dealDamage = spacetimedb.reducer({ target: t.identity(), amount: t.u32() }, (ctx, { target, amount }) => {
ctx.db.damageEvent.insert({ target, amount });
ctx.db.damage_event.insert({ target, amount });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

// 1.0 -- REMOVED in 2.0
spacetimedb.reducer('my_reducer', ctx => {
ctx.db.myTable.id.update({
ctx.db.my_table.id.update({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


```typescript
const myTable = table({ name: 'my_table' }, {
const my_table = table({ name: 'my_table' }, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

spacetimedb.reducer(ctx => {
ctx.db.myTable.id.delete(1);
ctx.db.myTable.insert({
ctx.db.my_table.id.delete(1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

ctx.db.myTable.id.delete(1);
ctx.db.myTable.insert({
ctx.db.my_table.id.delete(1);
ctx.db.my_table.insert({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


```typescript
const myTimer = table({ scheduled: () => runMyTimer }, {
const my_timer = table({ name: 'my_timer', scheduled: (): any => runMyTimer }, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

scheduledAt: t.scheduleAt(),
});
const spacetimedb = schema({ myTimer }); // schema({ table }), never schema(table)
const spacetimedb = schema({ my_timer }); // schema({ table }), never schema(table)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.


```typescript
const myTimer = table({ scheduled: () => runMyTimerPrivate }, {
const my_timer = table({ name: 'my_timer', scheduled: (): any => runMyTimerPrivate }, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

scheduledAt: t.scheduleAt(),
});
const spacetimedb = schema({ myTimer }); // schema({ table }), never schema(table)
const spacetimedb = schema({ my_timer }); // schema({ table }), never schema(table)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should be camel case.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants