Остатки и заказы

Транзакции и конкурентные заказы.

CommerceinventorySQLitetransactions

Когда использовать

Preserve order and inventory integrity in a transactional backend.

Решения для реализации

  1. Validate current stock inside the transaction and commit order plus stock changes atomically.
  2. Bind each unique idempotency key to a canonical payload hash and reject different-payload reuse.
  3. Parameterize values, allowlist sort keys and enforce quantity/body limits.
  4. Do not hold a transaction open across external payment network requests.

Как проверить результат

  • Only one order wins the last unit of stock.
  • An exact replay returns its original order.
  • An invalid line rolls back every decrement.

Файлы

SKILL.mdstarters/commerce/server.py
WEBCRAFT © 2026Оригинальные исходники и интерактивные примерыMIT License