NEO-69: Fix output-deny rollback order to prevent item loss.

Remove partial outputs before restoring inputs when output grant is
denied, matching StoreMissing and XP-failure compensating paths.
pull/103/head
VinPropane 2026-05-24 17:33:27 -04:00
parent 36adfd1897
commit c5115a3a13
2 changed files with 3 additions and 1 deletions

View File

@ -55,6 +55,8 @@ None.
2. ~~**Missing output rollback in store-missing branch** — output-add `StoreMissing` restored inputs but not partial outputs.~~ **Done.** `CompensatingRemoveOutputs` added before input restore on that path.
3. ~~**Rollback order on output deny** — `Denied` branch restored inputs before removing partial outputs, so `TryAddStack` could fail silently when bag was full.~~ **Done.** Swapped to remove outputs first, then restore inputs (matches `StoreMissing` and XP-failure paths).
## Verification
```bash

View File

@ -117,8 +117,8 @@ public static class CraftOperations
if (addOutcome.Kind == PlayerInventoryMutationKind.Denied)
{
CompensatingRestoreInputs(playerId, scaledInputs, itemRegistry, inventoryStore);
CompensatingRemoveOutputs(playerId, outputsApplied, itemRegistry, inventoryStore);
CompensatingRestoreInputs(playerId, scaledInputs, itemRegistry, inventoryStore);
return Deny(CraftReasonCodes.InventoryFull);
}