Learning Center · Independent lesson · 4 min with exercise
Design a workflow that survives a second try
Follow a farm co-op’s surplus produce from an inventory update to a reviewed pickup list, even when an update arrives twice.
What happens if the same pickup appears twice?
A fictional co-op offers spare produce to a community pantry. Growers record available crates during the morning. Someone at the co-op reviews the quantities before a driver receives a pickup list. Asking an assistant to group the records by stop is straightforward. Making that useful every week takes a little more design.
Start with the event that begins work. Saving a pickup record can trigger a proposed change immediately. A schedule can instead collect eligible records every Friday at 9:00. Both can feed the same draft. Specify a cutoff time, who owns late changes and which record identifies a pickup across both routes.
Fictional worked example
Follow pickup lot C-17 through one morning
| Incoming record | What the workflow should do |
|---|---|
| 8:40 · C-17, revision 1, six crates | Make one proposed pickup entry tied to C-17 revision 1. |
| 8:42 · the same revision is delivered again | Find the existing entry and leave the quantity at six. |
| 9:00 · scheduled collection | Reconcile against the current record. Reuse the pending entry. |
| 9:05 · revision 2 corrects the count to four | Show the correction, replace the six-crate draft and require approval of revision 2. |
Decide how to recover
After a temporary read error, the team could try again twice, then send the case to a staffed queue. If a save times out, look up the existing entry by pickup ID and revision before repeating the operation. Giving a repeated request the same practical effect is called idempotency.
Give the reviewer a real choice
Show the previous and new quantities, source, cutoff and next action. Approval applies to the version on screen. If the grower edits it before dispatch, present the revised list. If it already went out, create a correction for the reviewer and keep a record of the earlier handoff.
Try this prompt
Sketch the event, schedule, record key, draft, approval and recovery steps for our fictional produce pickup. Use C-17 revision 1 with six crates, the same revision twice, and revision 2 with four crates. Walk through a temporary read failure and a save with an unknown outcome. Name what the reviewer needs to see before anyone contacts a driver.
Make the decision
The record arrives at 9:07 after the coordinator has approved six crates but before the list is sent. What must happen before the driver gets it?
Compare your reasoning
Mark the old approval as superseded. Show six changing to four and ask for a new decision. A retry can restore a connection. It cannot approve a changed pickup.
Go deeper · Write a test for duplicate and late events
Run a paper test with the same revision arriving three times, then revision 2, then an old copy of revision 1. You should finish with one active proposed pickup of four crates at revision 2. The current version needs its own approval before release.
When more than one worker can handle events, checking a list and writing to it in separate unprotected steps can still create two entries. Enforce one entry per pickup and revision where the records are written. Keep the manual pickup sheet available while the team measures exceptions.