Sweep value || default truthy-empty-struct traps over DB-loaded values #48

Closed
opened 2026-06-11 14:06:27 +00:00 by sickday · 0 comments
Owner

Problem

db_value || default uses default only when db_value is nil/false — but a present-but-empty %{}/struct is truthy, so the wrong (empty) value is used. Already bit us once (do_spawn empty appearance → broken encode → bot silently dropped; see the botgen_skeleton_appearance_fast_restart note).

Task

Grep for || / Map.get(.., key) || patterns over DB-loaded values and replace with explicit emptiness checks where an empty map/list/struct is a valid-but-wrong value.

Acceptance

  • No DB-hydration path treats a present-but-empty structure as "missing".

Part of the Security & Data-Integrity Hardening epic.

## Problem `db_value || default` uses `default` only when `db_value` is `nil`/`false` — but a present-but-empty `%{}`/struct is **truthy**, so the wrong (empty) value is used. Already bit us once (`do_spawn` empty appearance → broken encode → bot silently dropped; see the `botgen_skeleton_appearance_fast_restart` note). ## Task Grep for `|| ` / `Map.get(.., key) ||` patterns over DB-loaded values and replace with explicit emptiness checks where an empty map/list/struct is a valid-but-wrong value. ## Acceptance - No DB-hydration path treats a present-but-empty structure as "missing". Part of the Security & Data-Integrity Hardening epic.
sickday added this to the v1 milestone 2026-06-11 14:11:16 +00:00
sickday self-assigned this 2026-06-11 14:11:26 +00:00
sickday added this to the v1 project 2026-06-11 14:11:48 +00:00
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
BlackLobster/Server#48
No description provided.