Fable
Every square in Chessboard Town must update the same ledger
The post station in Chessboard Town was like a grid of squares. Letters came in through the south gate and might go to the accounting office, the warehouse, the county school, or the dock. In the past there were few letters, and the couriers relayed them by experience; if they went the wrong way, they could quickly find their way back.
Later, the letters became more complex. Some letters had to verify identity before entering the accounting office, some had to get a warehouse receipt before going to the dock, and some needed annotations from the county school before returning to their origin. Each letter carried different materials, and routes could be changed by intermediate results.
The postmaster first drew a single main route: south gate, accounting office, warehouse, dock. But many letters should never have followed this route. Letters needing county school annotations were sent to the dock, and the dock returned them; letters lacking identification entered the accounting office, and the accounting office did not dare act.
So the postmaster wrote different routes for each type of letter. Soon the wall was covered in notes, and the notes contradicted each other: should a letter returned by the warehouse go back to the accounting office or to the south gate? After the county school added its annotations, did the identity still need re-verification?
A road builder proposed starting not from a single route, but drawing every place as a node and the materials carried by letters as the same ledger. Each node could only read the ledger's contents, add its own results, and decide the next edge based on the ledger's new state.
The south gate node handled identity, the accounts node handled amounts, the warehouse node handled inventory, the county school node handled annotations, and the dock node handled shipping. The conditions were written on the edges: only after identity passed did one enter accounts; if inventory was insufficient, it returned to procurement; if annotations were missing, it went to the county school; only when everything was complete did it reach the dock.
After the new graph was running, the courier no longer memorized the entire complex route. He only looked at the current node, the same ledger, and the next edge that met the conditions. When a letter was returned, the reason for return was also written into the ledger, so next time it would not be treated as a new letter and wander from the start. The station also set up checkpoint saves at key nodes. Save once before reaching the warehouse, save once before dispatch. If something went wrong on the road, it could recover from the most recent state instead of replaying all the steps. The road builder also stipulated that nodes could not hide notes privately. All newly added material had to be written back to the same ledger, otherwise the next station could not see the previous station's judgment. Shared state gave route changes a basis and allowed reviews to retrace the path taken at the time.
The town of Qipan later discovered that the most important thing about this diagram was not its beauty, but that every step revolved around updating a shared state. Complex work was no longer a crowd of people passing messages to one another, but an execution graph that could decide the next step based on state.