Act towards a goal state
A station that changes something outside the line, such as posting an invoice to a ledger, filing an email or creating a task, works towards an end state: "this invoice is in the ledger", "this email is in the processed folder". It doesn't replay a fixed list of moves. On each workpiece it:
- Reads where the target stands now.
- Compares that with the goal.
- Does only what is missing, and records what it did, including "nothing: already there".
| The ledger has | The station |
|---|---|
| Nothing for this invoice | Creates the entry |
| The same entry | Leaves it, and records "already posted" |
| An older version of the entry | Replaces it |
| An entry whose invoice was withdrawn | Voids it |
Why
- A re-run is safe. If the station dies after posting but before moving the workpiece on, the next run finds the entry already there and only finishes the move. Nothing is posted twice.
- People can work alongside the line. If someone posts an invoice by hand, the station sees it and does nothing.
- What happened is on record. "Created", "already there" and "replaced" are different outcomes, and the run report counts each.
Read again right before you write
The target can change between the moment the line looked at it and the moment the station acts: a person categorises a bank line by hand, another run gets there first. Just before each write, read the target again. If what you were about to change has moved, skip it and record why.
When the goal can't be reached yet
Sometimes the station can't act yet: the invoice isn't approved, the vendor doesn't exist in the ledger, the payment hasn't cleared. That is a precondition that isn't met yet. It is not a failure: nothing is wrong, and it will clear once something else happens. Never send it to failed/. Choose one of two ways to wait:
| Hold the workpiece | Let a later run bring it back | |
|---|---|---|
| Do this | Move it to a waiting station that checks the precondition on a timer and releases it | Finish the workpiece, record "not yet" and the reason, and act when the source shows it again |
| When | Only this workpiece will ever carry the work forward | The line head reads the source again on every run, or another path in the line finishes the job |
| Example | An invoice waits for a manager's approval, then goes on to be posted | A bank line waits for its bill to be approved; the next day's run reads the bank feed again and finds it still open |
Either way, the station doesn't force a half-met goal, and it doesn't call other stations to meet the precondition for it. It reads what earlier stations and people have done, and acts when the goal can be reached.
Related
- Waiting gets its own station: how a held workpiece waits, and what releases it
- Batches and concurrency: run one at a time when workpieces act on the same thing outside
- The line head's registry: how a line head that reads its source again doesn't take the same work twice