Skip to content

1052 bug get itemsteal works inconsistently - #1053

Merged
tickBit merged 6 commits into
devfrom
1052-bug-get-itemsteal-works-inconsistently
Oct 27, 2026
Merged

tickBit merged 6 commits into
devfrom
1052-bug-get-itemsteal-works-inconsistently

Conversation

@tickBit

@tickBit tickBit commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

Brief description

Fixes inconsistent item location data returned after moving or stealing items.

The steal operation previously returned items with their old room_id, even though the database had already been updated. During testing, an additional issue was found: POST /item/steal allowed the destination room to belong to another clan. This caused subsequent GET /item/{id} requests to return 403 NOT_AUTHORIZED.

Because stealing uses the shared ItemMoverService, its general move functionality and related tests also needed to be updated.

Change list

  • Updated ItemMoverService.moveItems() to return items read after the database update.
  • Ensured move and steal responses contain the updated room_id and stock_id.
  • Added destination-room ownership validation to POST /item/steal.
  • Restricted stolen items to rooms belonging to the winning player's clan.
  • Return 403 NOT_AUTHORIZED when attempting to steal an item into another clan's room.
  • Added a regression test confirming rejected steal operations do not move items.
  • Updated stealItems, moveItems, and moveItem tests to expect the persisted item location.
  • Updated steal test fixtures to include a valid player belonging to the destination clan.
  • Verified the complete ItemMoverService test suite: 26 tests passing.

Testing

Also tested with Postman to see, that this works.

@codecov-alt

codecov-alt Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/itemMover/itemMover.service.ts 85.71% 2 Missing ⚠️
Files with missing lines Coverage Δ
src/itemMover/itemMover.service.ts 96.10% <85.71%> (-2.39%) ⬇️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@CapoMK25 CapoMK25 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solid as well, approved!

@github-project-automation github-project-automation Bot moved this from Backlog to Done in Altzone-Server Oct 27, 2026
@tickBit
tickBit merged commit bd7757d into dev Oct 27, 2026
5 checks passed
@tickBit
tickBit deleted the 1052-bug-get-itemsteal-works-inconsistently branch October 27, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Bug: GET /item/steal works inconsistently

2 participants