RRT Heavy16: A Workflow From Request to Receipt A receipt first A client starts a job by calling start with a workflow kind and its arguments. The job may take many steps across several canisters, so the endpoint does not wait for it. It records the request and returns a receipt number, or a typed problem if it cannot accept. Admissions is ordinary application code like the Shop's Inventory. It checks the caller and the arguments, and it refuses with Busy when too many requests are waiting. All of this happens before the request is saved. The client can ask for the status of its receipt. At first it is Pending. Shortly after, the app takes the next request in line and starts it as a workflow. The status becomes Started and names the workflow and its execution number. Four inputs and a registration Each workflow has its own folder. The graph file says which steps run and in what order. The memory version declares the data a job carries. Rules are small pure functions the graph refers to. Operations are the steps that do something. The local graph has three states. Open is a local step handled by ops dot open, and it leads to Audit. Audit is handled by ops dot audit and leads to Done, which succeeds. The order of work lives in this file and nowhere in the Rust code. The graph also declares what happens on failure. A step is retried when the retryable rule says so, up to five times with a growing delay, and the job pauses if retries run out. The rule itself is one line of Rust. Only the Unavailable error is worth retrying. A job's data is saved between steps, so it is declared in a versioned memory file like any other saved data. Progress lists the stages a job can be in, and here there is one, Request. It derives Takt's Progress. The file also declares the job's error type and how large a payload counts as, and those size answers must be truthful. Takt generates a trait from the graph with one method per handler. The app implements it. Open and audit each dispatch a ledger command, the one from the last lesson. On success the step adds the block number to the job's data and returns it as the next stage. On failure it returns one of the job's errors. Two lines connect the graph to the build. The build script lists the graph file. The workflow's mod dot r s includes the generated code. If the graph names a handler or a stage that the Rust code lacks, the build fails, and Takt's project check points at the line in the graph file. Local steps, then a remote one Now the job runs. Open dispatches its command and the ledger records a block. The job moves to Audit, which records a second block, and then to Done. The workflow test runs this graph and counts two commands and two block numbers in the finished job. The sequence workflow starts with a step of a different type. Reserve is Remote. It runs on a peer canister. The graph names an operation for it and a contract, and it catches a rejection and routes the job to a Rejected state. Prepare builds the dated ledger command for the peer's work dot dispatch route. The operation declares that it is idempotent. A retry sends the same request, and the peer returns its existing receipt for that command within the replay window. The author must check that the peer offers that guarantee before declaring the step safe to retry. When the reply comes back, the operation sorts it into three outcomes. A block number means the step succeeded. A clear business error means it failed, and the graph's catch takes over. A reply the operation cannot read yields Unknown. That outcome stays unresolved until the app has evidence. On the peer, the same application code receives the request. A route is a named, typed entry for messages from other canisters. This one decodes a command, dispatches it to the ledger, and replies with the result. Only canisters the owner has added as peers are accepted. Finish the work first Heavy16 finishes its outstanding work before an upgrade. The root names a check callback. The check refuses the upgrade while any request is queued, any job is pending, or any message is in transit. The app finishes that work and tries again.