A failed dispatch strands parcels outside an open route
A failed audit write leaves the route dispatched. Separately, a load batch with a missing later parcel keeps earlier parcels loaded. Investigate the shared command transaction and dispatch state machine. Both operations must roll back together with their audit records.
Repository ImplementationParcel depot dispatch
Work through a real codebase.
Choose an environment, investigate the existing implementation and use the tests to check your change. Sign in to open a workspace; execution and Ono usage follow your plan’s allowances.
receive takes id, positive integer weight and destination. route-create takes id, positive integer capacity and destination. IDs are tenant-scoped.
load takes a route ID and a nonempty list of distinct parcel IDs. Every parcel must be received and match the destination. Total loaded weight may equal capacity. The entire batch succeeds or none of it does.
unload is allowed on open routes only. It releases the parcel and subtracts its weight. Dispatch requires a nonempty open route, marks parcels in-transit and freezes the ID/weight manifest.
scan takes a parcel ID, event ID, positive sequence and in-transit/delivered/returned status. Repeated identical event IDs have no effect; changed payloads are event-conflict.
Only a sequence greater than lastSequence may change tracking state. Older scans are retained as evidence but do not move state backwards. Delivered and returned are final: a newer scan cannot reopen them.
close requires a dispatched route whose parcels are all delivered or returned. cancel requires a received parcel. list stays tenant-scoped and optionally filters by status.
Each command includes op and tenant. IDs are scoped to a tenant. A request is limited to 200 commands. Commands run in order; one failed command does not stop the rest. The live workspace API persists state across requests; /run creates a disposable test workspace.
Mutations and audit entries commit together. failAudit simulates an unavailable audit writer and must roll back the command. Read operations never write an audit entry.
The optional request field makes mutation retries idempotent within a tenant. The same request and payload return the saved result. Reusing it with changed fields returns request-conflict. failAudit is excluded from payload comparison.
The response is {results:[...]}. Each result is {ok:true,value:...} or {ok:false,error:...}. The history command returns tenant-scoped audit entries with the successful mutation revision.
receive takes id, positive integer weight and destination. route-create takes id, positive integer capacity and destination. IDs are tenant-scoped.
load takes a route ID and a nonempty list of distinct parcel IDs. Every parcel must be received and match the destination. Total loaded weight may equal capacity. The entire batch succeeds or none of it does.
unload is allowed on open routes only. It releases the parcel and subtracts its weight. Dispatch requires a nonempty open route, marks parcels in-transit and freezes the ID/weight manifest.
scan takes a parcel ID, event ID, positive sequence and in-transit/delivered/returned status. Repeated identical event IDs have no effect; changed payloads are event-conflict.
Only a sequence greater than lastSequence may change tracking state. Older scans are retained as evidence but do not move state backwards. Delivered and returned are final: a newer scan cannot reopen them.
close requires a dispatched route whose parcels are all delivered or returned. cancel requires a received parcel. list stays tenant-scoped and optionally filters by status.
Each command includes op and tenant. IDs are scoped to a tenant. A request is limited to 200 commands. Commands run in order; one failed command does not stop the rest. The live workspace API persists state across requests; /run creates a disposable test workspace.
Mutations and audit entries commit together. failAudit simulates an unavailable audit writer and must roll back the command. Read operations never write an audit entry.
The optional request field makes mutation retries idempotent within a tenant. The same request and payload return the saved result. Reusing it with changed fields returns request-conflict. failAudit is excluded from payload comparison.
The response is {results:[...]}. Each result is {ok:true,value:...} or {ok:false,error:...}. The history command returns tenant-scoped audit entries with the successful mutation revision.
receive takes id, positive integer weight and destination. route-create takes id, positive integer capacity and destination. IDs are tenant-scoped.
load takes a route ID and a nonempty list of distinct parcel IDs. Every parcel must be received and match the destination. Total loaded weight may equal capacity. The entire batch succeeds or none of it does.
unload is allowed on open routes only. It releases the parcel and subtracts its weight. Dispatch requires a nonempty open route, marks parcels in-transit and freezes the ID/weight manifest.
scan takes a parcel ID, event ID, positive sequence and in-transit/delivered/returned status. Repeated identical event IDs have no effect; changed payloads are event-conflict.
Only a sequence greater than lastSequence may change tracking state. Older scans are retained as evidence but do not move state backwards. Delivered and returned are final: a newer scan cannot reopen them.
close requires a dispatched route whose parcels are all delivered or returned. cancel requires a received parcel. list stays tenant-scoped and optionally filters by status.
Each command includes op and tenant. IDs are scoped to a tenant. A request is limited to 200 commands. Commands run in order; one failed command does not stop the rest. The live workspace API persists state across requests; /run creates a disposable test workspace.
Mutations and audit entries commit together. failAudit simulates an unavailable audit writer and must roll back the command. Read operations never write an audit entry.
The optional request field makes mutation retries idempotent within a tenant. The same request and payload return the saved result. Reusing it with changed fields returns request-conflict. failAudit is excluded from payload comparison.
The response is {results:[...]}. Each result is {ok:true,value:...} or {ok:false,error:...}. The history command returns tenant-scoped audit entries with the successful mutation revision.