Wrap logout save_all in a transaction (torn multi-table snapshot) #45
Labels
No labels
bug
ci-cd
client
epic:security-hardening
feature
optimization
priority:high
priority:low
priority:medium
server
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
BlackLobster/Server#45
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Persistence.save_all/1writes 5 tables independently (position / skills / inventory / client_configs / music), each with its ownrescue → {:error}. A crash or single-table failure mid-save leaves a torn snapshot — e.g. new position persisted but inventory not → on relog the player is at the new tile with the old backpack.Fix
Wrap the logout/terminate save in a single
Repo.transactionso it is all-or-nothing (SQLite + Postgres both support it). Keep per-subsystem error collection for diagnostics but roll back the whole set on any failure.Acceptance
Refs:
lib/black_lobster/game/entity/player/persistence.ex:save_all/1.Part of the Security & Data-Integrity Hardening epic.