#19854·saleor

Overlapping transaction reports can overwrite the newer charged total

Author: aviadr1Created Sep 30, 2026Updated Sep 30, 2026

Goal

Keep TransactionItem money totals consistent when two distinct provider reports overlap.

Steps to reproduce

  1. On a clean database, create an app-owned TransactionItem.
  2. Start transactionEventReport for CHARGE_SUCCESS, 7.00, reference charge-seven.
  3. After it calculates charged_value but before its TransactionItem.save, report a second CHARGE_SUCCESS, 11.00, reference charge-eleven, and allow that report to finish.
  4. Resume the first save. Both events now exist, but charged_value becomes 7.00 instead of 18.00. Retrying either reference reports alreadyProcessed: true without repairing the total.

This ordering is deterministic with Saleor's existing race_condition.RunBefore helper. The harness also exercised overlapping provider reports through real application connections in #36.

Expected behavior

Both accepted charge events must contribute to the durable charged total, 18.00. An older computation must not overwrite a newer projection.

Additional context

The mutation locks the transaction while saving each event, but releases the lock before recalculating and saving the transaction amounts. Both reports can therefore calculate from different event sets and save in reverse order. This differs from #19852, where a crash between event commit and projection leaves the total unfinished. The earlier Saleor #19836 demonstrates generated harness tests; the regression here can be pinned in Saleor's native suite without the harness dependency.

Environment

Current Saleor main (c69c56c), PostgreSQL-backed pytest run. No production incident is claimed.