aboutsummaryrefslogtreecommitdiff
path: root/internal/game/account_txn.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 01:50:17 -0400
committerhistoria <[not public]>2026-09-18 01:50:17 -0400
commit87d08f0151e643951769e323995f1c5ed89ee200 (patch)
treedc42a0b30ebb5a00dd7ba505cc4eaa44f4f308bc /internal/game/account_txn.go
parent32a3c59cebf2a16277e54d715a67adfdbe00b456 (diff)
downloadthehouseoficarus-87d08f0151e643951769e323995f1c5ed89ee200.tar.gz
fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths
Diffstat (limited to 'internal/game/account_txn.go')
-rw-r--r--internal/game/account_txn.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/internal/game/account_txn.go b/internal/game/account_txn.go
index 2a420ca..cf31dea 100644
--- a/internal/game/account_txn.go
+++ b/internal/game/account_txn.go
@@ -39,15 +39,22 @@ func (g *Game) newTxn() *persistence.Transaction {
// first connection and are re-saved so subsequent authorizations can use
// them. Called from the owner goroutine only.
func (g *Game) adoptCharacterIdentity(p *player.Player, accountName string) {
+ assignedID := ""
if p.ID == "" {
p.ID = newCharacterID()
+ assignedID = p.ID
}
if p.Account == "" {
p.Account = accountName
}
if err := g.AccountStore.SaveCharacter(p); err != nil {
- // Identity backfill is best-effort: the character remains usable,
- // but membership validation falls back to the account list.
+ // Identity backfill is best-effort, but a NON-DURABLE ID must never
+ // become an economy key: a later startup's backfill would assign a
+ // different ID and strand every journal record written under this
+ // one. Fall back to the durable character name instead.
+ if assignedID != "" {
+ p.ID = ""
+ }
log.Printf("identity backfill for %s: %v", p.Name, err)
}
}