One crash-safe write
The row, its facets and the resume timer commit with the workflow's checkpoint in one write. A crash leaves all of it or none of it.
The situation
A workflow that creates a ticket in one call and then waits in another has a gap. A crash between the two leaves a ticket nobody is waiting on, or a wait with no ticket. Routers that claim by facet can also see a row before its metadata lands.
The recipe
import { Durable } from '@hotmeshio/hotmesh';import { conditional, type LTEnvelope } from '@hotmeshio/long-tail';
export async function inspectPart(envelope: LTEnvelope) { const { serialNumber, orderId } = envelope.data; const { workflowId } = Durable.workflow.workflowInfo();
const result = await conditional<{ pass: boolean; notes?: string }>(`inspect-${workflowId}`, { role: 'inspection', type: 'inspection', subtype: 'visual', priority: 2, metadata: { serialNumber, orderId }, envelope: { instructions: 'Check the weld seam and the label' }, timeout: '8h', }); return { type: 'return' as const, data: { serialNumber, result } };}Passing the config to conditional writes the escalation inside the workflow’s checkpoint. The row’s signal_key is the signal id, so every resolve surface resumes this run in place.
The guarantee
One commit holds the row, every metadata facet, the signal_key and the timer. A claim-by-facet router reads a complete row from its first visible moment. There is no create activity to retry and no resolve activity on the way back: resolving the row and waking the workflow is one guarded transaction. See Conditional.
Related patterns
The escalation boundary
Early signals are buffered
A payload sent before the workflow starts waiting is held and delivered when the wait registers. Order of arrival stops mattering.
The escalation boundary
Pin the form edition per row
Each row renders and validates against the form version its code was written for, while the role's form keeps evolving.
The escalation boundary
Born-assigned hand-off
The next row is created already assigned to a named person, in the same write that creates it. It lands in their list with no claim step.
The escalation boundary
Answer, timeout or cancel
Every wait ends in one of three typed values: the answer, false on timeout, or null on cancel. Each branch is explicit in code.
