Login crashes on a missing has_one relation (inventory/skills/location/music) #53
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#53
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
Game.Entity.Playerinit hydrates a profile'shas_onerelations directly —profile.inventory.backpack,profile.inventory.equipment,profile.skills,Location.to_tile(profile.location),profile.music. If any relation row is missing (nil), init raises and the player can't log in (the GenServer crash-loops). New-account registration (Game.World.Agent.create_new_profile/1) always creates all five rows, so this is a data-corruption / partial-migration tail risk, not a normal-path bug — but when it fires it's a hard login failure for the affected account.This is a different bug class from #48 (truthy-empty
|| default): a nil relation is falsy and crashes loudly, whereas #48 covered present-but-empty structures slipping through a||. The appearance relation is already guarded (usable_appearance/1→Appearance.default/0from #48); the other four are not.Task
Guard each hydrated relation at login with a safe fallback, or fail the login gracefully with a logged error rather than crash-looping. Decide per-relation: default-row reconstruction (preferred where a sane default exists, e.g. skills/inventory) vs. clean login rejection.
Acceptance
Refs:
lib/black_lobster/game/entity/player.exinit hydration (~lines 653–765).Part of the Security & Data-Integrity Hardening epic.