Jobs and events · rule
step.unkeyed
Changing call with no idempotency key beside another changing call.
Area 12, Jobs and events; not declinable; the next step is usually the agent's.
A changing call with no idempotency key is the only changing call in its action, so a receipt sent after a payment belongs in a subscriber of the payment's event:
use app { pay }use shared/providers/acme_pay/// Pays a supplier's invoice, then sends them a receipt.action pay_supplier(invoice: AcmePay.Reference) -> AcmePay.Payment { var payment: AcmePay.Payment = pay.payments.create( AcmePay.PaymentRequest { reference: invoice } ) var receipt: AcmePay.Payment = pay.receipts.send( AcmePay.PaymentRequest { reference: payment.id } ) assert receipt.id == payment.id return payment}
error: `pay.receipts.send` takes no idempotency key, but `pay_supplier` makes another changing call, `pay.payments.create` --> domains/bakery/actions/pay_supplier.jadpo:11:36 |11 | var receipt: AcmePay.Payment = pay.receipts.send( | ^^^^^^^^^^^^^^^^^ no key reason: A changing call with no key may act twice if it is sent again, and once its answer is lost only an operator can say whether it went through, so it stays the only changing call in its action. next: Move `pay.receipts.send` to a subscriber of an event `pay_supplier` emits (agent) rule: step.unkeyed help: https://jadpo.dev/docs/errors/step.unkeyedcheck failed: 1 error, 10 files
Markdown for agents: /docs/errors/step.unkeyed.md.Built from Jadpo main at a707efb.