Skip to content

Stacks

Stack is an ordered CRDT-backed collection for decks, draw piles, hands, and discard piles. Typical operations include draw, burn, discard, reset, and shuffle. Source is the related abstraction for combined stacks and reshuffle policies.

Ordering is represented by stable membership entry identities plus mergeable rank sidecars. A shuffle changes ranks rather than replacing the membership list. This preserves concurrent inserts, draws, placements, and removals as replicas merge. Documents using legacy container ordering must be migrated with Engine.migrateLegacyContainers() rather than lazily rewritten by a read.

For reproducible tests and controlled replay, shuffle actions accept an optional seed. A seed does not make unrelated game decisions or network arrival order deterministic; see Deterministic Replay.