Reads and writes · rule
data.write_before_call
Write comes before a later outside call.
Area 6, Reads and writes; not declinable; the next step is usually the agent's.
No transaction is open while an outside call is out, so an action's writes come after its last call ("Several outside calls"). The error is at the write, naming the last call it comes before; one made through an action it calls names that action and the call it makes:
use app { sheets }use bakery/entities { PriceSheet }use bakery/types { SheetText }use bakery/failures { SheetNotKept }/// Marks a supplier's price sheet checked, then keeps the sheet they sent/// again: the write comes before the call.action recheck_prices( price_sheet: PriceSheet, sheet_text: SheetText) fails SheetNotKept -> PriceSheet { var checked: PriceSheet = PriceSheet.update(price_sheet) { set: { checked: true } } var sheet: File = attempt sheets.put(encoding.to_utf8(sheet_text), FileType.csv) { storage_full: SheetNotKept } return PriceSheet.update(checked) { set: { sheet: sheet } }}
error: `PriceSheet.update` writes before the call to `sheets.put` --> domains/bakery/actions/recheck_prices.jadpo:12:31 |12 | var checked: PriceSheet = PriceSheet.update(price_sheet) { | ^^^^^^^^^^^^^^^^^ writes here17 | var sheet: File = attempt sheets.put(encoding.to_utf8(sheet_text), FileType.csv) { | ---------- the call it must follow reason: No transaction is open while an outside call is out, so an action writes only after its last call; run as written, `sheets.put` would be refused. next: Move `PriceSheet.update` after `sheets.put` (agent) rule: data.write_before_call help: https://jadpo.dev/docs/errors/data.write_before_callcheck failed: 1 error, 5 files
Markdown for agents: /docs/errors/data.write_before_call.md.Built from Jadpo main at a707efb.