seed.failed
A seed jadpo seed ran stopped at a call that failed or faulted, and the calls before it stay in the database.
Area 14, Tools; not declinable; the next step is usually the agent's.
Why Jadpo refuses it
jadpo seed runs a seed's calls against the development database, each
committing on its own, as calls from the app would. When one fails or
faults, carrying on could write records that depend on the one that
didn't happen, so the seed stops there. It shows where, as a test's
failure does, and says what the earlier calls left in the database,
since they were committed and aren't undone.
What it looks like
A project whose notes are each written down once, with a seed demo:
database/seeds/demo.jadpo:
use notes/// A few notes, for trying the app.seed { attempt notes.add_note("Buy milk") attempt notes.add_note("Book the dentist")}
Run twice, the seed's first call fails the second time, since that note is already written down:
jadpo seed demo > /dev/nulljadpo seed demo
error Seed demo stopped with NoteExists from action add_note
--> domains/notes/actions/add_note.jadpo:7:20
|7 | return attempt Note.create { | ^^^^^^^^^^^^^ rejected here
- reason
- Its code is
note_exists, conflict (409): "That note is already written down." The calls were seed demo -> action add_note. What the seed's earlier calls committed stays in the database. - next
- Fix what it reports, then run
jadpo seed demoagain (agent) - rule
- seed.
failed - help
- https://jadpo.
dev/docs/errors/seed. failed
(agent) at the end of the next: line means your coding agent can make the fix itself.
How to fix it
If the seed should run more than once, have it skip a note that is already there:
seed { match notes.add_note("Buy milk") { success -> {} NoteExists -> {} } ...}
A second run of jadpo seed demo then leaves the notes as they are and
succeeds.
Related
Markdown for agents: /docs/errors/seed.failed.md.Built from Jadpo main at aee2e8f.