Jobs and events · rule
step.context
Several changing calls where a retry can't resume them.
Area 12, Jobs and events; not declinable; the next step is usually the human's.
Several changing calls are made only where a retry can carry on from the
last answer: a subscriber, or a route whose API requires
Idempotency-Key. A route of an API that doesn't require it gets a new key
each time its client tries again:
use app { sheets }use bakery/types { PriceSheetUpload }use bakery/failures { SheetNotKept }/// Keeps a supplier's price sheet, then a copy for the accountant.action file_prices(sent_sheet: PriceSheetUpload) fails SheetNotKept -> Unit { var sheet: File = attempt sheets.put(encoding.to_utf8(sent_sheet.sheet_text), FileType.csv) { storage_full: SheetNotKept } var invoice_copy: File = attempt sheets.put( encoding.to_utf8(sent_sheet.sheet_text), FileType.csv ) { storage_full: SheetNotKept } assert sheet != invoice_copy}
use bakery/types { PriceSheetUpload }use bakery/actions { file_prices }/// Where suppliers send their price sheets.routes PriceSheets { prefix: /price-sheets /// Keeps a supplier's price sheet. POST / { authentication: RouteAuthentication.none input: PriceSheetUpload status: SuccessStatus.no_content run: file_prices(input) }}
error: `POST /price-sheets` runs `file_prices`, which makes 2 changing calls, but API `main` doesn't require `Idempotency-Key` --> domains/bakery/routes/price_sheets.jadpo:9:5 |9 | POST / { | ^^^^^^ a retry can't resume them reason: Several changing calls are each recorded under their action's key, so a retry carries on from the last answer instead of sending them again; a route keeps its key across a retry only when its API requires the client's `Idempotency-Key`. next: Require the key with `idempotency: Idempotency.required` on API `main`, or answer `202` and make the calls in a subscriber (human) rule: step.context help: https://jadpo.dev/docs/errors/step.contextcheck failed: 1 error, 8 files
A schedule's retry is its next run, under a key of its own, and a run
keeps each item to one changing call, so a schedule and a batches.each
whose action makes several are refused the same way, at the schedule and
at the run's call.
Markdown for agents: /docs/errors/step.context.md.Built from Jadpo main at a707efb.