ErrorsBackground work · rule
event.store_required
An action emits an event but writes no database, and the app names no database to keep its events in.
Area 12, Background work; not declinable; the next step is usually the human's.
Why Jadpo refuses it
An event waits in an outbox, a table in a database, until each of its
subscribers has it. It is written in the same transaction as the
action's own writes, so it is delivered only if they commit. An action
that writes no database has no transaction to put it in, and Jadpo won't
choose a database for it: application { events: { store: } } names
the one that keeps such events, even when the action reads another.
What it looks like
main.jadpo:
type Note = Text { max_length: 200}type NoteSeen = Event { note: Note}action glance(note: Note) -> Unit { emit NoteSeen { note: note }}
error glance emits NoteSeen but writes no store to keep it in
--> main.jadpo:10:5
|10 | emit NoteSeen { | ^^^^^^^^^^^^^^^ no outbox
- reason
- An event is kept in the outbox of the store its action writes, in the same transaction, until its subscribers have it;
glancewrites no store, itself or through what it calls, andapp.jadponames none withevents: { store: }. - next
- Add
events: { store: main }toapplication { }inapp.jadpo(human) - rule
- event.
store_ required - help
- https://jadpo.
dev/docs/errors/event. store_ required
(human) at the end of the next: line tells your coding agent to stop
and ask you which fix you want, because the choice is yours to make: it
decides which database keeps the events of actions that write none.
How to fix it
If a database should keep these events, name it in
events: { store: } in app.jadpo. A single file has no app.jadpo,
so here the example is a project, with glance in a notes domain and
one database, main. In app.jadpo:
events: { store: main }
glance now begins a transaction in main for its events, and each
NoteSeen waits in main's outbox until its subscribers have it. Every
other action that emits and writes no database keeps its events there
too.
An action that writes a database keeps its events in that one instead,
in the same transaction, so it never needs events: { store: }.
Related
Markdown for agents: /docs/errors/event.store_required.md.Built from Jadpo main at aee2e8f.