Bot pickup must pre-check inventory space (full pack → failed pickup, not item loss) #52
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#52
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
BotHandlers.pickup_at_tile/_removes the ground item viaGroundItems.pickup/3and then callsContainer.add/3. If the bot's backpack is full, the add fails after the item has already left the ground — the item is silently lost. The player pickup path (Actions.do_pickup/4) pre-checks withContainer.has_space?/2, so it never reaches this state.This is item-loss, not a dupe, and only affects bots, so stakes are low — but it quietly drains items out of the economy pool.
Task
Pre-check space before removing from the ground (mirror
do_pickup/4'sContainer.has_space?/2guard) so a full pack results in a failed pickup with the item left on the ground, not a pickup-then-loss. Do not add a pickup-then-redrop path — the correct outcome is a clean failed pickup.Acceptance
Refs:
lib/black_lobster/game/entity/player/bot_handlers.ex(pickup_at_tile), cf.lib/black_lobster/game/entity/player/actions.exdo_pickup.Part of the Security & Data-Integrity Hardening epic.