Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -753,6 +753,7 @@ ctx.sender // Identity of caller
ctx.connectionId // ConnectionId | undefined
ctx.timestamp // Timestamp
ctx.identity // Module's identity
ctx.random // Deterministic random generator
```

</TabItem>
Expand All @@ -764,7 +765,7 @@ ctx.Sender // Identity of caller
ctx.ConnectionId // ConnectionId?
ctx.Timestamp // Timestamp
ctx.Identity // Module's identity
ctx.Rng // Random number generator
ctx.Rng // Deterministic random generator
```

</TabItem>
Expand All @@ -776,7 +777,7 @@ ctx.sender() // Identity of caller
ctx.connection_id() // Option<ConnectionId>
ctx.timestamp // Timestamp
ctx.identity() // Module's identity
ctx.rng() // Random number generator
ctx.rng() // Deterministic random generator
```

</TabItem>
Expand All @@ -788,7 +789,7 @@ ctx.sender() // Identity of caller (Identity type)
ctx.connection_id // std::optional<ConnectionId>
ctx.timestamp // Timestamp of current transaction (Timestamp type)
ctx.identity() // Module's own identity (Identity type)
ctx.rng() // Random number generator (for seeded randomness)
ctx.rng() // Deterministic random generator
```

</TabItem>
Expand Down
2 changes: 1 addition & 1 deletion skills/concepts/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ SpacetimeDB is a relational database that is also a server. It lets you upload a
## Critical Rules

1. **Reducers are transactional.** They do not return data to callers. Use subscriptions to read data.
2. **Reducers must be deterministic.** No filesystem, network, timers, or random. All state must come from tables.
2. **Reducers must be deterministic.** No filesystem, network, timers, wall-clock time, or ambient randomness. Use `ReducerContext` APIs such as `ctx.timestamp` / `ctx.Timestamp` and the language-specific deterministic RNG instead.
3. **Read data via tables/subscriptions**, not reducer return values. Clients get data through subscribed queries.
4. **Auto-increment IDs are not sequential.** Gaps are normal, do not use for ordering. Use timestamps or explicit sequence columns.
5. **`ctx.sender` is the authenticated principal.** Never trust identity passed as arguments.
Expand Down
Loading