Transaction event retry can acknowledge a charge while leaving charged total at zero
Goal
Ensure a provider's idempotent transactionEventReport retry repairs the transaction's money totals after the first delivery is interrupted.
Steps to reproduce
- In a clean test database, create a
TransactionItemowned by a payment app. - Report a
CHARGE_SUCCESSevent for 7.00 with a stablepspReference. - Interrupt
recalculate_transaction_amountsimmediately after the event's transaction commits. The GraphQL call errors, but the event remains stored andcharged_valueis still 0. - Redeliver the identical report. The mutation returns
alreadyProcessed: truewith no error, whilecharged_valueremains 0 instead of 7.00.
A deterministic test using Saleor's ordinary GraphQL test client reproduces this on main (c69c56c).
Expected behavior
A successful retry should leave the accepted event and its derived transaction total consistent. The event should be stored once, and charged_value should be 7.00. A retry that reports success must not leave the money projection unfinished.
Additional context
The mutation commits the event while holding the transaction lock, then releases the lock before recalculating the transaction. The duplicate path skips recalculation. Generated crash/replay histories in due-work-harness #36 first exposed this gap. The earlier Saleor #19836 demonstrates the harness's generated-test adoption; this issue can be pinned with a native Saleor regression without adding the harness as a dependency.
Environment
Current Saleor main (c69c56c), PostgreSQL-backed pytest run. No production incident is claimed.
Source: saleor/saleor